/* ===============================================
   Nnubia AI — Movies Copilot Styles
   Uses the movies page CSS variables for theme parity.
   Inherits --primary-bg, --text-primary, --text-secondary,
   --accent-red from movies-new.css root.
   =============================================== */

/* Day mode defaults */
.movies-page-wrapper,
.mv-ai-drawer,
.mv-ai-overlay,
.mv-ai-notif-panel {
  --mv-ai-bg: var(--primary-bg, #ffffff);
  --mv-ai-surface: rgba(0,0,0,0.03);
  --mv-ai-surface2: rgba(0,0,0,0.06);
  --mv-ai-border: rgba(0,0,0,0.1);
  --mv-ai-text: var(--text-primary, #1a1a1a);
  --mv-ai-text-dim: var(--text-secondary, #555);
  --mv-ai-accent: var(--accent-red, #e50914);
  --mv-ai-accent-glow: rgba(15,23,42,0.08);
  --mv-ai-radius: 12px;
  --mv-ai-drawer-shell: linear-gradient(180deg, #ffffff 0%, #f4f4f5 100%);
  --mv-ai-drawer-body-bg: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(248,250,252,0.96) 100%);
  --mv-ai-drawer-chrome-bg: linear-gradient(180deg, rgba(255,255,255,0.96) 0%, rgba(244,244,245,0.93) 100%);
  --mv-ai-drawer-shadow: -18px 0 42px rgba(15, 23, 42, 0.16), -1px 0 0 rgba(229, 9, 20, 0.08);
  --mv-ai-drawer-highlight: inset 1px 0 0 rgba(255,255,255,0.8), inset 0 1px 0 rgba(255,255,255,0.58);
  --mv-ai-drawer-glow: radial-gradient(circle at top right, rgba(229, 9, 20, 0.1) 0%, rgba(229, 9, 20, 0.03) 24%, rgba(255,255,255,0) 54%);
  --mv-ai-panel-bg: rgba(255,255,255,0.98);
  --mv-ai-user-bg: rgba(229,9,20,0.06);
  --mv-ai-bot-msg-bg: linear-gradient(180deg, rgba(255,255,255,0.92) 0%, rgba(248,250,252,0.98) 100%);
  --mv-ai-bot-msg-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
  --mv-ai-user-msg-bg: linear-gradient(135deg, #e50914 0%, #b91c1c 100%);
  --mv-ai-user-msg-shadow: 0 12px 26px rgba(229, 9, 20, 0.22);
  --mv-ai-source-card-bg: rgba(255,255,255,0.92);
  --mv-ai-source-card-hover-bg: rgba(255,245,245,0.98);
  --mv-ai-toolbar-icon: rgba(220, 38, 38, 0.45);
  --mv-ai-toolbar-icon-focus: rgba(220, 38, 38, 0.72);
  --mv-ai-toolbar-icon-shadow: 0 0 3px rgba(220, 38, 38, 0.22);
  --mv-ai-toolbar-icon-shadow-focus: 0 0 5px rgba(220, 38, 38, 0.28);
  --mv-ai-toolbar-input-color: rgba(26, 26, 26, 0.9);
  --mv-ai-toolbar-input-bg: rgba(220, 38, 38, 0.03);
  --mv-ai-toolbar-input-border: rgba(220, 38, 38, 0.25);
  --mv-ai-toolbar-input-shadow: 0 0 4px rgba(220, 38, 38, 0.12), 0 0 8px rgba(220, 38, 38, 0.06), inset 0 0 4px rgba(220, 38, 38, 0.04);
  --mv-ai-toolbar-input-focus-border: rgba(220, 38, 38, 0.48);
  --mv-ai-toolbar-input-focus-bg: rgba(220, 38, 38, 0.05);
  --mv-ai-toolbar-input-focus-shadow: 0 0 8px rgba(220, 38, 38, 0.18), 0 0 18px rgba(220, 38, 38, 0.1), inset 0 0 8px rgba(220, 38, 38, 0.05);
  --mv-ai-toolbar-placeholder: rgba(220, 38, 38, 0.38);
  --mv-ai-toolbar-placeholder-shadow: none;
  --mv-ai-toolbar-clear-bg: rgba(0, 0, 0, 0.06);
  --mv-ai-toolbar-clear-bg-hover: rgba(0, 0, 0, 0.1);
  --mv-ai-toolbar-action-bg: transparent;
  --mv-ai-toolbar-action-color: #71717a;
  --mv-ai-toolbar-action-hover-bg: #f4f4f5;
  --mv-ai-toolbar-action-hover-color: #111827;
  --mv-ai-toolbar-bell-color: #b91c1c;
  --mv-ai-toolbar-bell-color-hover: #991b1b;
  --mv-ai-toolbar-bell-shadow: 0 4px 10px rgba(15, 23, 42, 0.12);
  --mv-ai-toolbar-bell-shadow-hover: 0 6px 14px rgba(15, 23, 42, 0.18);
  --mv-voice-overlay: rgba(15, 23, 42, 0.36);
  --mv-voice-panel-bg: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(244,244,245,0.96) 100%);
  --mv-voice-panel-shadow: 0 28px 64px -18px rgba(15, 23, 42, 0.35);
  --mv-voice-transcript-bg: rgba(15, 23, 42, 0.045);
  --mv-voice-response-bg: rgba(229, 9, 20, 0.08);
  --mv-voice-response-border: rgba(229, 9, 20, 0.18);
  --mv-voice-chip-bg: rgba(255,255,255,0.72);
  --mv-voice-chip-hover-bg: rgba(229, 9, 20, 0.08);
}

/* Dark mode overrides */
body.theme-dark .movies-page-wrapper,
body.theme-dark .mv-ai-drawer,
body.theme-dark .mv-ai-overlay,
body.theme-dark .mv-ai-notif-panel,
body.theme-dark [data-mv-theme="night"],
body.night_mode_body .movies-page-wrapper,
body.night_mode_body .mv-ai-drawer,
body.night_mode_body .mv-ai-overlay,
body.night_mode_body .mv-ai-notif-panel,
body.night_mode_body [data-mv-theme="night"],
.night_mode .movies-page-wrapper,
.night_mode .mv-ai-drawer,
.night_mode .mv-ai-overlay,
.night_mode .mv-ai-notif-panel,
[data-mv-theme="night"] {
  --mv-ai-bg: var(--primary-bg, #121212);
  --mv-ai-surface: rgba(255,255,255,0.04);
  --mv-ai-surface2: rgba(255,255,255,0.07);
  --mv-ai-border: rgba(255,255,255,0.08);
  --mv-ai-text: rgba(255,255,255,0.88);
  --mv-ai-text-dim: rgba(255,255,255,0.6);
  --mv-ai-accent-glow: rgba(220,38,38,0.18);
  --mv-ai-drawer-shell: linear-gradient(180deg, #171717 0%, #0f0f10 100%);
  --mv-ai-drawer-body-bg: linear-gradient(180deg, rgba(18,18,18,0.98) 0%, rgba(11,11,12,0.99) 100%);
  --mv-ai-drawer-chrome-bg: linear-gradient(180deg, rgba(26,26,27,0.96) 0%, rgba(16,16,17,0.94) 100%);
  --mv-ai-drawer-shadow: -18px 0 44px rgba(0, 0, 0, 0.54), -1px 0 0 rgba(229, 9, 20, 0.16);
  --mv-ai-drawer-highlight: inset 1px 0 0 rgba(255,255,255,0.06), inset 0 1px 0 rgba(255,255,255,0.03);
  --mv-ai-drawer-glow: radial-gradient(circle at top right, rgba(229, 9, 20, 0.18) 0%, rgba(229, 9, 20, 0.08) 26%, rgba(0,0,0,0) 58%);
  --mv-ai-panel-bg: rgba(18,18,18,0.98);
  --mv-ai-user-bg: rgba(229,9,20,0.12);
  --mv-ai-bot-msg-bg: linear-gradient(180deg, rgba(33,33,35,0.94) 0%, rgba(18,18,19,0.98) 100%);
  --mv-ai-bot-msg-shadow: 0 14px 28px rgba(0, 0, 0, 0.28);
  --mv-ai-user-msg-bg: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
  --mv-ai-user-msg-shadow: 0 14px 30px rgba(127, 29, 29, 0.36);
  --mv-ai-source-card-bg: rgba(27,27,29,0.94);
  --mv-ai-source-card-hover-bg: rgba(40,40,43,0.98);
  --mv-ai-toolbar-icon: rgba(220, 38, 38, 0.45);
  --mv-ai-toolbar-icon-focus: rgba(220, 38, 38, 0.8);
  --mv-ai-toolbar-icon-shadow: 0 0 3px rgba(220, 38, 38, 0.3);
  --mv-ai-toolbar-icon-shadow-focus: 0 0 6px rgba(220, 38, 38, 0.6);
  --mv-ai-toolbar-input-color: rgba(255, 255, 255, 0.85);
  --mv-ai-toolbar-input-bg: rgba(220, 38, 38, 0.03);
  --mv-ai-toolbar-input-border: rgba(220, 38, 38, 0.35);
  --mv-ai-toolbar-input-shadow: 0 0 5px rgba(220, 38, 38, 0.3), 0 0 10px rgba(220, 38, 38, 0.15), inset 0 0 6px rgba(220, 38, 38, 0.06);
  --mv-ai-toolbar-input-focus-border: rgba(220, 38, 38, 0.65);
  --mv-ai-toolbar-input-focus-bg: rgba(220, 38, 38, 0.05);
  --mv-ai-toolbar-input-focus-shadow: 0 0 10px rgba(220, 38, 38, 0.5), 0 0 25px rgba(220, 38, 38, 0.25), 0 0 50px rgba(220, 38, 38, 0.1), inset 0 0 10px rgba(220, 38, 38, 0.08);
  --mv-ai-toolbar-placeholder: rgba(220, 38, 38, 0.4);
  --mv-ai-toolbar-placeholder-shadow: 0 0 6px rgba(220, 38, 38, 0.15);
  --mv-ai-toolbar-clear-bg: rgba(255, 255, 255, 0.1);
  --mv-ai-toolbar-clear-bg-hover: rgba(255, 255, 255, 0.2);
  --mv-ai-toolbar-action-bg: rgba(12, 12, 12, 0.22);
  --mv-ai-toolbar-action-color: #a1a1aa;
  --mv-ai-toolbar-action-hover-bg: rgba(255, 255, 255, 0.08);
  --mv-ai-toolbar-action-hover-color: #ffffff;
  --mv-ai-toolbar-bell-color: #f87171;
  --mv-ai-toolbar-bell-color-hover: #fca5a5;
  --mv-ai-toolbar-bell-shadow: 0 4px 12px rgba(0, 0, 0, 0.34);
  --mv-ai-toolbar-bell-shadow-hover: 0 6px 16px rgba(0, 0, 0, 0.42);
  --mv-voice-overlay: rgba(2, 6, 23, 0.62);
  --mv-voice-panel-bg: linear-gradient(180deg, rgba(23,23,23,0.98) 0%, rgba(10,10,11,0.98) 100%);
  --mv-voice-panel-shadow: 0 28px 70px -20px rgba(0, 0, 0, 0.62);
  --mv-voice-transcript-bg: rgba(255,255,255,0.06);
  --mv-voice-response-bg: rgba(229, 9, 20, 0.12);
  --mv-voice-response-border: rgba(248, 113, 113, 0.26);
  --mv-voice-chip-bg: rgba(18,18,18,0.72);
  --mv-voice-chip-hover-bg: rgba(229, 9, 20, 0.14);
}

/* ── Unified Search + AI Header ─────────────────────────── */
.mv-ai-header-actions {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin: 10px auto 6px;
  padding: 0 12px;
}

.mv-ai-toolbar {
  position: relative;
  width: 100%;
  max-width: 430px;
  display: block;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  transition: none;
}

.mv-ai-toolbar:hover,
.mv-ai-toolbar:focus-within {
  border-color: transparent;
  box-shadow: none;
}

body.theme-light .mv-ai-toolbar {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

body.theme-light .mv-ai-toolbar:hover,
body.theme-light .mv-ai-toolbar:focus-within {
  border-color: transparent;
  box-shadow: none;
}

.mv-ai-toolbar .search-wrap {
  position: relative;
  width: 100%;
  min-width: 0;
  max-width: none;
  margin: 0;
  display: block;
  color: var(--mv-ai-text);
}

.mv-ai-toolbar .search-wrap .search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  flex-shrink: 0;
  color: var(--mv-ai-toolbar-icon);
  filter: drop-shadow(var(--mv-ai-toolbar-icon-shadow));
}

.mv-ai-toolbar .search-wrap input#search-movies {
  width: 100%;
  min-width: 0;
  padding: 10px 214px 10px 44px;
  border: 1px solid var(--mv-ai-toolbar-input-border);
  border-radius: 999px;
  background: var(--mv-ai-toolbar-input-bg);
  color: var(--mv-ai-toolbar-input-color);
  box-shadow: var(--mv-ai-toolbar-input-shadow);
  animation: neonPulse 3s ease-in-out infinite;
  outline: none;
}

.mv-ai-toolbar .search-wrap input#search-movies::placeholder {
  color: var(--mv-ai-toolbar-placeholder);
  text-shadow: var(--mv-ai-toolbar-placeholder-shadow);
}

.mv-ai-toolbar .search-wrap input#search-movies:focus {
  border-color: var(--mv-ai-toolbar-input-focus-border);
  background: var(--mv-ai-toolbar-input-focus-bg);
  box-shadow: var(--mv-ai-toolbar-input-focus-shadow);
  animation: none;
}

.mv-ai-toolbar .search-wrap:focus-within .search-icon {
  color: var(--mv-ai-toolbar-icon-focus);
  filter: drop-shadow(var(--mv-ai-toolbar-icon-shadow-focus));
}

.mv-ai-toolbar .search-clear-btn {
  right: 178px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--mv-ai-toolbar-clear-bg);
  color: inherit;
  opacity: 0.7;
}

.mv-ai-toolbar .search-clear-btn:hover,
.mv-ai-toolbar .search-clear-btn:active {
  background: var(--mv-ai-toolbar-clear-bg-hover);
  color: inherit;
}

.mv-ai-toolbar-actions {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  padding-left: 0;
  flex-shrink: 0;
  border-left: none;
  z-index: 4;
}

body.theme-light .mv-ai-toolbar-actions {
  border-left-color: transparent;
}

.mv-ai-toolbar-action {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 12px;
  border: none;
  border-radius: 999px;
  background: var(--mv-ai-toolbar-action-bg);
  color: var(--mv-ai-toolbar-action-color);
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  backdrop-filter: blur(6px);
}

.mv-ai-toolbar-action svg {
  display: block;
  flex-shrink: 0;
}

.mv-ai-toolbar-action:hover,
.mv-ai-toolbar-action:focus-visible {
  background: var(--mv-ai-toolbar-action-hover-bg);
  color: var(--mv-ai-toolbar-action-hover-color);
  outline: none;
}

body.theme-light .mv-ai-toolbar-action:not(.mv-ai-toolbar-action-primary) {
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

#mv-bellBtn {
  background: transparent;
  color: var(--mv-ai-toolbar-bell-color);
  box-shadow: none;
  backdrop-filter: none;
}

#mv-bellBtn:hover,
#mv-bellBtn:focus-visible {
  background: transparent;
  color: var(--mv-ai-toolbar-bell-color-hover);
  box-shadow: var(--mv-ai-toolbar-bell-shadow-hover);
}

.mv-ai-toolbar-action-primary {
  padding: 0 16px;
  background: var(--mv-ai-accent);
  color: #ffffff;
  box-shadow: 0 10px 22px rgba(229, 9, 20, 0.2), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.mv-ai-toolbar-action-primary:hover,
.mv-ai-toolbar-action-primary:focus-visible {
  background: #c8102e;
  color: #ffffff;
  box-shadow: 0 12px 26px rgba(229, 9, 20, 0.28);
}

body.theme-light .mv-ai-toolbar-action-primary {
  background: var(--mv-ai-accent);
  color: #ffffff;
  box-shadow: 0 10px 20px rgba(229, 9, 20, 0.16);
}

body.theme-light .mv-ai-toolbar-action-primary:hover,
body.theme-light .mv-ai-toolbar-action-primary:focus-visible {
  background: #c8102e;
  color: #ffffff;
  box-shadow: 0 12px 24px rgba(229, 9, 20, 0.2);
}

.mv-ai-toolbar-action-label {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.mv-ai-toolbar-action.is-listening {
  background: rgba(220, 38, 38, 0.14);
  color: #fca5a5;
  box-shadow: 0 0 0 1px rgba(220, 38, 38, 0.2);
}

body.theme-light .mv-ai-toolbar-action.is-listening {
  background: rgba(220, 38, 38, 0.08);
  color: #b91c1c;
  box-shadow: 0 0 0 1px rgba(220, 38, 38, 0.12);
}

.mv-ai-badge-dot {
  display: none !important;
}

@media (max-width: 680px) {
  .mv-voice-modal {
    align-items: flex-end;
    justify-content: center;
    padding: 12px;
  }

  .mv-voice-panel {
    width: min(100%, 430px);
    max-height: calc(100vh - 24px);
    padding: 20px 18px;
    border-radius: 22px;
  }

  .mv-ai-header-actions {
    margin-top: 8px;
    padding: 0 10px;
  }

  .mv-ai-toolbar {
    max-width: 340px;
  }

  .mv-ai-toolbar .search-wrap {
    max-width: none;
    flex-basis: auto;
  }

  .mv-ai-toolbar .search-wrap input#search-movies {
    padding-right: 132px;
  }

  .mv-ai-toolbar .search-clear-btn {
    right: 96px;
  }

  .mv-ai-toolbar-action {
    height: 38px;
  }

  .mv-ai-toolbar-action-primary {
    width: 38px;
    padding: 0;
  }

  .mv-ai-toolbar-action-label {
    display: none;
  }
}

@media (max-width: 560px) {
  .mv-voice-title strong {
    font-size: 16px;
  }

  .mv-voice-state-label,
  .mv-voice-text {
    font-size: 14px;
  }

  .mv-ai-toolbar {
    max-width: 260px;
  }

  .mv-ai-toolbar .search-wrap {
    max-width: none;
    flex-basis: auto;
  }

  .mv-ai-toolbar .search-wrap input#search-movies {
    font-size: 12px;
    padding: 7px 120px 7px 36px;
  }

  .mv-ai-toolbar .search-wrap .search-icon {
    left: 14px;
  }

  .mv-ai-toolbar .search-clear-btn {
    right: 92px;
    width: 24px;
    height: 24px;
  }

  .mv-ai-toolbar-actions {
    gap: 4px;
    right: 6px;
  }

  .mv-ai-toolbar-action {
    width: 38px;
    height: 38px;
    padding: 0;
  }

  .mv-ai-toolbar-action-label {
    display: none;
  }
}

/* ── Overlay ────────────────────────────────── */
.mv-ai-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 9998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

.mv-ai-overlay.open {
  opacity: 1;
  pointer-events: all;
}

/* ── Voice Assistant ────────────────────────── */
.mv-voice-modal {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 24px 28px 24px 24px;
}

.mv-voice-modal[hidden] {
  display: none !important;
}

.mv-voice-backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top right, rgba(229, 9, 20, 0.16) 0%, rgba(229, 9, 20, 0.06) 22%, rgba(0, 0, 0, 0) 45%), var(--mv-voice-overlay);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.mv-voice-panel {
  position: relative;
  z-index: 1;
  width: min(430px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding: 24px;
  border-radius: 24px;
  border: 1px solid var(--mv-ai-border);
  background: var(--mv-voice-panel-bg);
  color: var(--mv-ai-text);
  box-shadow: var(--mv-voice-panel-shadow), inset 0 1px 0 rgba(255,255,255,0.08);
}

.mv-voice-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.mv-voice-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.mv-voice-title strong,
.mv-voice-title span {
  display: block;
}

.mv-voice-title strong {
  font-size: 17px;
  line-height: 1.2;
}

.mv-voice-title span {
  font-size: 12px;
  color: var(--mv-ai-text-dim);
}

.mv-voice-title-icon {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(229, 9, 20, 0.18) 0%, rgba(229, 9, 20, 0.08) 100%);
  color: var(--mv-ai-accent);
  box-shadow: 0 14px 24px rgba(229, 9, 20, 0.14);
}

