/* Jaga Voice Agent — accessible, responsive kiosk UI */

html[data-jaga-voice-kiosk="true"] {
  --jaga-mic-size: clamp(160px, 38vmin, 300px);
  --jaga-mic-border: clamp(5px, 1.2vw, 8px);
  --jaga-mic-blue: #0066cc;
  --jaga-mic-blue-active: #004999;
  --jaga-text-size: clamp(1rem, 2.6vw, 1.375rem);
  --jaga-status-size: clamp(1.0625rem, 2.8vw, 1.625rem);
  --jaga-title-size: clamp(1.375rem, 4.5vw, 2.125rem);
  --jaga-subtitle-size: clamp(0.9375rem, 2.4vw, 1.1875rem);
  --jaga-page-pad-x: clamp(0.75rem, 3vw, 1.5rem);
  --jaga-composer-pad-y: clamp(1rem, 3vh, 2rem);
  --jaga-safe-top: env(safe-area-inset-top, 0px);
  --jaga-safe-bottom: env(safe-area-inset-bottom, 0px);
  --jaga-safe-left: env(safe-area-inset-left, 0px);
  --jaga-safe-right: env(safe-area-inset-right, 0px);
}

html[data-jaga-voice-kiosk="true"],
html[data-jaga-voice-kiosk="true"] body {
  height: 100%;
  overflow: hidden;
}

html[data-jaga-voice-kiosk="true"] body {
  background: #0a1628;
  color: #ffffff;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

#jaga-voice-header {
  box-sizing: border-box;
  text-align: center;
  background: linear-gradient(180deg, #0d2240 0%, #0a1628 100%);
  border-bottom: 3px solid #0066cc;
  padding: clamp(0.75rem, 2.5vh, 1.25rem) var(--jaga-page-pad-x)
    clamp(0.5rem, 1.5vh, 0.75rem);
}

#jaga-voice-header h1 {
  margin: 0;
  font-size: var(--jaga-title-size);
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #ffffff;
}

#jaga-voice-header p {
  margin: clamp(0.375rem, 1vh, 0.625rem) 0 0;
  font-size: var(--jaga-subtitle-size);
  font-weight: 600;
  color: #b8d4f0;
}

html[data-jaga-voice-kiosk="true"] openclaw-app {
  display: block !important;
  flex: 1 1 auto;
  min-height: 0;
}

/* Hide navigation chrome — voice-only experience */
html[data-jaga-voice-kiosk="true"] .shell-nav,
html[data-jaga-voice-kiosk="true"] .shell-nav-backdrop,
html[data-jaga-voice-kiosk="true"] openclaw-app-topbar,
html[data-jaga-voice-kiosk="true"] openclaw-command-palette,
html[data-jaga-voice-kiosk="true"] .chat-controls,
html[data-jaga-voice-kiosk="true"] .agent-chat__composer-combobox,
html[data-jaga-voice-kiosk="true"] .agent-chat__attach-menu,
html[data-jaga-voice-kiosk="true"] .agent-chat__talk-input-setting,
html[data-jaga-voice-kiosk="true"] .chat-send-btn:not(.chat-send-btn--voice):not(.chat-send-btn--stop),
html[data-jaga-voice-kiosk="true"] .agent-chat__control-label {
  display: none !important;
}

html[data-jaga-voice-kiosk="true"] .shell {
  --shell-nav-width: 0px !important;
  --shell-topbar-height: 0px !important;
  height: 100% !important;
  min-height: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  grid-template-columns: 1fr !important;
  grid-template-rows: 1fr !important;
}

html[data-jaga-voice-kiosk="true"] .content,
html[data-jaga-voice-kiosk="true"] .content--chat {
  box-sizing: border-box !important;
  flex: 1 1 auto !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  max-width: 100% !important;
  width: 100% !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
}

/* Chat layout: transcript above, mic below */
html[data-jaga-voice-kiosk="true"] openclaw-router-outlet,
html[data-jaga-voice-kiosk="true"] openclaw-chat-page,
html[data-jaga-voice-kiosk="true"] openclaw-chat-pane,
html[data-jaga-voice-kiosk="true"] .agent-chat {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  height: 100% !important;
  width: 100% !important;
  max-width: 960px !important;
  margin-inline: auto !important;
}

html[data-jaga-voice-kiosk="true"] .agent-chat__main,
html[data-jaga-voice-kiosk="true"] .agent-chat__body {
  display: flex !important;
  flex-direction: column !important;
  height: 100% !important;
  min-height: 0 !important;
}

html[data-jaga-voice-kiosk="true"] .chat-thread,
html[data-jaga-voice-kiosk="true"] .chat-thread-inner {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  font-size: var(--jaga-text-size) !important;
  line-height: 1.65 !important;
  padding: clamp(0.75rem, 2vh, 1.25rem) var(--jaga-page-pad-x) !important;
  scroll-padding-bottom: 1rem;
}

