/* Call to the Huddle: white, Deloitte-branded theme for the visitor app.
 *
 * Loaded after the shared visitor styles (which live in @layer blocks), so
 * these unlayered rules win without !important. Scoped to body.huddle.
 * Brand colours: black, white, Deloitte Green #86BC25 (accents only; it fails
 * text contrast on white) and the darker #26890D for green text and states.
 */

body.huddle {
  --huddle-green: #86bc25;
  --huddle-green-dark: #26890d;
  --huddle-ink: #000;
  --huddle-gray-1: #f6f6f6;
  --huddle-gray-2: #e6e6e6;
  --huddle-gray-3: #d0d0ce;
  --huddle-gray-text: #53565a;
  --huddle-header-h: 64px;
  --huddle-footer-h: 44px;

  /* Re-point the shared tokens at the light palette. */
  --surface-0: #fff;
  --surface-1: #fff;
  --surface-2: var(--huddle-gray-1);
  --surface-3: var(--huddle-gray-2);
  --text-primary: var(--huddle-ink);
  --text-secondary: var(--huddle-gray-text);
  --text-muted: #6b6e72;
  --border-subtle: var(--huddle-gray-2);
  --border-default: var(--huddle-gray-3);
  --color-primary: var(--huddle-ink);
  --color-primary-hover: var(--huddle-green-dark);
  --color-primary-subtle: rgba(0, 0, 0, 0.06);
  --color-success: var(--huddle-green-dark);
  --color-success-subtle: rgba(38, 137, 13, 0.1);
  --color-warning: #8a6d00;
  --color-warning-subtle: rgba(138, 109, 0, 0.1);
  --color-danger: #c4262e;
  --color-danger-subtle: rgba(196, 38, 46, 0.08);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --font-sans: 'Open Sans', 'Segoe UI', Arial, sans-serif;

  background: #fff;
  color: var(--huddle-ink);
  font-family: var(--font-sans);
}

/* ---------- Header / footer ---------- */

.huddle-header {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--huddle-header-h);
  background: #fff;
  border-bottom: 1px solid var(--huddle-gray-2);
  z-index: 10;
}
.huddle-header__inner {
  height: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 32px;
  display: flex;
  align-items: center;
  gap: 20px;
}
.huddle-brand {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--huddle-ink);
  line-height: 1;
}
.huddle-brand__dot { color: var(--huddle-green); }
.huddle-header__rule {
  width: 1px;
  height: 24px;
  background: var(--huddle-gray-3);
}
.huddle-header__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--huddle-gray-text);
  letter-spacing: 0.01em;
}

.huddle-footer {
  position: fixed;
  inset: auto 0 0 0;
  height: var(--huddle-footer-h);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--text-muted);
  border-top: 1px solid var(--huddle-gray-2);
  background: #fff;
}

/* ---------- Page frame ---------- */

body.huddle .huddle-main {
  position: fixed;
  inset: var(--huddle-header-h) 0 var(--huddle-footer-h) 0;
  overflow: auto;
}
body.huddle .huddle-stage {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

body.huddle .visitor-layout {
  width: 100%;
  max-width: 1280px;
  height: 100%;
  margin: 0 auto;
  padding: 40px 32px;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 1fr);
  gap: 48px;
}

/* ---------- Stage (left) ---------- */

body.huddle .visitor-video-panel {
  background: transparent;
  overflow: visible;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 32px;
}

.huddle-hero__eyebrow {
  margin: 0 0 16px;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--huddle-green-dark);
}
.huddle-hero__eyebrow::before {
  content: '';
  display: block;
  width: 48px;
  height: 4px;
  margin-bottom: 20px;
  background: var(--huddle-green);
}
.huddle-hero__title {
  margin: 0 0 20px;
  font-size: clamp(40px, 5.2vw, 68px);
  line-height: 1.02;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--huddle-ink);
}
.huddle-hero__lede {
  margin: 0;
  max-width: 36em;
  font-size: 18px;
  line-height: 1.55;
  color: var(--huddle-gray-text);
}