.mv-voice-close {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 12px;
  background: var(--mv-ai-surface);
  color: var(--mv-ai-text-dim);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.mv-voice-close:hover,
.mv-voice-close:focus-visible {
  background: var(--mv-ai-surface2);
  color: var(--mv-ai-text);
  outline: none;
  transform: translateY(-1px);
}

.mv-voice-state-label {
  margin: 0 0 18px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--mv-ai-text-dim);
}

.mv-voice-visual {
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
}

.mv-voice-waveform,
.mv-voice-level-bars {
  display: none;
}

.mv-voice-waveform {
  position: relative;
  width: 82px;
  height: 82px;
  border-radius: 999px;
  background: radial-gradient(circle at center, rgba(229, 9, 20, 0.24) 0%, rgba(229, 9, 20, 0.1) 38%, rgba(229, 9, 20, 0) 72%);
}

.mv-voice-waveform::before,
.mv-voice-waveform::after {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: inherit;
  border: 1px solid rgba(229, 9, 20, 0.28);
  animation: mvVoicePulse 1.4s ease-in-out infinite;
}

.mv-voice-waveform::after {
  inset: 0;
  animation-delay: 0.2s;
}

.mv-voice-level-bars {
  align-items: flex-end;
  gap: 6px;
  height: 54px;
}