html[data-jaga-voice-kiosk="true"] .msg-bubble,
html[data-jaga-voice-kiosk="true"] .msg-content {
  font-size: var(--jaga-text-size) !important;
  line-height: 1.65 !important;
  word-break: break-word;
  overflow-wrap: anywhere;
}

html[data-jaga-voice-kiosk="true"] .agent-chat__composer {
  flex-shrink: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  box-sizing: border-box !important;
  padding:
    clamp(0.75rem, 2vh, 1.25rem)
    var(--jaga-page-pad-x)
    calc(var(--jaga-composer-pad-y) + var(--jaga-safe-bottom)) !important;
  background: #0d2240 !important;
  border-top: 3px solid #0066cc !important;
  gap: clamp(0.625rem, 2vh, 1rem) !important;
}

/* Large high-contrast microphone button */
html[data-jaga-voice-kiosk="true"] .chat-send-btn--voice,
html[data-jaga-voice-kiosk="true"] .chat-send-btn--stop {
  width: var(--jaga-mic-size) !important;
  height: var(--jaga-mic-size) !important;
  min-width: 140px !important;
  min-height: 140px !important;
  max-width: min(300px, 72vw) !important;
  max-height: min(300px, 72vw) !important;
  border-radius: 50% !important;
  background: var(--jaga-mic-blue) !important;
  color: #ffffff !important;
  border: var(--jaga-mic-border) solid #ffffff !important;
  box-shadow:
    0 0 0 clamp(2px, 0.6vw, 4px) #0066cc,
    0 clamp(8px, 2vh, 12px) clamp(24px, 5vh, 40px) rgba(0, 102, 204, 0.55) !important;
  margin: 0 auto !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s ease, background 0.15s ease !important;
}

html[data-jaga-voice-kiosk="true"] .chat-send-btn--voice:hover,
html[data-jaga-voice-kiosk="true"] .chat-send-btn--voice:focus-visible {
  background: #0077ee !important;
  transform: scale(1.04) !important;
  outline: clamp(3px, 0.8vw, 4px) solid #ffcc00 !important;
  outline-offset: clamp(4px, 1vw, 6px) !important;
}

html[data-jaga-voice-kiosk="true"] .chat-send-btn--stop {
  background: #cc2200 !important;
  border-color: #ffffff !important;
  box-shadow:
    0 0 0 clamp(2px, 0.6vw, 4px) #cc2200,
    0 clamp(8px, 2vh, 12px) clamp(24px, 5vh, 40px) rgba(204, 34, 0, 0.45) !important;
}

html[data-jaga-voice-kiosk="true"] .chat-send-btn--voice svg,
html[data-jaga-voice-kiosk="true"] .chat-send-btn--stop svg {
  width: 40% !important;
  height: 40% !important;
  fill: #ffffff !important;
  stroke: #ffffff !important;
}

html[data-jaga-voice-kiosk="true"] .chat-send-btn--voice:disabled {
  background: #4a6080 !important;
  border-color: #8899aa !important;
  opacity: 1 !important;
  cursor: not-allowed !important;
}

/* Status text — large and readable */
html[data-jaga-voice-kiosk="true"] .agent-chat__talk-status,
html[data-jaga-voice-kiosk="true"] .agent-chat__stt-interim {
  box-sizing: border-box !important;
  font-size: var(--jaga-status-size) !important;
  font-weight: 700 !important;
  text-align: center !important;
  color: #ffffff !important;
  background: #1a3a5c !important;
  border: 2px solid #0066cc !important;
  border-radius: clamp(8px, 2vw, 12px) !important;
  padding: clamp(0.625rem, 2vh, 1rem) clamp(0.75rem, 3vw, 1.25rem) !important;
  margin: 0 var(--jaga-page-pad-x) !important;
  width: calc(100% - (2 * var(--jaga-page-pad-x))) !important;
  max-width: 720px !important;
}

html[data-jaga-voice-kiosk="true"] .agent-chat__talk-status-text {
  font-size: inherit !important;
  font-weight: inherit !important;
}

/* Connection banner — larger text */
html[data-jaga-voice-kiosk="true"] openclaw-connection-banner,
html[data-jaga-voice-kiosk="true"] openclaw-login-gate {
  font-size: clamp(1rem, 2.5vw, 1.125rem) !important;
  padding-inline: var(--jaga-page-pad-x) !important;
}

