/* NOVA × AvinaBots — dark glass shell (left) + WhatsApp phone preview (right) */

:root {
  --bg-0: #05070d;
  --bg-1: #0a0f1c;
  --glass: rgba(16, 24, 44, 0.55);
  --glass-border: rgba(120, 170, 255, 0.14);
  --text: #e8eefc;
  --dim: #8b98b8;
  --accent: #4da3ff;
  --accent-2: #8f6bff;
  --wa: #10b981;
  --glow: 0 0 18px rgba(77, 163, 255, 0.35);
  --radius: 14px;
  --font: "Inter", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 700px at 70% -10%, #14224a 0%, transparent 60%),
    radial-gradient(900px 600px at 10% 110%, #1b1140 0%, transparent 55%),
    linear-gradient(var(--bg-1), var(--bg-0));
  overflow: hidden;
}

.hidden { display: none !important; }
.dim { color: var(--dim); font-size: 0.78rem; }
button { font-family: inherit; }

/* ================= Header ================= */

header {
  position: fixed; top: 0; left: 0; right: 0; height: 58px;
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 1.2rem; z-index: 20;
}
#brand { display: flex; align-items: center; gap: 0.55rem; }
#brand .name { font-weight: 700; letter-spacing: 0.3em; font-size: 0.95rem; }
#brand .brand2 { letter-spacing: 0.06em; background: linear-gradient(90deg, var(--wa), #34d399); -webkit-background-clip: text; background-clip: text; color: transparent; }
#brand .x { color: var(--dim); }
#brand .sub { color: var(--dim); font-size: 0.65rem; letter-spacing: 0.12em; text-transform: uppercase; }

.orb {
  width: 14px; height: 14px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--accent), var(--accent-2) 70%);
  box-shadow: var(--glow);
}
.orb.big { width: 54px; height: 54px; }
.pulse {
  width: 46px; height: 46px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--accent), var(--accent-2) 70%);
  box-shadow: var(--glow);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 50% { transform: scale(0.82); opacity: 0.7; } }

#header-right { display: flex; align-items: center; gap: 0.9rem; }
#status { display: flex; align-items: center; gap: 0.4rem; font-size: 0.72rem; color: var(--dim); letter-spacing: 0.08em; }
#status-dot { width: 8px; height: 8px; border-radius: 50%; background: #e5a445; transition: background 0.3s; }
#status.online #status-dot { background: #46d68c; box-shadow: 0 0 8px rgba(70, 214, 140, 0.7); }
#status.failed #status-dot { background: #e5484d; }

.lang-toggle { display: flex; border: 1px solid var(--glass-border); border-radius: 999px; overflow: hidden; backdrop-filter: blur(8px); }
.lang-toggle button {
  border: none; background: transparent; color: var(--dim);
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em;
  padding: 0.35rem 0.7rem; cursor: pointer;
}
.lang-toggle button.on { background: linear-gradient(135deg, rgba(77,163,255,0.35), rgba(143,107,255,0.35)); color: var(--text); }

/* ================= Layout ================= */

#layout {
  position: fixed; inset: 58px 0 0 0;
  display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
}
#left { position: relative; display: flex; flex-direction: column; min-height: 0; }
#right { display: flex; align-items: center; justify-content: center; padding: 0.8rem 1.2rem; min-height: 0; overflow-y: auto; }

/* ---- Stage / avatar ---- */

#stage { position: relative; flex: 1; min-height: 0; }
#avatar { width: 100%; height: 100%; }

#loading {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; gap: 1rem;
  align-items: center; justify-content: center;
  background: rgba(5, 7, 13, 0.75); z-index: 5;
}
#loading-text { color: var(--dim); letter-spacing: 0.15em; text-transform: uppercase; font-size: 0.72rem; }

/* ---- Start overlay ---- */