.mv-voice-level-bars span {
  width: 7px;
  height: 52px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(248, 113, 113, 0.98) 0%, rgba(185, 28, 28, 0.82) 100%);
  transform-origin: center bottom;
  transition: transform 0.12s ease;
}

.mv-voice-panel.is-listening .mv-voice-level-bars {
  display: flex;
}

.mv-voice-panel.is-thinking .mv-voice-waveform,
.mv-voice-panel.is-speaking .mv-voice-waveform {
  display: block;
}

.mv-voice-transcript,
.mv-voice-response {
  padding: 14px 15px;
  border-radius: 16px;
  margin-bottom: 14px;
}

.mv-voice-transcript {
  background: var(--mv-voice-transcript-bg);
  border: 1px solid rgba(255,255,255,0.03);
}

.mv-voice-response {
  background: var(--mv-voice-response-bg);
  border: 1px solid var(--mv-voice-response-border);
}

.mv-voice-label {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mv-ai-text-dim);
}

.mv-voice-response .mv-voice-label {
  color: var(--mv-ai-accent);
}

.mv-voice-text {
  margin: 0;
  font-size: 15px;
  line-height: 1.6;
  color: var(--mv-ai-text);
  word-break: break-word;
}

.mv-voice-mic-wrap {
  display: flex;
  justify-content: center;
  margin: 8px 0 18px;
}