/* The orb and the developer latency panel are for the dark booth pages. */
body.huddle .visitor-orb-container,
body.huddle .latency-toggle,
body.huddle .latency-panel { display: none !important; }

/* Start overlay: an inline call to action under the hero, not a scrim. */
body.huddle .visitor-start-overlay {
  position: static;
  inset: auto;
  align-items: flex-start;
  background: none;
  backdrop-filter: none;
  z-index: auto;
}
body.huddle .visitor-start-btn {
  padding: 18px 36px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.01em;
  background: var(--huddle-ink);
  color: #fff;
  border-radius: 2px;
  box-shadow: none;
}
body.huddle .visitor-start-btn::after {
  content: '\2192';
  margin-left: 12px;
  display: inline-block;
  transition: transform 120ms ease;
}
body.huddle .visitor-start-btn:hover:not(:disabled) {
  background: var(--huddle-green-dark);
  transform: none;
  box-shadow: none;
}
body.huddle .visitor-start-btn:hover:not(:disabled)::after { transform: translateX(4px); }
body.huddle .visitor-start-btn:disabled::after { content: none; }
body.huddle .visitor-start-btn:focus-visible {
  outline: 3px solid var(--huddle-green);
  outline-offset: 3px;
}

/* ---------- Console: indicator, state, countdown, buttons ---------- */

body.huddle .huddle-console {
  border: 1px solid var(--huddle-gray-2);
  border-top: 4px solid var(--huddle-ink);
  background: #fff;
}
body.huddle.huddle--idle .huddle-console { display: none; }

body.huddle .visitor-controls {
  padding: 28px 32px;
  border-bottom: none;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas:
    'indicator state'
    'indicator countdown'
    'buttons buttons';
  align-items: center;
  column-gap: 24px;
  row-gap: 8px;
}
body.huddle .visitor-controls .voice-indicator {
  grid-area: indicator;
  width: 88px;
  height: 88px;
  margin: 0;
}
body.huddle .visitor-controls .voice-indicator-icon {
  width: 56px;
  height: 56px;
}
body.huddle .visitor-controls .state-label {
  grid-area: state;
  justify-self: start;
  padding: 0;
  background: none !important;
  text-align: left;
  font-size: 22px;
  font-weight: 700;
  color: var(--huddle-ink) !important;
}
body.huddle .visitor-controls .visitor-countdown {
  grid-area: countdown;
  width: 100%;
  max-width: 360px;
}
body.huddle .visitor-controls .mic-selector { grid-column: 1 / -1; }
body.huddle .visitor-controls > .btn {
  grid-column: 1 / -1;
  justify-self: start;
  margin-top: 8px;
}

body.huddle .voice-indicator[data-state="idle"] .voice-indicator-icon {
  background: var(--huddle-gray-2);
  color: var(--huddle-gray-text);
}
body.huddle .voice-indicator[data-state="listening"] .voice-indicator-icon {
  background: var(--huddle-green-dark);
}
body.huddle .countdown-bar { background: var(--huddle-gray-2); }
body.huddle .countdown-fill { background: var(--huddle-green); }
body.huddle .countdown-time { color: var(--huddle-gray-text); }

/* Buttons */
body.huddle .btn {
  border-radius: 2px;
  font-family: var(--font-sans);
  font-weight: 600;
}
body.huddle .btn-ghost {
  color: var(--huddle-ink);
  border: 1px solid var(--huddle-gray-3);
  background: #fff;
}
body.huddle .btn-ghost:hover:not(:disabled) { border-color: var(--huddle-ink); }
body.huddle .btn-warning {
  color: var(--huddle-ink);
  background: #fff;
  border: 1px solid var(--huddle-gray-3);
}