#start-overlay {
  position: absolute; inset: 0; z-index: 8;
  display: flex; align-items: center; justify-content: center;
  background: rgba(5, 7, 13, 0.55); backdrop-filter: blur(4px);
}
.start-card {
  display: flex; flex-direction: column; align-items: center; gap: 0.9rem;
  background: var(--glass); border: 1px solid var(--glass-border);
  border-radius: var(--radius); padding: 2rem 2.2rem; text-align: center;
  width: min(430px, calc(100% - 2rem));
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5); backdrop-filter: blur(16px);
}
.start-card h1 { font-size: 1.25rem; letter-spacing: 0.02em; }
.start-card p { color: var(--dim); font-size: 0.88rem; line-height: 1.5; }
#start-button {
  border: none; border-radius: 999px; cursor: pointer;
  padding: 0.75rem 1.6rem; font-size: 0.95rem; font-weight: 700; color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  transition: transform 0.1s, box-shadow 0.2s;
}
#start-button:hover:not(:disabled) { box-shadow: var(--glow); transform: scale(1.04); }
#start-button:disabled { opacity: 0.5; cursor: default; }
#start-hint { font-size: 0.68rem; }

/* ---- Caption ---- */

#caption-wrap {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%);
  width: min(620px, calc(100% - 2rem)); z-index: 6; pointer-events: none;
}
#caption {
  background: var(--glass); border: 1px solid var(--glass-border);
  border-radius: var(--radius); padding: 0.7rem 1rem;
  backdrop-filter: blur(12px); line-height: 1.5; font-size: 0.95rem;
  min-height: 2.6rem; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
}
#caption.idle { color: var(--dim); font-size: 0.85rem; }

/* ---- CTA ---- */

#cta {
  position: absolute; left: 50%; bottom: 90px; transform: translateX(-50%);
  width: min(430px, calc(100% - 2rem)); z-index: 7;
  background: var(--glass); border: 1px solid var(--glass-border);
  border-radius: var(--radius); padding: 1.1rem 1.3rem; text-align: center;
  backdrop-filter: blur(16px); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  animation: rise 0.25s ease-out;
}
#cta-title { font-weight: 700; font-size: 1.05rem; margin-bottom: 0.25rem; }
#cta-text { margin-bottom: 0.8rem; }
#cta-button {
  display: inline-block; text-decoration: none; color: white; font-weight: 700;
  background: linear-gradient(135deg, #25d366, #128c7e);
  border-radius: 999px; padding: 0.65rem 1.5rem; font-size: 0.92rem;
  transition: transform 0.1s, box-shadow 0.2s;
}
#cta-button:hover { transform: scale(1.04); box-shadow: 0 0 18px rgba(37, 211, 102, 0.4); }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 8px); } }

/* ---- Tour bar ---- */

#tour-bar {
  display: flex; flex-direction: column; gap: 0.5rem; align-items: center;
  padding: 0.55rem 1rem 0.8rem; z-index: 9;
}
#progress { display: flex; gap: 0.45rem; flex-wrap: wrap; justify-content: center; }
#progress button {
  display: flex; align-items: center; gap: 0.4rem;
  border: 1px solid var(--glass-border); border-radius: 999px;
  background: transparent; color: var(--dim); cursor: pointer;
  font-size: 0.68rem; letter-spacing: 0.04em; padding: 0.28rem 0.65rem;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
#progress button .n {
  display: grid; place-items: center; width: 15px; height: 15px;
  border-radius: 50%; background: rgba(255,255,255,0.07); font-size: 0.6rem; font-weight: 700;
}
#progress button:hover { color: var(--text); border-color: var(--accent); }
#progress button.done { color: var(--text); }
#progress button.done .n { background: rgba(77, 163, 255, 0.3); }
#progress button.current {
  color: var(--text); border-color: var(--accent);
  background: linear-gradient(135deg, rgba(77,163,255,0.22), rgba(143,107,255,0.22));
  box-shadow: var(--glow);
}
#progress button.current .n { background: var(--accent); color: #05070d; }