.mv-voice-mic {
  width: 82px;
  height: 82px;
  border: 0;
  border-radius: 999px;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: #ffffff;
  background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
  box-shadow: 0 20px 34px rgba(185, 28, 28, 0.28);
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease, opacity 0.2s ease;
}

.mv-voice-mic:hover,
.mv-voice-mic:focus-visible {
  transform: translateY(-1px) scale(1.03);
  box-shadow: 0 24px 40px rgba(185, 28, 28, 0.34);
  filter: brightness(1.03);
  outline: none;
}

.mv-voice-stop-icon {
  display: none;
}

.mv-voice-panel.is-listening .mv-voice-mic {
  background: linear-gradient(135deg, #dc2626 0%, #7f1d1d 100%);
  box-shadow: 0 22px 42px rgba(127, 29, 29, 0.42);
}

.mv-voice-panel.is-listening .mv-voice-mic-icon {
  display: none;
}

.mv-voice-panel.is-listening .mv-voice-stop-icon {
  display: block;
}

.mv-voice-panel.is-thinking .mv-voice-mic,
.mv-voice-panel.is-speaking .mv-voice-mic {
  opacity: 0.6;
  pointer-events: none;
}

.mv-voice-chips {
  border-top: 1px solid var(--mv-ai-border);
  padding-top: 16px;
}

.mv-voice-chips-label {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--mv-ai-text-dim);
}