body.huddle .huddle-console .visitor-sidebar-footer {
  display: flex;
  gap: 12px;
  padding: 16px 32px;
  border-top: 1px solid var(--huddle-gray-2);
  background: var(--huddle-gray-1);
}
body.huddle .huddle-console .visitor-sidebar-footer[style*="none"] { display: none; }
body.huddle .visitor-wrap-up-btn,
body.huddle .visitor-end-btn {
  flex: 0 0 auto;
  width: auto;
  padding: 10px 20px;
  border-radius: 2px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  box-shadow: none;
}
body.huddle .visitor-wrap-up-btn {
  background: var(--huddle-ink);
  color: #fff;
  border: 1px solid var(--huddle-ink);
}
body.huddle .visitor-wrap-up-btn:hover:not(:disabled) {
  background: var(--huddle-green-dark);
  border-color: var(--huddle-green-dark);
}
body.huddle .visitor-end-btn {
  background: #fff;
  color: var(--huddle-ink);
  border: 1px solid var(--huddle-gray-3);
}
body.huddle .visitor-end-btn:hover { border-color: var(--huddle-ink); background: #fff; }
body.huddle .btn-shortcut { display: none; }

/* ---------- Transcript (right) ---------- */

body.huddle .visitor-sidebar {
  background: var(--huddle-gray-1);
  backdrop-filter: none;
  border: 1px solid var(--huddle-gray-2);
  min-height: 0;
  height: min(560px, 100%);
  align-self: center;
}
body.huddle .visitor-sidebar-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--huddle-gray-2);
  background: #fff;
}
body.huddle .visitor-sidebar-header h1 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--huddle-gray-text);
}
body.huddle .transcript {
  padding: 20px 24px;
  gap: 14px;
}
body.huddle .transcript-entry {
  font-size: 15px;
  line-height: 1.55;
}
body.huddle .transcript-user { color: var(--huddle-gray-text); }
body.huddle .transcript-assistant { color: var(--huddle-ink); font-weight: 600; }
body.huddle .transcript-placeholder { color: var(--text-muted); font-size: 14px; }

/* ---------- Errors / toasts ---------- */

body.huddle .toast-container { top: calc(var(--huddle-header-h) + 12px); }
body.huddle .toast {
  border-radius: 2px;
  background: #fff;
  color: var(--huddle-ink);
  border: 1px solid var(--huddle-gray-3);
  border-left: 4px solid var(--huddle-ink);
  box-shadow: var(--shadow-md);
}
body.huddle .toast-success { border-left-color: var(--huddle-green); }
body.huddle .toast-error { border-left-color: var(--color-danger); }
body.huddle .toast-warn { border-left-color: var(--huddle-gray-text); }

body.huddle .visitor-error-overlay {
  position: static;
  background: none;
}
body.huddle .visitor-error-overlay p { color: var(--huddle-ink); font-size: 18px; }

/* ---------- Narrow screens ---------- */

@media (max-width: 900px) {
  body.huddle .visitor-layout {
    display: flex;
    flex-direction: column;
    height: auto;
    overflow: visible;
    padding: 24px 16px;
    gap: 24px;
  }
  body.huddle .huddle-stage { align-items: flex-start; }
  body.huddle .visitor-sidebar { min-height: 280px; }
  .huddle-header__inner { padding: 0 16px; gap: 14px; }
  .huddle-brand { font-size: 22px; }
  body.huddle .visitor-sidebar { height: auto; align-self: stretch; }
  body.huddle .visitor-controls { padding: 20px; column-gap: 16px; }
  body.huddle .visitor-controls .state-label { font-size: 18px; }
  body.huddle .visitor-controls .voice-indicator { width: 72px; height: 72px; }
  body.huddle .visitor-controls .voice-indicator-icon { width: 46px; height: 46px; }
  body.huddle .huddle-console .visitor-sidebar-footer { padding: 12px 20px; }
}
