/* ═══════════════════════════════════════════════════════════════════════
   E3 ACP AI Assistant — "Aurora" theme
   A full-width, light & vibrant redesign. All selectors below match the
   IDs/classes used by chat.js and class-e3acp-widget.php — functionality
   (chat, image upload, wall visualizer, tabs) is untouched, only the
   visual language changed.
   ═══════════════════════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Sora:wght@600;700;800&family=Inter:wght@400;500;600;700&display=swap');

/* ── Design tokens ──────────────────────────────────────────────────────── */
#e3acp-root {
  --e3-bg:        #ffffff;
  --e3-panel:     #ffffff;
  --e3-card:      #f3f4fb;
  --e3-card2:     #eef0fa;
  --e3-border:    rgba(20,20,45,0.09);
  --e3-text:      #14151f;
  --e3-muted:     #676c7d;
  --e3-faint:     #a6abba;
  --e3-accent:    #1a6ef5;    /* overridden via JS from admin brand color */
  --e3-accent2:   #ff7a45;    /* fixed warm counter-color for the gradient */
  --e3-accent-soft: rgba(26,110,245,0.10);
  --e3-user-bg:   #1a6ef5;
  --e3-bot-bg:    #f3f4fb;
  --e3-radius:    22px;
  --e3-shadow:    0 20px 46px rgba(20,20,60,0.14), 0 4px 14px rgba(20,20,60,0.06);
  --e3-gradient:  linear-gradient(135deg, var(--e3-accent), var(--e3-accent2));
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}
#e3acp-root * { box-sizing: border-box; }
#e3acp-root h1, #e3acp-root h2, #e3acp-root h3 { font-family:'Sora', 'Inter', sans-serif; }

/* ── Root positioning: floating (default) vs embedded (shortcode/full-width) ── */
#e3acp-root.e3acp-root { }
#e3acp-root.e3acp-embedded-root {
  position: relative !important;
  bottom: auto !important; right: auto !important; left: auto !important; top: auto !important;
  z-index: auto !important;
  width: 100%;
  max-width: 100%;
  margin: 0;
}



/* ── Trigger button (floating mode only) ───────────────────────────────── */
#e3acp-trigger {
  width: 62px; height: 62px;
  border-radius: 50%;
  border: none;
  background: var(--e3-gradient);
  color: #fff;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 28px rgba(26,110,245,0.38), 0 2px 10px rgba(0,0,0,0.12);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
}
#e3acp-trigger:hover { transform: scale(1.08) rotate(-4deg); box-shadow: 0 14px 34px rgba(26,110,245,0.5), 0 2px 10px rgba(0,0,0,0.14); }
.e3acp-trigger-icon { display:flex; align-items:center; justify-content:center; }
#e3acp-trigger::after {
  content: ''; position: absolute; top: 3px; right: 3px;
  width: 13px; height: 13px; background: #22c55e;
  border: 2.5px solid #fff; border-radius: 50%;
  animation: e3-pulse 2s ease infinite;
}
@keyframes e3-pulse { 0%,100% { transform: scale(1); opacity:1; } 50% { transform: scale(1.3); opacity:.7; } }

/* ── Panel ──────────────────────────────────────────────────────────────── */
.e3acp-panel {
  position: absolute; bottom: 76px; right: 0;
  width: 400px; max-height: 660px;
  display: flex; flex-direction: column;
  background: var(--e3-panel);
  border-radius: var(--e3-radius);
  box-shadow: var(--e3-shadow);
  border: 1px solid var(--e3-border);
  overflow: hidden;
  transition: opacity .22s ease, transform .22s cubic-bezier(.34,1.56,.64,1);
  transform-origin: bottom right;
}
.e3acp-hidden { opacity: 0; transform: scale(0.92) translateY(14px); pointer-events: none; }
.e3acp-panel:not(.e3acp-hidden) { opacity: 1; transform: scale(1) translateY(0); }

/* Embedded / full-width mode: panel becomes a normal in-page section */
#e3acp-root.e3acp-embedded-root .e3acp-panel {
  position: relative !important; inset: auto !important;
  width: 100% !important;
  height: clamp(560px, 82vh, 800px);
  max-height: none;
  opacity: 1 !important; transform: none !important; pointer-events: auto !important;
  border-radius: 28px;
  box-shadow: 0 30px 70px rgba(20,20,60,0.10), 0 2px 10px rgba(20,20,60,0.05);
}