.mv-voice-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mv-voice-chip {
  padding: 8px 11px;
  border-radius: 999px;
  border: 1px solid var(--mv-ai-border);
  background: var(--mv-voice-chip-bg);
  color: var(--mv-ai-text);
  font-size: 12px;
  line-height: 1.35;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.mv-voice-chip:hover,
.mv-voice-chip:focus-visible {
  background: var(--mv-voice-chip-hover-bg);
  border-color: rgba(229, 9, 20, 0.4);
  transform: translateY(-1px);
  outline: none;
}

@keyframes mvVoicePulse {
  0%,
  100% {
    opacity: 0.5;
    transform: scale(0.94);
  }
  50% {
    opacity: 1;
    transform: scale(1.04);
  }
}

/* ── Drawer ── */
.mv-ai-drawer {
  position: fixed;
  top: 0;
  right: -400px;
  width: 380px;
  max-width: 90vw;
  height: 100vh;
  background: var(--mv-ai-drawer-shell);
  color: var(--mv-ai-text);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--mv-ai-drawer-shadow);
  border-left: 1px solid var(--mv-ai-border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.mv-ai-drawer::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--mv-ai-drawer-glow);
  box-shadow: var(--mv-ai-drawer-highlight);
  pointer-events: none;
}

.mv-ai-drawer > * {
  position: relative;
  z-index: 1;
}