#controls { display: flex; align-items: center; gap: 0.45rem; }
#controls > button {
  width: 38px; height: 38px; border-radius: 50%; cursor: pointer;
  border: 1px solid var(--glass-border); background: var(--glass);
  backdrop-filter: blur(8px); color: var(--text);
  display: grid; place-items: center;
  transition: box-shadow 0.2s, transform 0.1s, border-color 0.2s;
}
#controls > button:hover:not(:disabled) { box-shadow: var(--glow); border-color: var(--accent); transform: scale(1.06); }
#controls > button:disabled { opacity: 0.35; cursor: default; }
#controls svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#btn-pause { background: linear-gradient(135deg, rgba(77,163,255,0.35), rgba(143,107,255,0.35)); }
#voice-select {
  max-width: 150px; background: var(--bg-1); color: var(--dim);
  border: 1px solid var(--glass-border); border-radius: 8px;
  padding: 0.4rem 0.5rem; font-size: 0.72rem;
}

/* ================= Phone (right) ================= */

#phone-col { width: min(340px, 100%); }

#view-toggle {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  border: 1px solid var(--glass-border); background: rgba(255, 255, 255, 0.05);
  border-radius: 16px; padding: 4px; margin-bottom: 0.7rem;
  font-size: 0.8rem; font-weight: 600;
}
#view-toggle button {
  border: none; border-radius: 12px; padding: 0.5rem 0.6rem; cursor: pointer;
  background: transparent; color: var(--dim); transition: all 0.2s;
}
#view-toggle button.on { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: white; box-shadow: var(--glow); }
#view-toggle button:not(.on):hover { color: var(--text); }

#phone-bezel {
  border-radius: 2.8rem; background: #1c1917; padding: 8px;
  box-shadow: 0 25px 60px -12px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255,255,255,0.06);
}
#phone-screen {
  position: relative; display: flex; flex-direction: column;
  height: min(560px, calc(100vh - 240px)); min-height: 430px;
  border-radius: 2.25rem; overflow: hidden; background: #ece5dd;
}

/* -- chat header -- */
#chat-header {
  position: relative; z-index: 10; display: flex; align-items: center; gap: 10px;
  background: #1e293b; color: white; padding: 20px 12px 12px;
}
#chat-header .notch { position: absolute; left: 50%; top: 6px; width: 64px; height: 4px; transform: translateX(-50%); border-radius: 999px; background: rgba(0,0,0,0.4); }
#chat-header .back { width: 20px; height: 20px; fill: none; stroke: rgba(255,255,255,0.8); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
#chat-avatar {
  display: grid; place-items: center; width: 36px; height: 36px; flex-shrink: 0;
  border-radius: 50%; background: var(--wa); color: white;
  font-size: 12px; font-weight: 700;
}
#chat-header .chat-title { min-width: 0; flex: 1; line-height: 1.25; }
#chat-name { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#chat-presence { font-size: 11px; color: rgba(255,255,255,0.7); }
#chat-header .hicon { width: 20px; height: 20px; fill: rgba(255,255,255,0.8); flex-shrink: 0; margin-left: 2px; }

/* -- chat scroll area -- */
#chat-scroll {
  position: relative; flex: 1; overflow-y: auto; padding: 8px 12px 12px;
  background-image: radial-gradient(circle at 1px 1px, rgba(0,0,0,0.035) 1px, transparent 0);
  background-size: 14px 14px;
  scrollbar-width: thin; scrollbar-color: rgba(0,0,0,0.2) transparent;
}
#chat-day {
  position: sticky; top: 4px; z-index: 5; width: fit-content; margin: 0 auto 6px;
  background: rgba(255,255,255,0.92); color: #78716c;
  border-radius: 8px; padding: 4px 10px; font-size: 11px; font-weight: 500;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}
#chat-list { display: flex; flex-direction: column; gap: 6px; }

