/* ==========================================
   PAMELA AI - DESIGN SYSTEM & LUXURY THEME
   ========================================== */
:root {
  /* Color Palette - HSL Velvet, Rose Gold & Champagne */
  --bg-primary: hsl(280, 24%, 7%);        /* #130c17 - Deep Velvet Night */
  --bg-secondary: hsl(280, 20%, 12%);    /* #201526 - Glass Surface */
  --bg-sidebar: hsl(280, 22%, 10%);      /* #1b1121 */
  --bg-bubble-bot: hsl(280, 18%, 16%);   /* #2a1b33 - Pamela Bot Bubble */
  --bg-bubble-user: hsl(340, 52%, 24%);  /* #5d1d36 - User Bubble */
  
  --border-light: rgba(244, 208, 111, 0.12);
  --border-luxury: rgba(244, 208, 111, 0.28);
  --border-focus: hsla(43, 90%, 65%, 0.55);
  
  --text-primary: hsl(40, 30%, 94%);     /* Ivory White */
  --text-secondary: hsl(340, 15%, 72%);  /* Soft Rose Tint */
  --text-muted: hsl(280, 10%, 48%);
  
  --accent-gold: hsl(43, 88%, 65%);      /* #f4d06f - Champagne Gold */
  --accent-gold-hover: hsl(43, 95%, 72%);
  --accent-rosegold: hsl(350, 75%, 75%); /* #f2a6b0 */
  --accent-neonpink: hsl(330, 95%, 62%); /* #fc3d8b - Miami Nightlife */
  --accent-cyan: hsl(175, 80%, 55%);
  --accent-red: hsl(355, 85%, 58%);
  
  /* Fonts */
  --font-display: 'Playfair Display', Georgia, serif;
  --font-sans: 'Space Grotesk', sans-serif;
  --font-body: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  
  /* Layout */
  --sidebar-width: 330px;
  --header-height: 74px;
}

/* ==========================================
   RESET & BASICS
   ========================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  height: 100%;
  height: 100dvh;
  min-height: -webkit-fill-available;
  width: 100%;
  overflow: hidden;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, .brand-info h1, .chat-title {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(244, 208, 111, 0.18);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(244, 208, 111, 0.35);
}

/* ==========================================
   FLOATING CHAMPAGNE BUBBLE PARTICLES
   ========================================== */
.champagne-bubbles-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

.champagne-bubble {
  position: absolute;
  bottom: -20px;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.8), rgba(244, 208, 111, 0.35) 60%, rgba(244, 208, 111, 0.05) 100%);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(244, 208, 111, 0.3), inset 0 0 4px rgba(255, 255, 255, 0.5);
  animation: riseAndWobble linear infinite;
}

@keyframes riseAndWobble {
  0% {
    transform: translateY(0) translateX(0) scale(0.8);
    opacity: 0;
  }
  10% {
    opacity: 0.75;
  }
  50% {
    transform: translateY(-50vh) translateX(18px) scale(1.05);
    opacity: 0.6;
  }
  90% {
    opacity: 0.8;
  }
  100% {
    transform: translateY(-105vh) translateX(-18px) scale(1.2);
    opacity: 0;
  }
}

/* ==========================================
   APPLICATION CONTAINER
   ========================================== */
.app-container {
  display: flex;
  height: 100%;
  height: 100dvh;
  width: 100vw;
  position: relative;
  z-index: 2;
  overflow: hidden;
}

/* ==========================================
   MOBILE SIDEBAR BACKDROP
   ========================================== */
.sidebar-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100%;
  height: 100dvh;
  background: rgba(12, 7, 16, 0.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 18;
  opacity: 0;
  transition: opacity 0.28s ease;
  pointer-events: none;
}

.sidebar-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

/* ==========================================
   SIDEBAR / BRICKELL DASHBOARD
   ========================================== */
.sidebar {
  width: var(--sidebar-width);
  height: 100%;
  background: linear-gradient(180deg, rgba(27, 17, 33, 0.92) 0%, rgba(19, 12, 23, 0.96) 100%);
  border-right: 1px solid var(--border-luxury);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 10;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.35);
}

.sidebar-header {
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--border-light);
  background: rgba(244, 208, 111, 0.03);
}