.mv-ai-drawer.open {
  right: 0;
}

.mv-ai-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--mv-ai-border);
  flex-shrink: 0;
  background: var(--mv-ai-drawer-chrome-bg);
  box-shadow: inset 0 -1px 0 rgba(255,255,255,0.03);
}

.mv-ai-drawer-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 15px;
}

.mv-ai-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--mv-ai-accent);
  box-shadow: 0 0 12px var(--mv-ai-accent-glow);
}

.mv-ai-title-text {
  line-height: 1.2;
}

.mv-ai-subtitle {
  font-size: 12px;
  color: var(--mv-ai-text-dim);
  font-weight: 400;
}

.mv-ai-close {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--mv-ai-text-dim);
  cursor: pointer;
  border-radius: 8px;
  display: grid;
  place-items: center;
  transition: background 0.15s;
}

.mv-ai-close:hover {
  background: rgba(229,9,20,0.15);
  color: var(--mv-ai-accent);
}

/* ── Drawer Body ────────────────────────────── */
.mv-ai-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: var(--mv-ai-drawer-body-bg);
}

.mv-ai-intro {
  text-align: center;
  padding: 30px 10px 20px;
}

.mv-ai-spark {
  width: 40px;
  height: 40px;
  color: var(--mv-ai-accent);
  margin-bottom: 12px;
  filter: drop-shadow(0 0 8px var(--mv-ai-accent-glow));
}

.mv-ai-intro p {
  color: var(--mv-ai-text-dim);
  font-size: 14px;
  line-height: 1.5;
  margin: 0 0 18px;
}

