/* ==============================================================================
   style.css - Mobile-First Material 3 & Huxe-Inspired Audio Player Design
   Tailored specifically for Google Pixel 9 Pro (412px viewport, dark-mode first)
   ============================================================================== */

:root {
  /* Material 3 Dark Palette (Deep Obsidian / Google Dark) */
  --bg-app: #0c0e14;
  --surface-0: #10131a;
  --surface-1: #161922;
  --surface-2: #1d222e;
  --surface-3: #252b3a;
  --surface-variant: #2f3647;

  /* Material 3 Dynamic Primary & Accents */
  --primary: #8ab4f8;
  --primary-glow: rgba(138, 180, 248, 0.25);
  --primary-container: #173456;
  --on-primary: #041a35;
  --on-primary-container: #d3e3fd;

  --accent-amber: #fdd663;
  --accent-amber-glow: rgba(253, 214, 99, 0.2);
  --accent-teal: #80cbc4;
  --accent-teal-container: #1b3d39;
  --accent-purple: #c58af9;
  --accent-purple-container: #37234c;
  --accent-sky: #78d9ec;
  --accent-sky-container: #163640;

  /* Typography Colors */
  --text-high: #f1f3f4;
  --text-med: #bdc1c6;
  --text-low: #80868b;
  --text-inverse: #0c0e14;

  /* Borders & Dividers */
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-active: rgba(138, 180, 248, 0.45);
  --border-focus: #8ab4f8;

  /* Layout & Insets (Pixel 9 Pro) */
  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 24px;
  --radius-pill: 9999px;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  /* Touch Target */
  --touch-target-min: 48px;
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 280ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base Reset & Box Sizing */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  background-color: var(--bg-app);
  color: var(--text-high);
  font-family: 'Google Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: -0.01em;
  overflow-x: hidden;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

/* App Outer Container */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
  background-color: var(--bg-app);
  max-width: 480px; /* Center comfortably on wider viewports while targeting Pixel 9 Pro 412px */
  margin: 0 auto;
}

/* ==============================================================================
   Top Header
   ============================================================================== */
.top-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(16, 19, 26, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  padding: calc(var(--safe-top) + 12px) 18px 12px 18px;
  transition: background var(--transition-fast);
}

.header-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary);
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #34d399;
  box-shadow: 0 0 8px #34d399;
  animation: pulse-dot 2s infinite ease-in-out;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.briefing-date {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-high);
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Icon Buttons */
.icon-btn {
  width: var(--touch-target-min);
  height: var(--touch-target-min);
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background: var(--surface-1);
  color: var(--text-high);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast);
}

.icon-btn:active {
  transform: scale(0.92);
  background: var(--surface-2);
}

.refresh-icon.spinning {
  animation: spin-refresh 0.9s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes spin-refresh {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.header-sub-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  gap: 10px;
}

.weather-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-high);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.weather-pill:active {
  background: var(--surface-3);
  border-color: var(--primary);
  transform: scale(0.97);
}

.weather-icon {
  font-size: 16px;
}

.sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-low);
  font-weight: 500;
}

.refresh-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--primary-container);
  color: var(--on-primary-container);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  margin-top: 10px;
  font-size: 12px;
  font-weight: 500;
  animation: fade-in 200ms ease;
}

.spinner-small {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(211, 227, 253, 0.3);
  border-top-color: var(--on-primary-container);
  border-radius: 50%;
  animation: spin-refresh 0.8s linear infinite;
  flex-shrink: 0;
}

/* ==============================================================================
   Main Content Stream
   ============================================================================== */
.main-content {
  flex: 1;
  padding: 16px 18px 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Install Banner */
.install-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: linear-gradient(135deg, #173456 0%, #1d2538 100%);
  border: 1px solid rgba(138, 180, 248, 0.35);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.install-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.install-info strong {
  font-size: 13px;
  color: var(--text-high);
}

.install-info span {
  font-size: 11px;
  color: var(--text-med);
  line-height: 1.3;
}

.btn-install {
  background: var(--primary);
  color: var(--on-primary);
  border: none;
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.btn-close-subtle {
  background: transparent;
  border: none;
  color: var(--text-low);
  font-size: 14px;
  cursor: pointer;
  padding: 4px;
}

/* Connection Alert */
.connection-alert {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #3e221d;
  border: 1px solid rgba(242, 139, 130, 0.4);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

.alert-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  font-size: 12px;
  color: #fce8e6;
}

.btn-alert-action {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-pill);
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

/* Stats Chip Row */
.stats-chip-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.stat-chip {
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-low);
}

.stat-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-high);
}