/* Shared inner-content max-width: full-bleed backgrounds, readable content */
#e3acp-root.e3acp-embedded-root .e3acp-tabs,
#e3acp-root.e3acp-embedded-root #e3acp-messages,
#e3acp-root.e3acp-embedded-root .e3acp-suggestions,
#e3acp-root.e3acp-embedded-root .e3acp-img-preview,
#e3acp-root.e3acp-embedded-root .e3acp-input-bar,
#e3acp-root.e3acp-embedded-root .e3acp-viz-body,
#e3acp-root.e3acp-embedded-root .e3acp-footer {
  width: 100%;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

/* ── Header ─────────────────────────────────────────────────────────────── */
.e3acp-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px clamp(18px, 4vw, 36px);
  background: var(--e3-gradient);
  flex-shrink: 0;
}
#e3acp-root.e3acp-embedded-root .e3acp-header { padding: 26px clamp(18px, 4vw, 36px); }
.e3acp-header-left { display:flex; align-items:center; gap:13px; }
.e3acp-header-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: rgba(255,255,255,0.22);
  border: 2px solid rgba(255,255,255,0.55);
  display: flex; align-items: center; justify-content: center;
  color: #fff; flex-shrink:0;
}
.e3acp-header-name { font-family:'Sora',sans-serif; font-weight:700; font-size:15.5px; color:#fff; letter-spacing:-.01em; }
.e3acp-header-status { font-size:11.5px; color:rgba(255,255,255,0.88); display:flex; align-items:center; gap:5px; margin-top:2px; }
.e3acp-status-dot {
  width:7px; height:7px; border-radius:50%; background:#22ff9c;
  box-shadow: 0 0 8px #22ff9c; display:inline-block;
  animation: e3-pulse 2s ease infinite;
}
.e3acp-header-actions { display:flex; gap:6px; }
#e3acp-root .e3acp-icon-btn {
  width:32px !important; height:32px !important; border-radius:10px !important; border:none !important;
  background:rgba(255,255,255,0.2) !important;
  color:#fff !important; cursor:pointer;
  display:flex !important; align-items:center !important; justify-content:center !important;
  padding:0 !important; margin:0 !important; box-shadow:none !important;
  transition: background .15s ease, transform .15s ease;
}
#e3acp-root .e3acp-icon-btn:hover { background:rgba(255,255,255,0.32) !important; transform:scale(1.06); }

/* ── Tabs — segmented pill switcher ────────────────────────────────────── */
.e3acp-tabs {
  display: flex; gap:5px;
  padding: 5px; margin: 16px clamp(18px, 4vw, 36px) 0;
  background: var(--e3-card);
  border-radius: 999px;
  flex-shrink: 0;
  width: auto;
}
#e3acp-root.e3acp-embedded-root .e3acp-tabs { margin-top:20px; }
#e3acp-root .e3acp-tab {
  flex:1 !important; border:none !important; background:transparent !important;
  color:var(--e3-muted) !important; font-family:'Sora',sans-serif !important;
  font-size:12.5px !important; font-weight:700 !important;
  padding:11px 10px !important; margin:0 !important; cursor:pointer;
  width:auto !important; height:auto !important; min-width:0 !important;
  display:flex !important; align-items:center !important; justify-content:center !important; gap:7px;
  border-bottom:none !important; border-radius:999px !important;
  box-shadow:none !important;
  transition: color .18s ease, background .18s ease, transform .18s ease;
  font-family: 'Sora', 'Inter', sans-serif;
}
#e3acp-root .e3acp-tab:hover { color:var(--e3-text) !important; }
#e3acp-root .e3acp-tab-active {
  background: var(--e3-panel) !important;
  color: var(--e3-text) !important;
  box-shadow: 0 6px 16px rgba(20,20,60,0.12) !important;
}
#e3acp-root .e3acp-tab-active svg { color: var(--e3-accent); }

/* ── Tab content ────────────────────────────────────────────────────────── */
.e3acp-tab-content { display:flex; flex-direction:column; flex:1; min-height:0; }

/* ── Messages ───────────────────────────────────────────────────────────── */
#e3acp-messages {
  flex:1; overflow-y:auto;
  padding: 22px clamp(18px, 4vw, 36px);
  display:flex; flex-direction:column; gap:16px;
  min-height:0;
}
#e3acp-messages::-webkit-scrollbar { width:6px; }
#e3acp-messages::-webkit-scrollbar-thumb { background:var(--e3-border); border-radius:999px; }

.e3acp-msg-row { display:flex; align-items:flex-end; gap:9px; animation: e3-msg-in .25s cubic-bezier(.2,.8,.3,1); }
@keyframes e3-msg-in { from { opacity:0; transform:translateY(8px) scale(.98); } to { opacity:1; transform:translateY(0) scale(1); } }
.e3acp-msg-row-user { flex-direction:row-reverse; }

