/* Mainstream Net Services — Voice AI booth console.
   Palette and font pulled directly from pwgpt.msnet.my's own live
   assets/css/app.css (:root block) and inc/layout.php's Poppins
   <link> -- user asked for this to match pwgpt's chat exactly, not an
   approximation, so these are the same literal values, not invented.
   Self-contained: does not load or affect theme.css, which still
   styles the hidden admin backoffice pages unchanged. */

:root {
  --bg: #07111f;
  --panel: #0f1b2d;
  --card: #132238;
  --card-elevated: #1d304d;
  --border: rgba(148, 163, 184, 0.16);
  --ink: #f8fafc;
  --ink-soft: #cbd5e1;
  --ink-faint: #8fa1b8;
  --accent: #3b82f6;
  --accent-soft: rgba(59, 130, 246, 0.14);
  --accent-strong: #7db4f7;
  /* Orb palette -- same pwgpt blue (user: "blue the same with pwgpt"),
     with a deeper shade for the core's own gradient depth. */
  --orb-blue: #3b82f6;
  --orb-blue-strong: #7db4f7;
  --orb-blue-soft: rgba(59, 130, 246, 0.16);
  --orb-blue-deep: #163a5c;
  --thinking: #f59e0b;
  --thinking-soft: rgba(245, 158, 11, 0.14);
  --speaking: #3b82f6;
  --speaking-soft: rgba(59, 130, 246, 0.16);
  --error: #ef4444;
  --error-soft: rgba(239, 68, 68, 0.14);
  --font-ui: 'Poppins', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'Cascadia Code', Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background:
    radial-gradient(circle at 18% 12%, rgba(59, 130, 246, 0.10), transparent 42rem),
    radial-gradient(circle at 82% 88%, rgba(59, 130, 246, 0.07), transparent 38rem),
    var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  overflow: hidden;
}

.booth {
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 22px 32px 18px;
  gap: 18px;
}

/* ---- Header ---- */
.booth-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.booth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}
.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: linear-gradient(150deg, var(--accent-strong), var(--accent));
  color: #f8fafc;
  font-weight: 800;
  font-size: 19px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.35;
}
.brand-text strong {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.brand-text span {
  font-size: 12.5px;
  color: var(--ink-soft);
}

.booth-languages {
  display: flex;
  gap: 6px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px;
}
.language-mode {
  background: none;
  border: none;
  color: var(--ink-soft);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.language-mode:hover { color: var(--ink); }
.language-mode.active {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

/* ---- Main stage ---- */
.booth-stage {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(340px, 1fr) minmax(360px, 1.1fr);
  gap: 22px;
}
@media (max-width: 880px) {
  .booth-stage { grid-template-columns: 1fr; overflow-y: auto; }
}

/* ---- Orb column ---- */
.orb-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 26px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 32px;
  text-align: center;
}

.orb-button {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

#orbContainer {
  position: relative;
  width: 200px;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}
#orbGlow {
  position: absolute;
  inset: -30px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--orb-blue-soft), transparent 70%);
  transition: background 0.4s ease;
}
#orb {
  position: relative;
  width: 148px;
  height: 148px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.orb-core {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, var(--orb-blue-strong), var(--orb-blue) 60%, var(--orb-blue-deep) 100%);
  box-shadow: 0 0 46px 6px var(--orb-blue-soft);
  transition: background 0.4s ease, box-shadow 0.4s ease, transform 0.4s ease;
}
.orb-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid var(--orb-blue);
  opacity: 0;
  transition: border-color 0.4s ease;
}

/* Idle: a real water-wave look, always gently rippling outward -- not
   just a static breathing scale (user: "make the orb blue and like
   water wave expanding"). Rings continuously expand and fade at rest, a
   slower/softer version of the listening ripple below. */
body.idle .orb-core { animation: breathe 3.4s ease-in-out infinite; }
body.idle .orb-ring { animation: water-wave 3.6s cubic-bezier(0.2, 0.65, 0.4, 1) infinite; }
body.idle .ring2 { animation-delay: 1.2s; }
body.idle .ring3 { animation-delay: 2.4s; }
@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.045); }
}
@keyframes water-wave {
  0% { opacity: 0.5; transform: scale(0.82); }
  100% { opacity: 0; transform: scale(1.7); }
}

/* Listening: the same water-wave ripple, faster and more layered --
   visibly "actively listening" rather than idly resting. */