.msg-row { display: flex; animation: msg-in 0.3s ease-out; }
.msg-row.me { justify-content: flex-end; }
.msg-row.bot { justify-content: flex-start; }
@keyframes msg-in { from { opacity: 0; transform: translateY(8px) scale(0.97); } }

.bubble {
  position: relative; max-width: 80%; overflow: hidden;
  border-radius: 16px; background: white; color: #292524;
  font-size: 13.5px; line-height: 1.4;
  box-shadow: 0 1px 1.5px rgba(0,0,0,0.1);
}
.msg-row.bot .bubble { border-top-left-radius: 6px; }
.msg-row.me .bubble { border-top-right-radius: 6px; background: #d9fdd3; }
.bubble.wide { min-width: 13rem; }
.bubble .btxt { padding: 6px 12px; }
.bubble strong { font-weight: 600; }

.meta {
  float: right; margin: 8px 0 0 8px; transform: translateY(2px);
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; line-height: 1; color: #a8a29e; white-space: nowrap;
}
.meta svg { width: 16px; height: 10px; fill: #0ea5e9; }

.sysmsg {
  margin: 4px auto; max-width: 85%; text-align: center;
  background: #fdf3d7; color: #57534e; border-radius: 8px;
  padding: 6px 12px; font-size: 11px; font-weight: 500;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
  animation: msg-in 0.3s ease-out;
}

/* form-reply (green summary) bubble */
.form-reply { padding: 8px 12px 6px; }
.form-reply .fr-head {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: #047857;
}
.form-reply .fr-head svg { width: 14px; height: 14px; fill: currentColor; }
.form-reply .fr-title { margin-top: 2px; font-size: 12px; font-weight: 600; }
.form-reply .fr-rows { margin-top: 4px; border-left: 2px solid rgba(5, 150, 105, 0.3); padding-left: 8px; }
.form-reply .fr-rows p { font-size: 12px; line-height: 1.35; }
.form-reply .fr-rows span { color: #78716c; }

/* quick-reply / flow attachment buttons */
.attach-btn {
  display: flex; width: 100%; align-items: center; justify-content: center; gap: 6px;
  border: none; border-top: 1px solid rgba(231, 229, 228, 0.7);
  background: transparent; padding: 8px 12px; cursor: pointer;
  font-size: 13px; font-weight: 600; color: #0284c7; transition: background 0.15s;
}
.attach-btn:enabled:hover { background: #fafaf9; }
.attach-btn:disabled { opacity: 0.45; cursor: default; }
.attach-btn.chosen { color: #059669; opacity: 1; }
.attach-btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* typing dots */
.typing {
  display: flex; width: fit-content; align-items: center; gap: 4px;
  background: white; border-radius: 16px; border-top-left-radius: 6px;
  padding: 12px 14px; box-shadow: 0 1px 1.5px rgba(0,0,0,0.1);
  animation: msg-in 0.3s ease-out;
}
.typing span {
  width: 6px; height: 6px; border-radius: 50%; background: #a8a29e;
  animation: dot 1.1s ease-in-out infinite;
}
.typing span:nth-child(2) { animation-delay: 0.18s; }
.typing span:nth-child(3) { animation-delay: 0.36s; }
@keyframes dot { 30% { transform: translateY(-4px); opacity: 0.6; } }

/* tap hint pill */
#tap-hint { position: sticky; bottom: 0; z-index: 5; display: flex; justify-content: center; padding-top: 4px; pointer-events: none; }
#tap-hint span {
  background: rgba(28, 25, 23, 0.8); color: white; border-radius: 999px;
  padding: 4px 12px; font-size: 11px; font-weight: 600;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25); animation: hintpulse 1.6s ease-in-out infinite;
}
@keyframes hintpulse { 50% { opacity: 0.55; } }

/* -- input bar -- */
#chat-inputbar { display: flex; align-items: center; gap: 8px; background: #f0ede8; padding: 8px 12px; }
.fake-input {
  display: flex; flex: 1; align-items: center; gap: 8px;
  background: white; border-radius: 999px; padding: 8px 14px;
  font-size: 13px; color: #a8a29e; box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
#chat-inputbar .mic {
  display: grid; place-items: center; width: 36px; height: 36px;
  border-radius: 50%; background: var(--wa); color: white; box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}
#chat-inputbar .mic svg { width: 16px; height: 16px; fill: currentColor; }

/* -- Flow sheet -- */
#flow-sheet { position: absolute; inset: 0; z-index: 30; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.4); }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; height: 88%;
  display: flex; flex-direction: column;
  background: white; color: #292524; border-radius: 16px 16px 0 0;
  box-shadow: 0 -8px 30px rgba(0,0,0,0.25);
  animation: sheet-up 0.3s ease-out;
}
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }
.sheet-head { border-bottom: 1px solid #f5f5f4; padding: 12px 16px; }
.sheet-titlerow { display: flex; align-items: center; justify-content: space-between; }
.sheet-titlerow p { font-size: 14px; font-weight: 700; }
.sheet-close { color: #a8a29e; font-size: 13px; }
.sheet-note { font-size: 11px; color: #a8a29e; }
#flow-progress { display: flex; gap: 6px; margin-top: 10px; }
#flow-progress span { height: 4px; flex: 1; border-radius: 999px; background: #e7e5e4; transition: background 0.3s; }
#flow-progress span.on { background: var(--wa); }

#flow-body { flex: 1; overflow-y: auto; padding: 16px; animation: msg-in 0.25s ease-out; }
#flow-body .q { font-size: 15px; font-weight: 700; }
#flow-body input {
  width: 100%; margin-top: 12px; border: 1px solid #e7e5e4; border-radius: 12px;
  background: #fafaf9; padding: 10px 14px; font-size: 14px; outline: none; font-family: inherit;
}
.flow-opt {
  display: flex; width: 100%; align-items: center; gap: 12px; margin-top: 8px;
  border: 1px solid #e7e5e4; border-radius: 12px; background: white;
  padding: 10px 14px; font-size: 14px; font-weight: 500; color: #44403c;
  text-align: left; cursor: default; transition: all 0.2s;
}
.flow-opt.sel { border-color: transparent; background: rgba(16, 185, 129, 0.12); box-shadow: inset 0 0 0 2px var(--wa); color: #1c1917; }
.flow-opt .radio {
  display: grid; place-items: center; width: 18px; height: 18px; flex-shrink: 0;
  border: 2px solid #d6d3d1; border-radius: 50%;
}
.flow-opt.sel .radio { border-color: var(--wa); }
.flow-opt.sel .radio::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--wa); }

.flow-review { margin-top: 12px; background: #fafaf9; border-radius: 12px; padding: 14px; }
.flow-review p.lbl { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: #a8a29e; margin-top: 10px; }
.flow-review p.lbl:first-child { margin-top: 0; }
.flow-review p.val { font-size: 14px; font-weight: 500; }

.sheet-foot { border-top: 1px solid #f5f5f4; padding: 12px; }
#flow-cta {
  width: 100%; border: none; border-radius: 999px; padding: 10px;
  background: var(--wa); color: white; font-size: 14px; font-weight: 700;
  cursor: default; box-shadow: 0 1px 2px rgba(0,0,0,0.1); transition: opacity 0.2s;
}
#flow-cta:disabled { opacity: 0.4; }

#phone-disclaimer { margin-top: 0.7rem; text-align: center; font-size: 0.66rem; color: var(--dim); line-height: 1.5; }

/* ================= Responsive ================= */

@media (max-width: 900px) {
  body { overflow: auto; }
  #layout { position: static; margin-top: 58px; display: block; height: auto; }
  #stage { height: 52vh; min-height: 340px; }
  #right { padding: 1rem; }
  #brand .sub { display: none; }
}