/* ==============================================================================
   Briefing Sections & Cards
   ============================================================================== */
.briefing-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 4px;
}

.section-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-icon {
  font-size: 18px;
}

.section-header h2 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-high);
  letter-spacing: -0.01em;
}

.section-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-amber {
  background: var(--accent-amber-glow);
  color: var(--accent-amber);
  border: 1px solid rgba(253, 214, 99, 0.3);
}

.badge-blue {
  background: var(--primary-glow);
  color: var(--primary);
  border: 1px solid rgba(138, 180, 248, 0.3);
}

.badge-purple {
  background: rgba(197, 138, 249, 0.18);
  color: var(--accent-purple);
  border: 1px solid rgba(197, 138, 249, 0.3);
}

.badge-teal {
  background: rgba(128, 203, 196, 0.18);
  color: var(--accent-teal);
  border: 1px solid rgba(128, 203, 196, 0.3);
}

.badge-sky {
  background: rgba(120, 217, 236, 0.18);
  color: var(--accent-sky);
  border: 1px solid rgba(120, 217, 236, 0.3);
}

.cards-stream {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Individual Content Card */
.content-card {
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
  cursor: pointer;
  user-select: text;
}

.content-card:hover {
  border-color: rgba(138, 180, 248, 0.25);
}

.content-card:active {
  transform: scale(0.985);
}

/* Active Highlight when Audio is playing this section */
.content-card.is-active-section {
  border-color: var(--primary);
  background: linear-gradient(145deg, var(--surface-2) 0%, var(--surface-1) 100%);
  box-shadow: 0 0 20px rgba(138, 180, 248, 0.15), inset 0 0 0 1px rgba(138, 180, 248, 0.3);
}

.content-card.is-active-section::before {
  content: '';
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 4px;
  background: var(--primary);
  border-radius: 0 4px 4px 0;
  box-shadow: 0 0 10px var(--primary);
}

.card-top-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.card-title {
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--text-high);
  line-height: 1.35;
}

.card-source-tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-med);
  background: var(--surface-2);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.card-summary {
  font-size: 0.9rem;
  color: var(--text-med);
  line-height: 1.45;
}

.card-bottom-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.btn-jump-audio {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-jump-audio:active {
  background: var(--primary-container);
  color: var(--on-primary-container);
  transform: scale(0.94);
}

.card-action-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-med);
  text-decoration: none;
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  transition: color var(--transition-fast);
}

.card-action-link:hover, .card-action-link:active {
  color: var(--primary);
}

/* Action Items Card */
.actions-card {
  background: var(--surface-1);
  border: 1px solid rgba(253, 214, 99, 0.2);
  border-radius: var(--radius-md);
  padding: 14px;
}

.action-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.action-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  padding: 6px 4px;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.action-item:active {
  background: rgba(255, 255, 255, 0.03);
}

.action-checkbox {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.custom-checkbox {
  width: 22px;
  height: 22px;
  border: 2px solid var(--text-low);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
  transition: all var(--transition-fast);
}

.action-checkbox:checked + .custom-checkbox {
  background: var(--accent-amber);
  border-color: var(--accent-amber);
}

.action-checkbox:checked + .custom-checkbox::after {
  content: '✓';
  font-size: 13px;
  font-weight: bold;
  color: #0c0e14;
}

.action-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.action-body strong {
  font-size: 13px;
  color: var(--text-high);
  font-weight: 600;
  transition: all var(--transition-fast);
}

.action-body p {
  font-size: 12px;
  color: var(--text-med);
  line-height: 1.35;
  transition: all var(--transition-fast);
}

.action-checkbox:checked ~ .action-body strong,
.action-checkbox:checked ~ .action-body p {
  text-decoration: line-through;
  color: var(--text-low);
  opacity: 0.7;
}

/* Full Transcript Card */
.transcript-card {
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: max-height 300ms ease, opacity 200ms ease;
  user-select: text;
}

.transcript-card.collapsed .transcript-body {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  position: relative;
}

.transcript-card.collapsed .transcript-body::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40px;
  background: linear-gradient(to bottom, transparent, var(--surface-1));
}