.mv-ai-suggests {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.mv-ai-sug {
  padding: 4px 12px;
  border: none;
  border-radius: 99px;
  background: linear-gradient(180deg, rgba(255,255,255,0.09) 0%, rgba(255,255,255,0.03) 100%);
  color: var(--mv-ai-text);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  backdrop-filter: blur(12px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.1), 0 1px 3px rgba(0,0,0,0.2);
}

.mv-ai-sug:hover {
  background: linear-gradient(180deg, rgba(229,9,20,0.2) 0%, rgba(229,9,20,0.08) 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.14), 0 0 8px var(--mv-ai-accent-glow);
  color: #fff;
}

body.theme-light .mv-ai-sug {
  background: rgba(0,0,0,0.04);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  color: var(--mv-ai-text);
}

body.theme-light .mv-ai-sug:hover {
  background: rgba(229,9,20,0.08);
  color: var(--mv-ai-accent);
  box-shadow: 0 1px 6px rgba(220,38,38,0.15);
}

/* ── Messages ───────────────────────────────── */
.mv-ai-msgs {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.mv-ai-msg {
  max-width: 88%;
  padding: 12px 15px;
  border-radius: 14px;
  font-size: 15px;
  line-height: 1.6;
  word-break: break-word;
  white-space: pre-wrap;
}

.mv-ai-msg.user {
  align-self: flex-end;
  background: var(--mv-ai-user-msg-bg);
  color: #ffffff;
  border-bottom-right-radius: 4px;
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: var(--mv-ai-user-msg-shadow);
}

.mv-ai-msg.bot {
  align-self: flex-start;
  background: var(--mv-ai-bot-msg-bg);
  color: var(--mv-ai-text);
  border-bottom-left-radius: 4px;
  border: 1px solid var(--mv-ai-border);
  box-shadow: var(--mv-ai-bot-msg-shadow);
}

body.theme-light .mv-ai-msg.user {
  background: var(--mv-ai-user-msg-bg);
  border-color: rgba(255,255,255,0.16);
}

body.theme-light .mv-ai-msg.bot {
  background: var(--mv-ai-bot-msg-bg);
  border-color: var(--mv-ai-border);
}

.mv-ai-msg.bot p {
  margin: 0;
}

.mv-ai-msg.bot p + p,
.mv-ai-msg.bot p + ul,
.mv-ai-msg.bot p + ol,
.mv-ai-msg.bot p + blockquote,
.mv-ai-msg.bot ul + p,
.mv-ai-msg.bot ol + p,
.mv-ai-msg.bot blockquote + p,
.mv-ai-msg.bot ul + ul,
.mv-ai-msg.bot ol + ol,
.mv-ai-msg.bot blockquote + ul,
.mv-ai-msg.bot blockquote + ol,
.mv-ai-msg.bot .mv-ai-md-heading + p,
.mv-ai-msg.bot .mv-ai-md-heading + ul,
.mv-ai-msg.bot .mv-ai-md-heading + ol,
.mv-ai-msg.bot .mv-ai-md-heading + blockquote {
  margin-top: 10px;
}

.mv-ai-msg.bot strong {
  font-weight: 700;
}

.mv-ai-msg.bot em {
  font-style: italic;
}

.mv-ai-msg.bot a {
  color: var(--mv-ai-accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.mv-ai-msg.bot ul,
.mv-ai-msg.bot ol {
  margin: 0;
  padding-left: 20px;
}

.mv-ai-msg.bot li + li {
  margin-top: 6px;
}

.mv-ai-msg.bot blockquote {
  margin: 0;
  padding: 10px 12px;
  border-left: 3px solid rgba(229, 9, 20, 0.45);
  border-radius: 10px;
  background: rgba(229, 9, 20, 0.06);
  color: var(--mv-ai-text);
}

.mv-ai-msg.bot code {
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(229, 9, 20, 0.12);
  color: inherit;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.92em;
}

.mv-ai-msg.bot pre {
  margin: 0;
  padding: 12px;
  overflow-x: auto;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.16);
  border: 1px solid var(--mv-ai-border);
}

.mv-ai-msg.bot pre code {
  padding: 0;
  border-radius: 0;
  background: transparent;
  display: block;
  white-space: pre;
}

.mv-ai-md-heading {
  font-weight: 700;
  line-height: 1.35;
}

.mv-ai-md-heading-1,
.mv-ai-md-heading-2 {
  font-size: 16px;
}

.mv-ai-md-heading-3,
.mv-ai-md-heading-4 {
  font-size: 15px;
}

.mv-ai-msg.bot.thinking {
  color: var(--mv-ai-text-dim);
  font-style: italic;
  border: 1px dashed rgba(229,9,20,0.18);
  background: rgba(229,9,20,0.03);
  box-shadow: none;
}

.mv-ai-msg.bot.sources {
  max-width: 100%;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

/* ── Source Cards ────────────────────────────── */
.mv-ai-sources-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 2px 0 0;
}

.mv-ai-src-card {
  display: block;
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--mv-ai-source-card-bg);
  border: 1px solid var(--mv-ai-border);
  text-decoration: none;
  color: var(--mv-ai-text);
  box-shadow: var(--mv-ai-bot-msg-shadow);
  transition: border-color 0.15s, background-color 0.15s, transform 0.15s;
}

.mv-ai-src-card:hover {
  background: var(--mv-ai-source-card-hover-bg);
  border-color: rgba(229,9,20,0.4);
  box-shadow: 0 0 10px var(--mv-ai-accent-glow);
  transform: translateY(-1px);
}

.mv-ai-src-kicker {
  display: block;
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: var(--mv-ai-accent);
}

.mv-ai-src-title {
  display: block;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mv-ai-src-meta {
  display: block;
  font-size: 12px;
  color: var(--mv-ai-text-dim);
}

/* ── Compose ────────────────────────────────── */
.mv-ai-compose {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  border-top: 1px solid var(--mv-ai-border);
  flex-shrink: 0;
  background: var(--mv-ai-drawer-chrome-bg);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

.mv-ai-compose input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid rgba(220,38,38,0.25);
  border-radius: 999px;
  background: rgba(220,38,38,0.03);
  color: var(--mv-ai-text);
  font-size: 14px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.3s, box-shadow 0.3s, background 0.3s;
  box-shadow: 0 0 4px rgba(220,38,38,0.2), inset 0 0 4px rgba(220,38,38,0.04);
}

.mv-ai-compose input::placeholder {
  color: rgba(220,38,38,0.35);
}

body.theme-light .mv-ai-compose input {
  background: rgba(220,38,38,0.02);
  border-color: rgba(220,38,38,0.2);
  color: var(--mv-ai-text);
  box-shadow: 0 0 3px rgba(220,38,38,0.1);
}

body.theme-light .mv-ai-compose input::placeholder {
  color: rgba(220,38,38,0.3);
}

.mv-ai-compose input:focus {
  border-color: rgba(220,38,38,0.55);
  box-shadow: 0 0 10px rgba(220,38,38,0.4), 0 0 20px rgba(220,38,38,0.15), inset 0 0 6px rgba(220,38,38,0.06);
  background: rgba(220,38,38,0.04);
}

.mv-ai-send {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: var(--mv-ai-accent);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.2s;
  box-shadow: 0 0 8px var(--mv-ai-accent-glow);
}

.mv-ai-send:hover {
  box-shadow: 0 0 16px rgba(229,9,20,0.5), 0 0 30px rgba(229,9,20,0.2);
  transform: scale(1.05);
}

/* ── Notification Panel ─────────────────────── */
.mv-ai-notif-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
  max-height: 400px;
  background: var(--mv-ai-panel-bg);
  border: 1px solid var(--mv-ai-border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.35);
  display: none;
  overflow: hidden;
  z-index: 100;
  backdrop-filter: blur(18px);
}

body.theme-light .mv-ai-notif-panel {
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

.mv-ai-notif-panel.open {
  display: block;
}

.mv-ai-notif-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--mv-ai-border);
  font-weight: 600;
  font-size: 14px;
}

.mv-ai-notif-head-actions {
  display: flex;
  gap: 8px;
}

.mv-ai-notif-settings,
.mv-ai-notif-dismiss {
  border: none;
  background: transparent;
  color: var(--mv-ai-accent);
  font-size: 12px;
  cursor: pointer;
  font-weight: 500;
  transition: text-shadow 0.2s;
}

.mv-ai-notif-settings:hover,
.mv-ai-notif-dismiss:hover {
  text-shadow: 0 0 8px var(--mv-ai-accent-glow);
}

.mv-ai-notif-list {
  max-height: 340px;
  overflow-y: auto;
  padding: 8px;
}

.mv-ai-notif-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s;
}