.e3acp-avatar {
  width:30px; height:30px; border-radius:50%; flex-shrink:0;
  display:flex; align-items:center; justify-content:center;
  font-size:11px; font-weight:700;
}
.e3acp-avatar-bot { background: var(--e3-gradient); color:#fff; }
.e3acp-avatar-user { background: var(--e3-card); border: 1px solid var(--e3-border); color: var(--e3-muted); }

.e3acp-bubble {
  max-width:76%; padding:12px 16px;
  border-radius:18px; font-size:13.8px; line-height:1.6;
  white-space:pre-wrap; word-break:break-word;
}
.e3acp-bubble-bot { background: var(--e3-bot-bg); color: var(--e3-text); border:1px solid var(--e3-border); border-bottom-left-radius:5px; }
.e3acp-bubble-user { background: var(--e3-gradient); color:#fff; border-bottom-right-radius:5px; box-shadow: 0 8px 20px rgba(26,110,245,0.25); }
.e3acp-bubble img { max-width:100%; border-radius:12px; margin-top:8px; display:block; }

.e3acp-typing { display:inline-flex; gap:4px; align-items:center; padding:2px 0; }
.e3acp-typing span { width:5px; height:5px; border-radius:50%; background:var(--e3-muted); animation: e3-tbounce 1.2s infinite ease-in-out; }
.e3acp-typing span:nth-child(2) { animation-delay:.15s; }
.e3acp-typing span:nth-child(3) { animation-delay:.3s; }
@keyframes e3-tbounce { 0%,60%,100% { transform:translateY(0); opacity:.5; } 30% { transform:translateY(-4px); opacity:1; } }

/* ── Suggestions ────────────────────────────────────────────────────────── */
.e3acp-suggestions { display:flex; flex-wrap:wrap; gap:8px; padding:0 clamp(18px, 4vw, 36px) 16px; flex-shrink:0; }
#e3acp-root .e3acp-chip {
  border:1px solid var(--e3-border) !important;
  background:var(--e3-card) !important;
  color:var(--e3-text) !important; font-size:12.5px !important; font-weight:600 !important;
  padding:8px 14px !important; margin:0 !important; border-radius:999px !important;
  cursor:pointer; white-space:nowrap; width:auto !important; height:auto !important;
  box-shadow:none !important;
  transition:background .15s ease, border-color .15s ease, transform .15s ease;
  font-family:inherit;
}
#e3acp-root .e3acp-chip:hover { background:var(--e3-accent-soft) !important; border-color:var(--e3-accent) !important; color:var(--e3-accent) !important; transform:translateY(-2px); }

/* ── Image preview in chat ──────────────────────────────────────────────── */
.e3acp-img-preview {
  margin:0 0 10px; padding: 0 clamp(18px, 4vw, 36px);
  position:relative; display:flex;
}
.e3acp-img-preview img { width:120px; height:80px; object-fit:cover; display:block; border-radius:12px; border:1px solid var(--e3-border); }
#e3acp-root #e3acp-img-remove {
  position:absolute; top:6px; left:calc(clamp(18px, 4vw, 36px) + 96px);
  width:20px; height:20px; background:rgba(20,20,40,.72) !important; color:#fff !important;
  border:none !important; border-radius:50% !important; cursor:pointer;
  font-size:11px; display:flex !important; align-items:center !important; justify-content:center !important;
  padding:0 !important;
}

/* ── Input bar — unified pill ──────────────────────────────────────────── */
.e3acp-input-bar {
  display:flex; align-items:center; gap:6px;
  margin: 0 clamp(18px, 4vw, 36px) 20px;
  padding:6px;
  background:var(--e3-card);
  border-radius:999px;
  flex-shrink:0;
}
#e3acp-root .e3acp-attach-btn {
  flex-shrink:0; width:38px !important; height:38px !important;
  border-radius:50% !important; margin:0 !important; padding:0 !important;
  background:var(--e3-panel) !important; border:1px solid var(--e3-border) !important;
  color:var(--e3-muted) !important; display:flex !important; align-items:center !important; justify-content:center !important;
  box-shadow:none !important;
  cursor:pointer; transition:background .15s ease, color .15s ease;
}
#e3acp-root .e3acp-attach-btn:hover { background:var(--e3-accent-soft) !important; color:var(--e3-accent) !important; }