.transcript-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.transcript-chip {
  font-size: 11px;
  background: var(--surface-2);
  color: var(--text-low);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}

.transcript-body {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-med);
}

.transcript-body p {
  margin-bottom: 12px;
}

.transcript-body p:last-child {
  margin-bottom: 0;
}

.pill-btn-subtle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  color: var(--text-med);
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-pill);
  padding: 4px 10px;
  cursor: pointer;
}

.chevron-icon {
  transition: transform 200ms ease;
}

.transcript-card:not(.collapsed) ~ .section-header .chevron-icon,
.transcript-expanded .chevron-icon {
  transform: rotate(180deg);
}

/* Bottom Spacer to prevent player overlap */
.bottom-player-spacer {
  height: calc(130px + var(--safe-bottom));
  width: 100%;
}

/* ==============================================================================
   Persistent Bottom Audio Player (Huxe-Inspired)
   ============================================================================== */
.bottom-audio-player {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  z-index: 50;
  background: rgba(20, 23, 32, 0.94);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.55);
  padding: 12px 18px calc(var(--safe-bottom) + 12px) 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Track Info Row */
.player-info-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.track-art {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #173456 0%, #2f3647 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-subtle);
  flex-shrink: 0;
  overflow: hidden;
}

/* Wave Animation inside mini art */
.wave-animation {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 20px;
}

.wave-animation .bar {
  width: 3px;
  background: var(--primary);
  border-radius: 2px;
  height: 6px;
  transition: height 150ms ease;
}

.bottom-audio-player.is-playing .wave-animation .bar-1 {
  animation: bounce-wave 0.8s ease-in-out infinite alternate;
}
.bottom-audio-player.is-playing .wave-animation .bar-2 {
  animation: bounce-wave 0.6s ease-in-out infinite 0.2s alternate;
}
.bottom-audio-player.is-playing .wave-animation .bar-3 {
  animation: bounce-wave 0.9s ease-in-out infinite 0.4s alternate;
}
.bottom-audio-player.is-playing .wave-animation .bar-4 {
  animation: bounce-wave 0.7s ease-in-out infinite 0.1s alternate;
}

@keyframes bounce-wave {
  0% { height: 4px; }
  100% { height: 18px; }
}

.track-details {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.track-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.track-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-high);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-status-pill {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--primary);
  letter-spacing: 0.04em;
}

.track-subtopic {
  font-size: 12px;
  color: var(--text-med);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.icon-btn-subtle {
  background: transparent;
  border: none;
  color: var(--text-med);
  padding: 8px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.icon-btn-subtle:active {
  color: var(--primary);
  background: var(--surface-2);
}

/* Scrubber Row */
.player-scrubber-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.time-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-med);
  font-variant-numeric: tabular-nums;
  min-width: 34px;
}

#durationLabel {
  text-align: right;
}

.scrubber-bar-wrapper {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  height: 24px;
  cursor: pointer;
}

.scrubber-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
  outline: none;
  position: relative;
  z-index: 2;
  margin: 0;
}

.scrubber-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid var(--primary);
  box-shadow: 0 0 6px rgba(138, 180, 248, 0.6);
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.scrubber-slider:active::-webkit-slider-thumb {
  transform: scale(1.35);
  background: var(--primary);
}

.scrubber-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid var(--primary);
  cursor: pointer;
}

.scrubber-fill {
  position: absolute;
  left: 0;
  height: 4px;
  background: linear-gradient(to right, #669df6, #a8c7fa);
  border-radius: 2px;
  pointer-events: none;
  width: 0%;
  z-index: 1;
}

/* Controls Row */
.player-controls-row {
  display: flex;
  align-items: center;
  justify-content: space-evenly;
  padding: 2px 8px;
}

.control-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--text-high);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform var(--transition-fast), color var(--transition-fast);
}