.mv-ai-notif-img {
  width: 44px;
  height: 60px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}

.mv-ai-notif-body {
  flex: 1;
  min-width: 0;
}

.mv-ai-notif-item:hover {
  background: var(--mv-ai-bot-bg);
}

.mv-ai-notif-item.unread {
  border-left: 3px solid var(--mv-ai-accent);
  background: rgba(229,9,20,0.04);
}

.mv-ai-notif-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 2px;
}

.mv-ai-notif-msg {
  font-size: 12px;
  color: var(--mv-ai-text-dim);
}

.mv-ai-notif-time {
  font-size: 11px;
  color: var(--mv-ai-text-dim);
  margin-top: 2px;
}

.mv-ai-notif-empty,
.mv-ai-notif-loading {
  padding: 24px;
  text-align: center;
  font-size: 13px;
  color: var(--mv-ai-text-dim);
}

/* ── Preferences Drawer ─────────────────────── */
.mv-ai-pref-note {
  font-size: 13px;
  color: var(--mv-ai-text-dim);
  line-height: 1.5;
  margin: 0 0 18px;
}

.mv-ai-pref-group {
  margin-bottom: 20px;
}

.mv-ai-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--mv-ai-text-dim);
  margin-bottom: 8px;
  text-transform: uppercase;
}

.mv-ai-chips {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
  overflow-x: auto;
}

.mv-ai-chips-wrap {
  flex-wrap: wrap;
}

.mv-ai-chip {
  padding: 4px 11px;
  border: none;
  border-radius: 99px;
  background: linear-gradient(180deg, rgba(255,255,255,0.09) 0%, rgba(255,255,255,0.03) 100%);
  color: var(--mv-ai-text);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  backdrop-filter: blur(12px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.1), 0 1px 3px rgba(0,0,0,0.2);
  font-family: inherit;
}

.mv-ai-chip.on {
  background: var(--mv-ai-accent);
  color: #fff;
  font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.25), 0 1px 4px rgba(229,9,20,0.35);
}

.mv-ai-chip:hover:not(.on) {
  background: linear-gradient(180deg, rgba(229,9,20,0.15) 0%, rgba(229,9,20,0.06) 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.14), 0 0 6px var(--mv-ai-accent-glow);
}

body.theme-light .mv-ai-chip {
  background: rgba(0,0,0,0.04);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  color: var(--mv-ai-text);
}

body.theme-light .mv-ai-chip:hover:not(.on) {
  background: rgba(229,9,20,0.06);
}

.mv-ai-drawer-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-top: 1px solid var(--mv-ai-border);
  flex-shrink: 0;
  background: var(--mv-ai-drawer-chrome-bg);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

.mv-ai-btn {
  padding: 8px 18px;
  border: 1px solid var(--mv-ai-border);
  border-radius: 8px;
  background: transparent;
  color: var(--mv-ai-text);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}

.mv-ai-btn:hover {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.15);
}

.mv-ai-btn-primary {
  background: var(--mv-ai-accent);
  border-color: var(--mv-ai-accent);
  color: #fff;
  box-shadow: 0 0 8px var(--mv-ai-accent-glow);
}

.mv-ai-btn-primary:hover {
  box-shadow: 0 0 14px rgba(229,9,20,0.5);
  background: var(--mv-ai-accent);
}

.mv-ai-pref-status {
  font-size: 12px;
  color: var(--mv-ai-accent);
  text-align: center;
  min-height: 18px;
  margin-top: 8px;
  text-shadow: 0 0 6px var(--mv-ai-accent-glow);
}

/* ── Responsive ─────────────────────────────── */
@media (max-width: 680px) {
  .mv-ai-drawer {
    width: 100vw;
    max-width: 100vw;
    right: -100vw;
  }

  .mv-ai-header-actions {
    gap: 3px;
  }

  .mv-ai-header-btn {
    width: 30px;
    height: 30px;
  }

  .mv-ai-header-btn svg {
    width: 13px;
    height: 13px;
  }

  .mv-ai-notif-panel {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 60vh;
    border-radius: 16px 16px 0 0;
  }
}

@media (max-width: 420px) {
  .mv-ai-drawer {
    border-radius: 0;
  }
}

/* ── Body lock when drawer open ─────────────── */
body.mv-drawer-open {
  overflow: hidden;
}