.avatar-container {
  position: relative;
  width: 52px;
  height: 52px;
}

.avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent-gold);
  box-shadow: 0 0 14px rgba(244, 208, 111, 0.35);
}

.champagne-badge-flute {
  position: absolute;
  bottom: -4px;
  right: -4px;
  font-size: 14px;
  background: var(--bg-secondary);
  border-radius: 50%;
  padding: 2px;
  box-shadow: 0 0 6px rgba(0,0,0,0.5);
}

.brand-info h1 {
  font-size: 1.35rem;
  color: var(--accent-gold);
  line-height: 1.1;
  text-shadow: 0 0 12px rgba(244, 208, 111, 0.25);
}

.version-badge {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent-rosegold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 3px;
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Widgets */
.widget {
  background: rgba(42, 27, 51, 0.45);
  border: 1px solid var(--border-light);
  border-radius: 14px;
  padding: 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 4px 14px rgba(0, 0, 0, 0.2);
}

.widget-header {
  margin-bottom: 12px;
}

.widget h2 {
  font-size: 0.92rem;
  font-family: var(--font-sans);
  font-weight: 600;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.widget-sub {
  font-size: 0.72rem;
  color: var(--accent-rosegold);
  display: block;
}

/* Gauge Widget */
.deal-widget {
  text-align: center;
}

.gauge-container {
  position: relative;
  width: 170px;
  height: 85px;
  margin: 6px auto 10px auto;
}

.gauge {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.gauge-needle {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 3px;
  height: 68px;
  background: #ffffff;
  transform-origin: bottom center;
  transform: translateX(-50%) rotate(0deg);
  transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
  border-radius: 3px;
  box-shadow: 0 0 10px var(--accent-gold);
}

.gauge-center {
  position: absolute;
  bottom: -6px;
  left: 50%;
  width: 14px;
  height: 14px;
  background: var(--accent-gold);
  border: 2px solid #ffffff;
  border-radius: 50%;
  transform: translateX(-50%);
  box-shadow: 0 0 12px rgba(244, 208, 111, 0.6);
}

.gauge-label-container {
  margin-bottom: 12px;
}

.gauge-value-label {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-gold);
  letter-spacing: 0.02em;
}

/* Stat Rows */
.stat-row {
  margin-bottom: 12px;
}

.stat-row:last-child {
  margin-bottom: 0;
}

.stat-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 4px;
}

.stat-bar-container {
  width: 100%;
  height: 7px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 3px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-bar {
  height: 100%;
  border-radius: 6px;
  transition: width 0.6s ease;
}

.gold-bar {
  background: linear-gradient(90deg, #e5c158, #f4d06f);
  box-shadow: 0 0 8px rgba(244, 208, 111, 0.5);
}

.pink-bar {
  background: linear-gradient(90deg, #f2a6b0, #fc3d8b);
  box-shadow: 0 0 8px rgba(252, 61, 139, 0.4);
}

.danger-bar {
  background: linear-gradient(90deg, #e02f53, #ff5e7e);
}

.info-bar {
  background: #a89bb0;
}

.flashing-bar {
  animation: pulseTraffic 1.8s infinite;
}

@keyframes pulseTraffic {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

.stat-value {
  font-family: var(--font-sans);
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--text-primary);
}

/* Hotspot Widget */
.hotspot-widget {
  background: linear-gradient(135deg, rgba(252, 61, 139, 0.12) 0%, rgba(244, 208, 111, 0.1) 100%);
  border: 1px solid rgba(244, 208, 111, 0.22);
}

.hotspot-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.hotspot-title {
  font-size: 0.74rem;
  text-transform: uppercase;
  color: var(--accent-rosegold);
  font-weight: 600;
  font-family: var(--font-sans);
}

.hotspot-name {
  font-family: var(--font-display);
  font-size: 0.96rem;
  font-weight: 600;
  color: var(--accent-gold);
  margin-bottom: 3px;
}

.hotspot-action-note {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-style: italic;
}

/* Buttons */
.btn {
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
}

.btn-champagne {
  background: linear-gradient(135deg, #e5c158 0%, #f4d06f 100%);
  color: #1a1020;
  box-shadow: 0 4px 14px rgba(244, 208, 111, 0.35);
}

.btn-champagne:hover {
  background: linear-gradient(135deg, #f4d06f 0%, #fff0a8 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(244, 208, 111, 0.5);
}

.btn-secondary-outline {
  background: transparent;
  border: 1px solid var(--border-luxury);
  color: var(--text-secondary);
}

.btn-secondary-outline:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

/* ==========================================
   MAIN CHAT WORKSPACE
   ========================================== */
.chat-workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  background: radial-gradient(circle at 50% 20%, rgba(35, 20, 45, 0.4) 0%, rgba(19, 12, 23, 0.9) 100%);
  position: relative;
  overflow: hidden;
}

/* Header */
.chat-header {
  padding: 14px 24px;
  border-bottom: 1px solid var(--border-luxury);
  background: rgba(27, 17, 33, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.header-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}

.sidebar-toggle {
  display: none;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px;
  flex-direction: column;
  gap: 5px;
  flex-shrink: 0;
  min-width: 40px;
  min-height: 40px;
  align-items: center;
  justify-content: center;
}

.sidebar-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--accent-gold);
  border-radius: 2px;
}

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

.chat-title {
  font-size: 1.45rem;
  color: var(--text-primary);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.title-sparkle {
  font-size: 1.1rem;
  line-height: 1;
}

.sub-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.badge {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.badge-accent {
  background: rgba(252, 61, 139, 0.18);
  border: 1px solid rgba(252, 61, 139, 0.4);
  color: #ff74ad;
}

.badge-gold {
  background: rgba(244, 208, 111, 0.16);
  border: 1px solid rgba(244, 208, 111, 0.4);
  color: var(--accent-gold);
}

.badge-outline {
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
}

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

.volume-btn {
  background: rgba(244, 208, 111, 0.1);
  border: 1px solid var(--border-light);
  color: var(--accent-gold);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}

.volume-btn:hover {
  background: rgba(244, 208, 111, 0.2);
  border-color: var(--accent-gold);
}

.btn-panic {
  background: linear-gradient(135deg, #fc3d8b 0%, #b3165b 100%);
  color: #ffffff;
  border: none;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 7px 14px;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 0 14px rgba(252, 61, 139, 0.4);
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  white-space: nowrap;
}

.btn-panic:hover {
  transform: scale(1.03);
  box-shadow: 0 0 20px rgba(252, 61, 139, 0.65);
}

.panic-text-mobile {
  display: none;
}

.tagline {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 0.88rem;
  color: var(--accent-rosegold);
  margin-top: 2px;
}

/* ==========================================
   CHAT MESSAGES CONTAINER
   ========================================== */
.chat-messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
}

.messages-scroll {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
}

.message-wrapper {
  display: flex;
  gap: 14px;
  animation: fadeInMsg 0.3s ease;
}

@keyframes fadeInMsg {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.message-wrapper.user {
  flex-direction: row-reverse;
}

.message-avatar {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
}

.message-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--accent-gold);
}

.user-avatar-pill {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fc3d8b, #701c40);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.88rem;
  color: #fff;
  border: 1.5px solid rgba(255,255,255,0.3);
}

.message-bubble-container {
  max-width: 78%;
}

.message-sender-name {
  font-size: 0.8rem;
  font-family: var(--font-sans);
  font-weight: 600;
  color: var(--accent-gold);
  margin-bottom: 4px;
}

.message-sender-name span {
  font-size: 0.72rem;
  color: var(--text-secondary);
  font-weight: 400;
}

.message-wrapper.user .message-sender-name {
  text-align: right;
  color: var(--accent-rosegold);
}

.message-bubble {
  padding: 16px 20px;
  border-radius: 16px;
  font-size: 0.96rem;
  line-height: 1.6;
  box-shadow: 0 4px 18px rgba(0,0,0,0.25);
}

.message-wrapper.bot .message-bubble {
  background: var(--bg-bubble-bot);
  border: 1px solid var(--border-luxury);
  border-top-left-radius: 4px;
  color: var(--text-primary);
}

.message-wrapper.user .message-bubble {
  background: var(--bg-bubble-user);
  border: 1px solid rgba(252, 61, 139, 0.35);
  border-top-right-radius: 4px;
  color: #ffffff;
}

.message-bubble p {
  margin-bottom: 10px;
}

.message-bubble p:last-child {
  margin-bottom: 0;
}

.message-bubble code {
  background: rgba(0, 0, 0, 0.4);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  color: var(--accent-gold);
  font-size: 0.9em;
}

.cre-highlight-box {
  margin-top: 10px;
  padding: 10px 14px;
  background: rgba(244, 208, 111, 0.08);
  border-left: 3px solid var(--accent-gold);
  border-radius: 0 8px 8px 0;
  font-size: 0.88rem;
}

/* ==========================================
   INPUT AREA & CONTROLS
   ========================================== */
.chat-input-area {
  padding: 16px 24px 20px;
  background: linear-gradient(180deg, transparent 0%, rgba(19, 12, 23, 0.95) 40%);
  border-top: 1px solid var(--border-light);
}

.input-container-wrapper {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Starter Suggestions */
.starter-suggestions {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.suggestion-chip {
  background: rgba(42, 27, 51, 0.7);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  padding: 7px 14px;
  border-radius: 20px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.suggestion-chip:hover {
  background: rgba(244, 208, 111, 0.18);
  border-color: var(--accent-gold);
  color: var(--accent-gold);
  transform: translateY(-1px);
}

/* Typing Indicator */
.typing-indicator-container {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.84rem;
  color: var(--accent-gold);
  font-family: var(--font-sans);
}

.typing-dots {
  display: flex;
  gap: 4px;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  background: var(--accent-gold);
  border-radius: 50%;
  animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingBounce {
  0%, 80%, 100% { transform: scale(0); opacity: 0.3; }
  40% { transform: scale(1); opacity: 1; }
}

/* Input Form */
.input-form {
  display: flex;
  gap: 10px;
  background: rgba(32, 21, 38, 0.85);
  border: 1px solid var(--border-luxury);
  border-radius: 14px;
  padding: 6px 8px 6px 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  transition: border-color 0.2s ease;
}

.input-form:focus-within {
  border-color: var(--accent-gold);
  box-shadow: 0 0 16px rgba(244, 208, 111, 0.3);
}

.input-form input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.96rem;
}

.input-form input::placeholder {
  color: var(--text-muted);
}

.send-btn {
  background: linear-gradient(135deg, #e5c158, #f4d06f);
  border: none;
  border-radius: 10px;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #1a1020;
  transition: all 0.2s ease;
}

.send-btn svg {
  width: 20px;
  height: 20px;
}

.send-btn:hover {
  background: linear-gradient(135deg, #f4d06f, #fff0a8);
  transform: scale(1.05);
}

.satirical-disclaimer {
  font-size: 0.74rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.4;
}

.copyright-footer {
  font-size: 0.72rem;
  color: var(--text-secondary);
  text-align: center;
}

.copyright-footer a {
  color: var(--accent-gold);
  text-decoration: none;
}

/* ==========================================
   CANVAS PANEL (CRE TERM SHEET GENERATOR)
   ========================================== */
.canvas-panel {
  width: 380px;
  height: 100%;
  background: rgba(25, 16, 30, 0.96);
  border-left: 1px solid var(--border-luxury);
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: transform 0.3s ease;
  z-index: 9;
}

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

.canvas-title-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.canvas-title-wrapper h3 {
  font-size: 0.96rem;
  color: var(--accent-gold);
}

.canvas-actions {
  display: flex;
  gap: 6px;
}

.btn-canvas-action {
  background: rgba(244, 208, 111, 0.1);
  border: 1px solid var(--border-light);
  color: var(--accent-gold);
  font-family: var(--font-sans);
  font-size: 0.74rem;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
}

.btn-canvas-action:hover {
  background: var(--accent-gold);
  color: #1a1020;
}

.canvas-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.code-editor-wrapper {
  display: flex;
  background: #110915;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  overflow: hidden;
  font-family: 'Space Grotesk', monospace;
  font-size: 0.82rem;
  line-height: 1.6;
}

.line-numbers {
  padding: 12px 8px;
  background: #170d1c;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  user-select: none;
  text-align: right;
}

.code-display {
  padding: 12px;
  color: #f7e7ce;
  overflow-x: auto;
  flex: 1;
}

/* ==========================================
   MODALS & OVERLAYS
   ========================================== */
.modal-overlay, .panic-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(10, 6, 12, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal-card {
  background: linear-gradient(145deg, #25162c, #1a0f20);
  border: 1px solid var(--accent-gold);
  border-radius: 20px;
  padding: 32px 28px;
  max-width: 440px;
  width: 100%;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6), 0 0 30px rgba(244, 208, 111, 0.2);
  animation: modalScale 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalScale {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.modal-card h2 {
  font-size: 1.35rem;
  color: var(--accent-gold);
  margin-bottom: 10px;
}

.modal-description {
  font-size: 0.92rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.panic-alert-box {
  background: #2b0c1e;
  border: 2px solid #fc3d8b;
  border-radius: 18px;
  padding: 36px 30px;
  max-width: 460px;
  text-align: center;
  box-shadow: 0 0 40px rgba(252, 61, 139, 0.5);
  color: #fff;
}

.panic-alert-box h2 {
  color: #fc3d8b;
  font-size: 1.25rem;
  margin-bottom: 12px;
}

.panic-spinner {
  width: 46px;
  height: 46px;
  border: 3px solid rgba(252, 61, 139, 0.3);
  border-top-color: #fc3d8b;
  border-radius: 50%;
  margin: 0 auto 16px auto;
  animation: spin 1s infinite linear;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.hidden {
  display: none !important;
}

/* ==========================================
   RESPONSIVE BREAKPOINTS
   ========================================== */
@media (max-width: 992px) {
  .canvas-panel {
    position: absolute;
    right: 0;
    top: 0;
    width: min(420px, 100vw);
    max-width: 100vw;
    z-index: 25;
    box-shadow: -6px 0 26px rgba(0,0,0,0.65);
  }
}

@media (max-width: 768px) {
  .sidebar-backdrop {
    display: block;
  }
  
  .sidebar {
    position: absolute;
    left: 0;
    top: 0;
    width: min(320px, 85vw);
    height: 100%;
    height: 100dvh;
    z-index: 20;
    transform: translateX(-100%);
    box-shadow: 6px 0 32px rgba(0, 0, 0, 0.7);
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  .sidebar-toggle {
    display: flex;
    min-width: 38px;
    min-height: 38px;
    padding: 6px 4px;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
  }

  .sidebar-toggle:active {
    background: rgba(244, 208, 111, 0.12);
  }
  
  /* Hide all badges in top header on mobile to give title and actions ample room */
  .sub-badges {
    display: none !important;
  }

  /* Compact volume button on mobile */
  .vol-text-desktop {
    display: none;
  }

  .volume-btn {
    padding: 6px 10px;
    font-size: 0.95rem;
    min-width: 38px;
    min-height: 38px;
  }
  
  .panic-text-desktop {
    display: none;
  }
  
  .panic-text-mobile {
    display: inline;
  }

  .btn-panic {
    padding: 6px 11px;
    font-size: 0.78rem;
    min-height: 38px;
  }

  .header-main {
    gap: 8px;
  }

  .title-section {
    gap: 8px;
    flex: 1;
    min-width: 0;
  }
  
  .chat-title {
    font-size: 1.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .chat-header {
    padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 10px 14px;
    gap: 3px;
  }

  .tagline {
    font-size: 0.76rem;
    line-height: 1.35;
    margin-top: 1px;
    opacity: 0.9;
  }
  
  .chat-messages-container {
    padding: 14px 12px;
  }

  .chat-input-area {
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px)) 12px;
  }

  .starter-suggestions {
    gap: 6px;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
  }

  .suggestion-chip {
    padding: 7px 12px;
    font-size: 0.76rem;
  }

  .canvas-panel {
    width: 100vw;
    max-width: 100vw;
  }

  .btn-send {
    min-width: 42px;
    min-height: 42px;
    padding: 0 14px;
  }
}

@media (max-width: 480px) {
  .header-actions {
    gap: 6px;
  }

  .chat-title {
    font-size: 1.18rem;
  }

  .chat-input-field {
    font-size: 0.88rem;
    min-height: 40px;
  }

  .bubble-content {
    font-size: 0.88rem;
  }

  .modal-card, .panic-alert-box {
    width: calc(100vw - 32px);
    max-width: 380px;
    padding: 22px 18px;
    margin: auto 16px;
  }
}
