/* =====================================================================
   AqylTech QR card — styles
   Page: dark blue gradient background. Chat card: white "glow" card that
   sits in a pool of soft blue light. See CLAUDE.md for the design rules.
   ===================================================================== */

:root {
  /* page background */
  --bg-top: #0B1828;
  --bg-mid: #0A1320;
  --bg-bottom: #08101B;

  /* text on the dark background */
  --on-dark: #D5DCE5;
  --on-dark-muted: #9AA8B8;
  --on-dark-dim: #6B7888;

  /* inside the white card */
  --text: #0E1116;
  --text-2: #2F3743;
  --muted: #667080;
  --placeholder: #98A0AC;
  --line: rgba(15, 23, 42, .08);
  --line-2: rgba(15, 23, 42, .15);
  --edge: rgba(45, 110, 220, .28);
  --blue: #2468D8;
  --field: #F1F4F8;
  --tint: rgba(45, 110, 220, .07);

  /* border beam on the message field */
  --beam-a: #2468D8;
  --beam-b: #7DBBFF;
  --beam-glow: rgba(45, 120, 230, .40);

  --font: Manrope, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg-bottom);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body.chatting { overflow: hidden; }
button, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, textarea:focus-visible { outline: 2px solid #4D9EFF; outline-offset: 2px; }

/* ---------- background: blue light falling from the top-left ---------- */
.bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
  background: linear-gradient(180deg, var(--bg-top) 0%, var(--bg-mid) 55%, var(--bg-bottom) 100%);
}
.bg::before {
  content: ""; position: absolute; inset: -60px;
  background:
    radial-gradient(ellipse 60% 32% at 4% 3%, rgba(120, 185, 255, .60), transparent 70%),
    linear-gradient(118deg, transparent 6%, rgba(77, 158, 255, .38) 20%, transparent 36%),
    linear-gradient(118deg, transparent 42%, rgba(36, 104, 216, .22) 55%, transparent 68%),
    radial-gradient(ellipse 70% 40% at 75% 0%, rgba(30, 80, 160, .30), transparent 70%);
  filter: blur(26px);
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 28%, transparent 78%);
          mask-image: linear-gradient(180deg, #000 0%, #000 28%, transparent 78%);
}
.bg::after { /* fine grain so the gradient doesn't look plastic */
  content: ""; position: absolute; inset: 0; opacity: .07; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* ---------- page layout ---------- */
.app {
  position: relative; z-index: 1; isolation: isolate;
  max-width: 440px; margin: 0 auto; min-height: 100svh;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: calc(env(safe-area-inset-top, 0px) + clamp(24px, 5svh, 56px)) 20px calc(env(safe-area-inset-bottom, 0px) + 24px);
}
/* once a conversation starts, the page stops scrolling and the card fills the screen */
.app.chatting {
  height: var(--vvh, 100dvh); min-height: 0;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 18px);
}