/* ── Small phones (portrait) ── */
@media (max-width: 480px) {
  html[data-jaga-voice-kiosk="true"] {
    --jaga-mic-size: clamp(140px, 52vw, 220px);
    --jaga-text-size: clamp(0.9375rem, 4.2vw, 1.125rem);
  }

  #jaga-voice-header {
    padding-top: calc(clamp(0.625rem, 2vh, 0.875rem) + var(--jaga-safe-top));
  }
}

/* ── Very small screens ── */
@media (max-width: 360px) {
  html[data-jaga-voice-kiosk="true"] {
    --jaga-mic-size: clamp(128px, 48vw, 180px);
  }

  html[data-jaga-voice-kiosk="true"] .chat-send-btn--voice,
  html[data-jaga-voice-kiosk="true"] .chat-send-btn--stop {
    min-width: 120px !important;
    min-height: 120px !important;
  }
}

/* ── Landscape phones / short viewports ── */
@media (max-height: 520px) and (orientation: landscape) {
  html[data-jaga-voice-kiosk="true"] {
    --jaga-mic-size: clamp(96px, 24vh, 140px);
    --jaga-title-size: clamp(1.125rem, 4vh, 1.5rem);
    --jaga-subtitle-size: clamp(0.8125rem, 2.5vh, 1rem);
  }

  #jaga-voice-header {
    padding-block: 0.5rem;
    border-bottom-width: 2px;
  }

  #jaga-voice-header p {
    display: none;
  }

  html[data-jaga-voice-kiosk="true"] .agent-chat__main,
  html[data-jaga-voice-kiosk="true"] .agent-chat__body {
    flex-direction: row !important;
    align-items: stretch !important;
  }

  html[data-jaga-voice-kiosk="true"] .chat-thread,
  html[data-jaga-voice-kiosk="true"] .chat-thread-inner {
    flex: 1 1 55% !important;
    border-right: 2px solid #1a3a5c;
  }

  html[data-jaga-voice-kiosk="true"] .agent-chat__composer {
    flex: 0 0 clamp(180px, 38vw, 260px) !important;
    border-top: none !important;
    border-left: 3px solid #0066cc !important;
    justify-content: center !important;
    padding-block: 0.75rem !important;
  }

  html[data-jaga-voice-kiosk="true"] .chat-send-btn--voice,
  html[data-jaga-voice-kiosk="true"] .chat-send-btn--stop {
    min-width: 96px !important;
    min-height: 96px !important;
    max-width: min(140px, 28vh) !important;
    max-height: min(140px, 28vh) !important;
  }

  html[data-jaga-voice-kiosk="true"] .agent-chat__talk-status,
  html[data-jaga-voice-kiosk="true"] .agent-chat__stt-interim {
    margin-bottom: 0.5rem !important;
  }
}

/* ── Tablets ── */
@media (min-width: 768px) and (max-width: 1024px) {
  html[data-jaga-voice-kiosk="true"] {
    --jaga-mic-size: clamp(200px, 32vmin, 260px);
    --jaga-text-size: clamp(1.0625rem, 2vw, 1.25rem);
  }

  html[data-jaga-voice-kiosk="true"] openclaw-chat-page,
  html[data-jaga-voice-kiosk="true"] openclaw-chat-pane,
  html[data-jaga-voice-kiosk="true"] .agent-chat {
    max-width: 840px !important;
  }
}

/* ── Large desktop ── */
@media (min-width: 1200px) {
  html[data-jaga-voice-kiosk="true"] {
    --jaga-mic-size: 280px;
    --jaga-text-size: 1.375rem;
  }

  html[data-jaga-voice-kiosk="true"] openclaw-chat-page,
  html[data-jaga-voice-kiosk="true"] openclaw-chat-pane,
  html[data-jaga-voice-kiosk="true"] .agent-chat {
    max-width: 960px !important;
  }

  html[data-jaga-voice-kiosk="true"] .chat-thread,
  html[data-jaga-voice-kiosk="true"] .chat-thread-inner {
    padding-inline: 2rem !important;
  }
}

/* ── Coarse pointer (touch devices) ── */
@media (hover: none) and (pointer: coarse) {
  html[data-jaga-voice-kiosk="true"] .chat-send-btn--voice:active,
  html[data-jaga-voice-kiosk="true"] .chat-send-btn--stop:active {
    transform: scale(0.97) !important;
    background: var(--jaga-mic-blue-active) !important;
  }

  html[data-jaga-voice-kiosk="true"] .chat-send-btn--voice:hover {
    transform: none !important;
  }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  html[data-jaga-voice-kiosk="true"] .chat-send-btn--voice,
  html[data-jaga-voice-kiosk="true"] .chat-send-btn--stop {
    transition: none !important;
  }

  html[data-jaga-voice-kiosk="true"] .chat-send-btn--voice:hover,
  html[data-jaga-voice-kiosk="true"] .chat-send-btn--voice:focus-visible {
    transform: none !important;
  }
}