body.listening .orb-ring { animation: water-wave 1.6s cubic-bezier(0.15, 0.6, 0.35, 1) infinite; }
body.listening .ring2 { animation-delay: 0.35s; }
body.listening .ring3 { animation-delay: 0.7s; }

/* Thinking: amber, faster subtle spin-glow */
body.thinking .orb-core {
  background: radial-gradient(circle at 34% 30%, #f4cf7a, var(--thinking) 60%, #7a5a1c 100%);
  box-shadow: 0 0 46px 6px var(--thinking-soft);
  animation: think-pulse 1s ease-in-out infinite;
}
body.thinking #orbGlow { background: radial-gradient(circle, var(--thinking-soft), transparent 70%); }
@keyframes think-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(0.96); }
}

/* Speaking: same orb-blue, slightly brighter core, rhythmic pulse like a waveform */
body.speaking .orb-core {
  background: radial-gradient(circle at 34% 30%, #bfe0f7, var(--speaking) 60%, var(--orb-blue-deep) 100%);
  box-shadow: 0 0 50px 8px var(--speaking-soft);
  animation: speak-pulse 0.55s ease-in-out infinite;
}
body.speaking #orbGlow { background: radial-gradient(circle, var(--speaking-soft), transparent 70%); }
body.speaking .orb-ring { animation: water-wave 1.1s cubic-bezier(0.15, 0.6, 0.35, 1) infinite; }
body.speaking .ring2 { animation-delay: 0.25s; }
body.speaking .ring3 { animation-delay: 0.5s; }
@keyframes speak-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.07); }
}

/* Error: red, held still */
body.error .orb-core {
  background: radial-gradient(circle at 34% 30%, #f0a09a, var(--error) 60%, #7a2e28 100%);
  box-shadow: 0 0 46px 6px var(--error-soft);
}
body.error #orbGlow { background: radial-gradient(circle, var(--error-soft), transparent 70%); }

.welcome-stack h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.welcome-sub {
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 14px;
}

.orb-state {
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.7;
  min-height: 66px;
}

/* ---- Transcript column ---- */
.transcript-column {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 20px 22px;
}
.transcript-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.transcript-head strong { font-size: 14.5px; }
#conversationStatus {
  color: var(--ink-soft);
  font-size: 12.5px;
}

.transcript-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 2px;
}
.transcript-item {
  max-width: 88%;
  padding: 11px 15px;
  border-radius: 14px;
  line-height: 1.55;
  font-size: 14px;
}
.transcript-item label {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
  margin-bottom: 4px;
}
.transcript-item.ai {
  align-self: flex-start;
  background: var(--card);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.transcript-item.user {
  align-self: flex-end;
  background: var(--accent-soft);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-bottom-right-radius: 4px;
  color: var(--ink);
}
/* ai-concierge.js appends plain divs with class "message user|ai" for
   card()'s own use -- keep them visually consistent with the styled
   transcript-item markup above, since both can appear in the same feed. */
.message {
  max-width: 88%;
  padding: 11px 15px;
  border-radius: 14px;
  line-height: 1.55;
  font-size: 14px;
}
.message.ai {
  align-self: flex-start;
  background: var(--card);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.message.user {
  align-self: flex-end;
  background: var(--accent-soft);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-bottom-right-radius: 4px;
}

.live-caption {
  flex-shrink: 0;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  color: var(--ink-soft);
  font-size: 12.5px;
  font-family: var(--font-mono);
  min-height: 18px;
}

/* ---- Footer ---- */
.booth-footer {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}
/* Kept in the DOM (not removed) -- the voice pipeline in ai-audio.js
   submits this exact form programmatically after a speech result comes
   in, so deleting the markup would silently break voice input. Visitors
   never see it; this is a voice-only kiosk. */
.fallback-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.fallback-input input {
  flex: 1;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--ink);
  border-radius: 10px;
  padding: 10px 14px;
  font-family: var(--font-ui);
  font-size: 13.5px;
}
.fallback-input input:focus { outline: none; border-color: var(--accent); }
.fallback-input input::placeholder { color: var(--ink-soft); }
.fallback-input button {
  width: 40px;
  border-radius: 10px;
  border: none;
  background: var(--accent);
  color: #f8fafc;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}
.footer-note {
  margin: 0;
  color: var(--ink-soft);
  font-size: 11.5px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* ---- Small screens / portrait kiosk tablets ---- */
@media (max-width: 600px) {
  .booth { padding: 16px 16px 14px; }
  .brand-text span { display: none; }
  .footer-note { text-align: center; }
}