.lang {
  position: absolute; top: calc(env(safe-area-inset-top, 0px) + 14px); right: 14px; z-index: 2;
  display: flex; align-items: center; gap: 5px; height: 34px; padding: 0 12px; border-radius: 999px;
  background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .14);
  color: #7F8C9C; font-size: 12px; font-weight: 600; cursor: pointer;
}
.lang b { font-weight: 600; }
.lang b.on { color: #fff; }
.lang i { font-style: normal; opacity: .45; }

.logo { height: 38px; width: auto; display: block; flex: none; }

.hero {
  overflow: hidden; max-height: 90px; flex: none; margin-top: clamp(14px, 3svh, 30px);
  transition: max-height .35s ease, opacity .25s ease, margin .35s ease;
}
.chatting .hero { max-height: 0; opacity: 0; margin-top: 0; }
h1 {
  margin: 0; font-weight: 800; font-size: 32px; line-height: 1.1; letter-spacing: -.035em;
  background: linear-gradient(180deg, #F4F6F8 0%, #A9B6C6 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ---------- the chat card ("glow" version) ---------- */
.card {
  position: relative; width: 100%; margin-top: clamp(16px, 3svh, 28px);
  display: flex; flex-direction: column; text-align: left;
  padding: 14px; border-radius: 28px;
  background: linear-gradient(180deg, #DCE8FA 0%, #F7FAFE 45%, #FFFFFF 100%);
  border: 1px solid rgba(160, 200, 255, .7);
  box-shadow: 0 8px 24px rgba(4, 20, 50, .25);
}
.card::before { /* the pool of blue light the card sits in */
  content: ""; position: absolute; inset: -80px -60px; z-index: -1; pointer-events: none;
  background: radial-gradient(closest-side, rgba(90, 165, 255, .60), rgba(36, 104, 216, .30) 55%, transparent 100%);
  filter: blur(20px);
}
.chatting .card { flex: 1 1 auto; min-height: 0; }

.card-head {
  display: flex; align-items: center; justify-content: space-between; flex: none;
  padding: 0 2px 10px; margin-bottom: 12px; border-bottom: 1px solid var(--line);
}
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar {
  width: 42px; height: 42px; border-radius: 50%; display: block; flex: none;
  box-shadow: 0 0 0 1px rgba(36, 104, 216, .18), 0 2px 8px rgba(4, 20, 50, .18);
}
.who-name { font-weight: 700; font-size: 14.5px; color: var(--text); }
.who-status { display: flex; align-items: center; gap: 6px; margin-top: 1px; font-size: 12px; color: var(--muted); }
.who-status i { width: 7px; height: 7px; border-radius: 50%; background: #22B573; }
.reset {
  display: none; place-items: center; width: 36px; height: 36px; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--line); background: rgba(255, 255, 255, .6); color: var(--muted);
}
.chatting .reset { display: grid; }

/* messages */
.msgs { display: flex; flex-direction: column; gap: 10px; }
.chatting .msgs { flex: 1; min-height: 0; overflow-y: auto; padding-bottom: 4px; scrollbar-width: none; overscroll-behavior: contain; }
.msgs::-webkit-scrollbar { display: none; }
.msg { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.msg.me { align-items: flex-end; }
.bubble {
  max-width: 88%; padding: 11px 14px; border-radius: 18px; border-bottom-left-radius: 6px;
  background: var(--field); border: 1px solid var(--line);
  color: var(--text-2); font-size: 15px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere;
}
.bubble-me {
  max-width: 82%; padding: 11px 14px; border-radius: 18px; border-bottom-right-radius: 6px;
  background: var(--blue); color: #fff; font-size: 15px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere;
}
.typing { display: flex; gap: 5px; padding: 15px 16px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: pulse 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; }
.typing i:nth-child(3) { animation-delay: .4s; }
@keyframes pulse { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }

/* chips: starter questions and quick answers */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 40px; padding: 9px 13px; border-radius: 999px; cursor: pointer; text-align: left;
  border: 1px solid var(--edge); background: #fff; color: var(--blue); font-size: 13.5px; font-weight: 600;
}
.chip:hover { background: var(--tint); }
.starters {
  display: flex; gap: 8px; flex: none; margin: 12px -14px 0; padding: 0 14px;
  overflow-x: auto; scrollbar-width: none; /* one row that scrolls sideways; the cut-off chip hints at it */
}
.starters::-webkit-scrollbar { display: none; }
.starters .chip { flex: none; white-space: nowrap; }
.chatting .starters { display: none; }

/* hand-off card inside the conversation */
.cta { align-self: stretch; margin-top: 4px; padding: 14px; border-radius: 18px; border: 1px solid var(--edge); background: var(--tint); }
.cta h3 { margin: 0; font-size: 16.5px; font-weight: 800; letter-spacing: -.02em; color: var(--text); }
.cta p { margin: 4px 0 12px; font-size: 14px; line-height: 1.45; color: var(--muted); }

.btn-primary {
  display: flex; align-items: center; justify-content: center; width: 100%; height: 48px; border: 0; border-radius: 999px;
  background: var(--blue); color: #fff; font-size: 15px; font-weight: 600; cursor: pointer;
}
.btn-secondary {
  display: flex; align-items: center; justify-content: center; width: 100%; height: 44px; margin-top: 8px; border-radius: 999px;
  background: #fff; border: 1px solid var(--line-2); color: var(--text-2); font-size: 14px; font-weight: 500; cursor: pointer;
}

/* ---------- message field ---------- */
.composer {
  position: relative; flex: none; display: flex; align-items: flex-end; gap: 8px;
  margin: 10px 0 0; min-height: 52px; padding: 5px 5px 5px 16px; border-radius: 18px;
  background: #fff; border: 1px solid rgba(45, 110, 220, .30); overflow: hidden;
}
.composer textarea {
  flex: 1; min-width: 0; resize: none; border: 0; outline: none; background: none;
  padding: 10px 0; margin: 0; height: 42px; max-height: 88px; /* grows to 3 lines, e.g. after voice input */
  font-size: 16px; line-height: 22px; color: var(--text); position: relative; z-index: 1;
}
.composer textarea::placeholder { color: var(--placeholder); }
.btn-send, .btn-mic {
  position: relative; z-index: 1; flex: none; display: grid; place-items: center;
  width: 44px; height: 44px; border-radius: 14px; cursor: pointer;
}
.btn-send { border: 0; background: var(--blue); color: #fff; }
.btn-mic { border: 1px solid var(--edge); background: var(--tint); color: var(--blue); }

/* voice: listening state */
.rec-dot { display: none; flex: none; align-self: center; width: 8px; height: 8px; border-radius: 50%; background: #E5484D; animation: pulse 1s infinite; position: relative; z-index: 1; }
.composer.rec { background: #F3F7FE; border-color: rgba(36, 104, 216, .55); }
.composer.rec .rec-dot { display: block; }
.composer.rec .btn-mic { background: var(--blue); color: #fff; border-color: transparent; animation: ring 1.4s infinite; }
@keyframes ring { 0% { box-shadow: 0 0 0 0 rgba(36, 104, 216, .45); } 100% { box-shadow: 0 0 0 12px rgba(36, 104, 216, 0); } }

/* border beam ("line" style): a light that travels along the bottom edge.
   Only while waiting for the first question — during a conversation it would pull the eye. */
.beam, .beam-glow { position: absolute; left: 0; right: 0; bottom: 0; pointer-events: none; overflow: hidden; }
.beam { height: 1.5px; }
.beam-glow { height: 26px; }
.beam::before, .beam-glow::before {
  content: ""; position: absolute; width: 45%; left: -45%;
  animation: sweep 3.1s cubic-bezier(.45, 0, .55, 1) infinite;
}
.beam::before { top: 0; bottom: 0; background: linear-gradient(90deg, transparent, var(--beam-a) 30%, var(--beam-b) 50%, var(--beam-a) 70%, transparent); }
.beam-glow::before { bottom: -13px; height: 26px; background: radial-gradient(ellipse at center, var(--beam-glow), transparent 70%); filter: blur(6px); }
@keyframes sweep { from { transform: translateX(0); } to { transform: translateX(322%); } }
.chatting .beam, .chatting .beam-glow, .composer.rec .beam, .composer.rec .beam-glow { display: none; }

/* ---------- contacts & footer (on the dark background) ---------- */
.contacts { display: flex; gap: 16px; justify-content: center; flex: none; margin-top: clamp(18px, 3svh, 32px); }
.tile { display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--on-dark-muted); font-size: 11px; font-weight: 500; }
.tile-icon {
  display: grid; place-items: center; width: 54px; height: 54px; border-radius: 16px;
  background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .11); color: var(--on-dark);
}
.chatting .contacts { margin-top: 16px; }
.chatting .tile-label { display: none; }
.chatting .tile-icon { width: 46px; height: 46px; border-radius: 14px; }
.foot { margin: 16px 0 0; font-size: 12px; color: var(--on-dark-dim); flex: none; }
.chatting .foot { display: none; }

/* ---------- WhatsApp hand-off sheet ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 10; display: flex; align-items: flex-end; justify-content: center; background: rgba(4, 10, 20, .55); }
.sheet {
  width: 100%; max-width: 440px; background: #fff; border-radius: 28px 28px 0 0;
  padding: 12px 22px calc(env(safe-area-inset-bottom, 0px) + 24px); text-align: left;
}
.sheet-handle { width: 40px; height: 4px; border-radius: 2px; background: var(--line-2); margin: 0 auto 16px; }
.sheet h3 { margin: 0; font-size: 21px; font-weight: 800; letter-spacing: -.02em; }
.sheet .sheet-text { margin: 6px 0 16px; font-size: 14px; line-height: 1.5; color: var(--muted); }
.sheet-preview {
  margin-bottom: 16px; padding: 14px 16px; border-radius: 16px; background: var(--field); border: 1px solid var(--line);
  font-size: 14px; line-height: 1.55; color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere;
}
.sheet-cancel { display: block; width: 100%; margin-top: 6px; padding: 12px; border: 0; background: none; color: var(--muted); font-size: 13px; cursor: pointer; }

@media (prefers-reduced-motion: reduce) {
  .typing i, .rec-dot, .composer.rec .btn-mic { animation: none; }
  .typing i { opacity: .6; }
  .beam::before, .beam-glow::before { animation: none; left: 27%; }
  .hero { transition: none; }
}