#e3acp-root #e3acp-input {
  flex:1; resize:none; border:none !important;
  border-radius:0 !important; padding:9px 6px !important; margin:0 !important;
  background:transparent !important; color:var(--e3-text) !important;
  font-family:inherit !important; font-size:13.8px !important; line-height:1.5;
  max-height:100px; overflow-y:auto;
  box-shadow:none !important;
}
#e3acp-root #e3acp-input::placeholder { color:var(--e3-faint) !important; }
#e3acp-root #e3acp-input:focus { outline:none !important; box-shadow:none !important; }

#e3acp-root .e3acp-send-btn {
  flex-shrink:0; width:38px !important; height:38px !important;
  border-radius:50% !important; border:none !important; margin:0 !important; padding:0 !important;
  background: var(--e3-gradient) !important;
  color:#fff !important; cursor:pointer;
  display:flex !important; align-items:center !important; justify-content:center !important;
  box-shadow: 0 6px 16px rgba(26,110,245,0.3) !important;
  transition:transform .15s ease, opacity .15s ease;
}
#e3acp-root .e3acp-send-btn:hover { transform:scale(1.08); }
#e3acp-root .e3acp-send-btn:disabled { opacity:.45; cursor:not-allowed; transform:none; box-shadow:none !important; }

/* ── Error ──────────────────────────────────────────────────────────────── */
.e3acp-error {
  margin:6px clamp(18px, 4vw, 36px) 12px;
  background:rgba(239,68,68,.08); border:1px solid rgba(239,68,68,.28);
  color:#c0362b; font-size:12.5px; line-height:1.5;
  padding:10px 14px; border-radius:14px; flex-shrink:0;
}

/* ── Visualizer tab ─────────────────────────────────────────────────────── */
.e3acp-viz-body { flex:1; overflow-y:auto; padding: 20px clamp(18px, 4vw, 36px) 28px; display:flex; flex-direction:column; gap:14px; }
.e3acp-viz-body::-webkit-scrollbar { width:6px; }
.e3acp-viz-body::-webkit-scrollbar-thumb { background:var(--e3-border); border-radius:999px; }
.e3acp-viz-intro { font-size:13px; color:var(--e3-muted); margin:0; line-height:1.55; }

#e3acp-root .e3acp-dropzone {
  display:block !important; border:2px dashed var(--e3-border) !important;
  border-radius:20px !important; background:var(--e3-card) !important;
  cursor:pointer; overflow:hidden;
  transition:border-color .18s ease, background .18s ease;
}
#e3acp-root .e3acp-dropzone:hover { border-color:var(--e3-accent) !important; background:var(--e3-accent-soft) !important; }
.e3acp-dropzone-inner {
  display:flex; flex-direction:column; align-items:center; gap:8px;
  padding:30px 16px; color:var(--e3-muted); text-align:center;
  font-size:13px; pointer-events:none;
}
.e3acp-dropzone-inner svg { color: var(--e3-accent); }
.e3acp-hint { font-size:11.5px; color:var(--e3-faint); }
#e3acp-vpreview-wrap { position:relative; }
#e3acp-vpreview { width:100%; max-height:180px; object-fit:cover; display:block; }
.e3acp-change-lbl {
  position:absolute; bottom:10px; right:10px;
  background:rgba(20,20,40,.72); color:#fff;
  font-size:11px; font-weight:600; padding:6px 12px; border-radius:999px; pointer-events:none;
}

.e3acp-vfield { display:flex; flex-direction:column; gap:6px; }
.e3acp-vfield label { font-size:11.5px; font-weight:700; text-transform:uppercase; letter-spacing:.05em; color:var(--e3-muted); font-family:'Sora',sans-serif; }
.e3acp-opt { text-transform:none; font-weight:400; color:var(--e3-faint); }
#e3acp-root .e3acp-vfield select,
#e3acp-root .e3acp-vfield input[type="text"] {
  border:1px solid var(--e3-border) !important; border-radius:14px !important;
  padding:11px 14px !important; margin:0 !important; background:var(--e3-card) !important;
  color:var(--e3-text) !important; font-family:inherit !important; font-size:13.5px !important;
  box-shadow:none !important; width:100%; transition: box-shadow .15s ease, border-color .15s ease;
}
#e3acp-root .e3acp-vfield select:focus,
#e3acp-root .e3acp-vfield input[type="text"]:focus { outline:none !important; border-color:var(--e3-accent) !important; box-shadow:0 0 0 4px var(--e3-accent-soft) !important; }
.e3acp-vfield select option { background:var(--e3-panel); }