.control-btn:active {
  transform: scale(0.88);
  color: var(--primary);
}

/* Big Play/Pause FAB */
.play-pause-fab {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, #a8c7fa 0%, #669df6 100%);
  color: #041a35;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(102, 157, 246, 0.4);
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  position: relative;
}

.play-pause-fab:active {
  transform: scale(0.92);
  box-shadow: 0 2px 8px rgba(102, 157, 246, 0.6);
}

.fab-icon {
  fill: #041a35;
}

.fab-spinner {
  width: 26px;
  height: 26px;
  border: 3px solid rgba(4, 26, 53, 0.25);
  border-top-color: #041a35;
  border-radius: 50%;
  animation: spin-refresh 0.75s linear infinite;
}

/* Playback Speed Pill Button */
.speed-pill-btn {
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  padding: 6px 12px;
  color: var(--text-high);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  min-width: 46px;
  text-align: center;
  transition: all var(--transition-fast);
}

.speed-pill-btn:active {
  background: var(--primary-container);
  color: var(--primary);
  transform: scale(0.92);
}

/* ==============================================================================
   Settings Drawer & Modals
   ============================================================================== */
.drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  justify-content: flex-end;
  animation: fade-in 180ms ease;
}

.settings-drawer {
  width: 100%;
  max-width: 390px;
  height: 100%;
  background: var(--surface-0);
  border-left: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  padding: calc(var(--safe-top) + 16px) 20px calc(var(--safe-bottom) + 20px) 20px;
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
  animation: slide-in-right 240ms cubic-bezier(0.2, 0.9, 0.3, 1);
  overflow-y: auto;
}

@keyframes slide-in-right {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.drawer-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--primary);
}

.drawer-title-wrap h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-high);
}

.drawer-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding-top: 18px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-med);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-input {
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 14px;
  color: var(--text-high);
  outline: none;
  transition: border-color var(--transition-fast);
  font-family: inherit;
}

.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(138, 180, 248, 0.25);
}

.input-with-button {
  display: flex;
  gap: 6px;
}

.input-with-button .form-input {
  flex: 1;
}

.btn-input-addon {
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  color: var(--text-high);
  font-size: 14px;
  cursor: pointer;
}

.field-hint {
  font-size: 11px;
  color: var(--text-low);
  line-height: 1.35;
}

.checkbox-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-med);
  cursor: pointer;
}

.toggle-row input {
  accent-color: var(--primary);
  width: 18px;
  height: 18px;
}

.test-connection-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: var(--surface-1);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  color: var(--text-high);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.btn-secondary:active {
  background: var(--surface-3);
}

.test-result-badge {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: var(--radius-xs);
  text-align: center;
  font-weight: 500;
}

.test-result-badge.success {
  background: rgba(52, 211, 153, 0.15);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.3);
}

.test-result-badge.error {
  background: rgba(248, 113, 113, 0.15);
  color: #f87171;
  border: 1px solid rgba(248, 113, 113, 0.3);
}

.info-card {
  background: var(--surface-1);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.info-card h4 {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
}

.info-card p {
  font-size: 11px;
  color: var(--text-low);
  line-height: 1.4;
}

.drawer-footer {
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}

.btn-primary {
  width: 100%;
  background: var(--primary);
  color: var(--on-primary);
  border: none;
  border-radius: var(--radius-pill);
  padding: 14px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform var(--transition-fast), filter var(--transition-fast);
}

.btn-primary:active {
  transform: scale(0.97);
  filter: brightness(0.9);
}

/* ==============================================================================
   Toast Notifications
   ============================================================================== */
.toast-container {
  position: fixed;
  bottom: calc(150px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: 90%;
  max-width: 360px;
}

.toast {
  background: var(--surface-3);
  color: var(--text-high);
  border: 1px solid var(--border-subtle);
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  animation: toast-pop 200ms cubic-bezier(0.2, 0.9, 0.3, 1);
}

@keyframes toast-pop {
  from { opacity: 0; transform: translateY(10px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.hidden {
  display: none !important;
}