#e3acp-root .e3acp-viz-btn {
  width:100% !important; padding:14px !important; margin:0 !important; border:none !important; border-radius:999px !important;
  background: var(--e3-gradient) !important;
  color:#fff !important; font-family:'Sora',sans-serif !important; font-size:14.5px !important; font-weight:700 !important;
  box-shadow: 0 10px 24px rgba(26,110,245,0.3) !important;
  cursor:pointer; display:flex !important; align-items:center !important; justify-content:center !important; gap:9px;
  transition:transform .15s ease, box-shadow .15s ease;
}
#e3acp-root .e3acp-viz-btn:hover { transform:translateY(-2px); box-shadow: 0 14px 30px rgba(26,110,245,0.38) !important; }
#e3acp-root .e3acp-viz-btn:disabled { opacity:.55; cursor:not-allowed; transform:none; box-shadow:none !important; }

/* Orb loader */
.e3acp-viz-loading { display:flex; flex-direction:column; align-items:center; gap:12px; padding:30px 0; text-align:center; color:var(--e3-muted); font-size:13.5px; }
.e3acp-viz-loading small { font-size:11.5px; color:var(--e3-faint); }
.e3acp-orb { position:relative; width:50px; height:50px; display:flex; align-items:center; justify-content:center; }
.e3acp-orb-c {
  width:20px; height:20px; border-radius:50%;
  background:radial-gradient(circle at 35% 30%, #fff, var(--e3-accent) 40%, var(--e3-accent2));
  box-shadow:0 0 18px rgba(26,110,245,.5), 0 0 32px rgba(255,122,69,.35);
  animation:e3-opulse 1.5s ease-in-out infinite;
}
.e3acp-orb-r { position:absolute; inset:0; border-radius:50%; border:2.5px solid transparent; border-top-color:var(--e3-accent); border-right-color:var(--e3-accent2); animation:e3-ospin 1s linear infinite; }
@keyframes e3-ospin  { to { transform:rotate(360deg); } }
@keyframes e3-opulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.2)} }
.e3acp-dots span { animation:e3-dblink 1.4s infinite; opacity:0; }
.e3acp-dots span:nth-child(2) { animation-delay:.2s; }
.e3acp-dots span:nth-child(3) { animation-delay:.4s; }
@keyframes e3-dblink { 0%,100%{opacity:0} 50%{opacity:1} }

/* Result */
#e3acp-viz-result { display:flex; flex-direction:column; gap:12px; }
#e3acp-viz-img { width:100%; border-radius:18px; border:1px solid var(--e3-border); display:block; box-shadow: var(--e3-shadow); }
.e3acp-viz-actions { display:flex; gap:8px; }
#e3acp-root .e3acp-viz-action-btn {
  flex:1; padding:11px !important; margin:0 !important; border-radius:999px !important; font-family:inherit !important;
  font-size:12.8px !important; font-weight:700 !important; cursor:pointer; text-align:center;
  background:var(--e3-card) !important; border:1px solid var(--e3-border) !important;
  color:var(--e3-text) !important; text-decoration:none !important;
  box-shadow:none !important;
  transition:background .15s ease, border-color .15s ease;
  display:flex !important; align-items:center !important; justify-content:center !important;
}
#e3acp-root .e3acp-viz-action-btn:hover { background:var(--e3-accent-soft) !important; border-color:var(--e3-accent) !important; color:var(--e3-accent) !important; }

/* ── Footer ─────────────────────────────────────────────────────────────── */
.e3acp-footer {
  text-align:center; font-size:11px; color:var(--e3-faint);
  padding:14px; border-top:1px solid var(--e3-border);
  flex-shrink:0;
}
.e3acp-footer a { color:var(--e3-accent); text-decoration:none; font-weight:600; }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width:640px) {
  #e3acp-root.e3acp-embedded-root .e3acp-panel { border-radius:20px; height:clamp(520px, 86vh, 760px); }
  .e3acp-header { padding:16px clamp(14px,5vw,24px); }
  .e3acp-header-name { font-size:14px; }
  .e3acp-tabs { margin:14px clamp(14px,5vw,24px) 0; }
  #e3acp-messages, .e3acp-suggestions, .e3acp-viz-body, .e3acp-input-bar, .e3acp-error, .e3acp-img-preview { padding-left:clamp(14px,5vw,24px); padding-right:clamp(14px,5vw,24px); }
  .e3acp-input-bar { margin-left:clamp(14px,5vw,24px); margin-right:clamp(14px,5vw,24px); }
  .e3acp-bubble { max-width:86%; font-size:13.2px; }
}

@media (max-width:480px) {
  .e3acp-panel { width:calc(100vw - 20px); right:-6px; max-height:90vh; }
}

@media (prefers-reduced-motion:reduce) {
  #e3acp-root * { animation:none !important; transition:none !important; }
}
