/**
 * POLISH Board Studio — POLISH AI Luxury Floating Window
 * Direction: Haute Atelier Champagne Gold & Cashmere Platinum
 * Official Branding: Golden Ratio Pipette Mark + Clean Typography
 */

/* =========================================================================
   1. DOCK TRIGGER BUTTON (Top Header Capsule)
   ========================================================================= */
.btn-ai-copilot {
  position: relative !important;
  overflow: hidden !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 7px !important;
  background: linear-gradient(135deg, #24201D 0%, #151311 100%) !important;
  border: 1px solid rgba(197, 168, 128, 0.7) !important;
  color: #F5E6D3 !important;
  font-family: var(--font-heading, 'Plus Jakarta Sans', sans-serif) !important;
  font-weight: 850 !important;
  font-size: 11.5px !important;
  letter-spacing: 0.08em !important;
  padding: 6px 14px !important;
  border-radius: 999px !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25), 0 0 12px rgba(226, 199, 153, 0.3) !important;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1) !important;
  cursor: pointer;
  z-index: 1;
}

/* Sweeping Iridescent Specular Glint */
.btn-ai-copilot::before {
  content: '';
  position: absolute;
  top: -60%;
  left: -120%;
  width: 50%;
  height: 220%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.75), transparent);
  transform: rotate(25deg);
  animation: aiSpecularGlint 4s cubic-bezier(0.16, 1, 0.3, 1) infinite;
  pointer-events: none;
  z-index: 2;
}

@keyframes aiSpecularGlint {
  0% { left: -120%; opacity: 0; }
  12% { opacity: 0.9; }
  28% { left: 220%; opacity: 0; }
  100% { left: 220%; opacity: 0; }
}

/* Luxury Sparkle Icon Container & Kinetic Pulse */
.ai-sparkle-icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: #E2C799;
  filter: drop-shadow(0 0 4px rgba(226, 199, 153, 0.8));
}

.ai-sparkle-svg {
  display: block;
  animation: aiSparkleKinetic 3.2s ease-in-out infinite alternate;
}

@keyframes aiSparkleKinetic {
  0% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(1.18) rotate(12deg); }
  100% { transform: scale(1) rotate(0deg); }
}

.ai-btn-text {
  font-weight: 850;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

/* Keyboard Shortcut Badge */
.ai-kbd-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 5px;
  background: rgba(226, 199, 153, 0.15);
  border: 1px solid rgba(226, 199, 153, 0.35);
  color: #E2C799;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

/* =========================================================================
   DARK THEME: HAUTE ATELIER RADIANT GOLD JEWEL (EYE-CATCHING HERO CTA)
   ========================================================================= */
body.theme-dark .btn-ai-copilot,
.theme-dark .btn-ai-copilot {
  background: linear-gradient(135deg, #FFF0D0 0%, #F3D382 28%, #E2C799 62%, #C5A880 100%) !important;
  border: 1px solid #FFF5E2 !important;
  color: #080706 !important;
  font-weight: 900 !important;
  animation: aiBreathingAura 3.6s ease-in-out infinite alternate;
  box-shadow: 
    0 0 16px rgba(226, 199, 153, 0.6),
    0 2px 10px rgba(0, 0, 0, 0.65),
    inset 0 1px 1.5px rgba(255, 255, 255, 0.95) !important;
}

@keyframes aiBreathingAura {
  0% {
    box-shadow: 
      0 0 14px rgba(226, 199, 153, 0.5),
      0 2px 8px rgba(0, 0, 0, 0.6),
      inset 0 1px 1.5px rgba(255, 255, 255, 0.9);
  }
  50% {
    box-shadow: 
      0 0 28px rgba(243, 211, 130, 0.85),
      0 0 10px rgba(255, 240, 208, 0.9),
      0 3px 12px rgba(0, 0, 0, 0.7),
      inset 0 1px 2px rgba(255, 255, 255, 1);
  }
  100% {
    box-shadow: 
      0 0 14px rgba(226, 199, 153, 0.5),
      0 2px 8px rgba(0, 0, 0, 0.6),
      inset 0 1px 1.5px rgba(255, 255, 255, 0.9);
  }
}

body.theme-dark .btn-ai-copilot .ai-sparkle-icon-wrap,
.theme-dark .btn-ai-copilot .ai-sparkle-icon-wrap {
  color: #080706 !important;
  filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.5));
}

body.theme-dark .btn-ai-copilot .ai-kbd-badge,
.theme-dark .btn-ai-copilot .ai-kbd-badge {
  background: rgba(8, 7, 6, 0.16) !important;
  border: 1px solid rgba(8, 7, 6, 0.25) !important;
  color: #080706 !important;
  font-weight: 900 !important;
}

/* Hover State */
.btn-ai-copilot:hover {
  transform: translateY(-1.5px) scale(1.02) !important;
}

body.theme-dark .btn-ai-copilot:hover,
.theme-dark .btn-ai-copilot:hover {
  background: linear-gradient(135deg, #FFFFFF 0%, #F7DC98 30%, #E8CCA0 65%, #CCA97B 100%) !important;
  box-shadow: 
    0 0 32px rgba(243, 211, 130, 0.95),
    0 0 14px rgba(255, 255, 255, 0.8),
    0 4px 18px rgba(0, 0, 0, 0.8),
    inset 0 1px 2px rgba(255, 255, 255, 1) !important;
}

/* Active State when Copilot window is open */
.btn-ai-copilot.active-pulse,
body.theme-dark .btn-ai-copilot.active-pulse {
  border-color: #FFFFFF !important;
  box-shadow: 
    0 0 35px rgba(243, 211, 130, 1),
    0 0 14px rgba(255, 255, 255, 0.9),
    0 4px 18px rgba(0, 0, 0, 0.85) !important;
}

/* =========================================================================
   2. NON-BLOCKING BACKDROP ELIMINATION
   ========================================================================= */
.ai-copilot-backdrop {
  display: none !important;
  pointer-events: none !important;
}

/* =========================================================================
   3. MINIMIZED FLOATING PILL
   ========================================================================= */
.ai-minimized-pill {
  position: fixed;
  bottom: 20px;
  right: 236px;
  z-index: 9999;
  display: none;
  align-items: center;
  gap: 9px;
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  user-select: none;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(226, 199, 153, 0.6);
  backdrop-filter: blur(28px) saturate(190%);
  -webkit-backdrop-filter: blur(28px) saturate(190%);
  box-shadow: 0 10px 28px rgba(26, 23, 21, 0.12), 0 0 18px rgba(226, 199, 153, 0.25);
  color: #1A1715;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  animation: aiPillFloat 3s ease-in-out infinite;
}

body.theme-dark .ai-minimized-pill,
.theme-dark .ai-minimized-pill {
  background: rgba(18, 15, 12, 0.94);
  border-color: rgba(226, 199, 153, 0.45);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.7), 0 0 22px rgba(226, 199, 153, 0.2);
  color: #F5E6D3;
}

.ai-minimized-pill:hover {
  transform: translateY(-2px) scale(1.04);
  border-color: #E2C799;
  box-shadow: 0 14px 34px rgba(226, 199, 153, 0.35);
}

.ai-minimized-pill.is-active {
  display: inline-flex;
}

.ai-minimized-pill img {
  width: 16px;
  height: 16px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 4px rgba(226, 199, 153, 0.45));
}

@keyframes aiPillFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

.ai-pill-title {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ai-pill-cards-badge {
  font-size: 9px;
  font-weight: 800;
  color: #080706;
  background: linear-gradient(135deg, #E2C799 0%, #C5A880 100%);
  padding: 2px 7px;
  border-radius: 999px;
}

/* =========================================================================
   4. FLOATING LUXURY WINDOW (Spatial Studio Inspector)
   ========================================================================= */
.ai-copilot-window {
  position: fixed;
  bottom: 24px;
  right: 236px;
  width: 440px;
  height: 580px;
  max-height: calc(100vh - 100px);
  min-height: 380px;
  min-width: 360px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  border-radius: 20px;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  color: #1A1715;
  user-select: auto;
  
  /* Haute Atelier Frosted Glassmorphism */
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(36px) saturate(190%);
  -webkit-backdrop-filter: blur(36px) saturate(190%);
  border: 1px solid rgba(226, 199, 153, 0.45);
  box-shadow: 0 24px 65px rgba(26, 23, 21, 0.16),
              0 0 24px rgba(226, 199, 153, 0.12),
              inset 0 1px 1.5px rgba(255, 255, 255, 0.7);
  
  /* State Transitions */
  opacity: 0;
  pointer-events: none;
  transform: scale(0.95) translateY(14px);
  transition: opacity 0.24s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.28s cubic-bezier(0.16, 1, 0.3, 1),
              width 0.24s ease,
              height 0.24s ease;
  overflow: hidden;
}

body.theme-dark .ai-copilot-window,
.theme-dark .ai-copilot-window {
  background: rgba(14, 12, 10, 0.90);
  border-color: rgba(226, 199, 153, 0.32);
  box-shadow: 0 28px 75px rgba(0, 0, 0, 0.8),
              0 0 32px rgba(226, 199, 153, 0.1),
              inset 0 1px 1.5px rgba(245, 230, 211, 0.2);
  color: #FAF7F2;
}

/* Open State */
.ai-copilot-window.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1) translateY(0);
}

/* Dragging Physics */
.ai-copilot-window.is-dragging {
  transition: none !important;
  box-shadow: 0 36px 90px rgba(0, 0, 0, 0.8), 0 0 40px rgba(226, 199, 153, 0.3) !important;
  user-select: none;
}

/* Docked Sidebar Mode */
.ai-copilot-window.is-docked {
  top: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  left: auto !important;
  width: 440px !important;
  height: 100vh !important;
  max-height: 100vh !important;
  border-radius: 0 !important;
  border-right: none !important;
  border-top: none !important;
  border-bottom: none !important;
  border-left: 1px solid rgba(226, 199, 153, 0.35) !important;
  transform: none !important;
  box-shadow: -16px 0 50px rgba(0, 0, 0, 0.4) !important;
}

/* =========================================================================
   5. DRAGGABLE WINDOW HEADER (Clean Branded Lockup)
   ========================================================================= */
.ai-window-header {
  padding: 13px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(226, 199, 153, 0.28);
  background: linear-gradient(180deg, rgba(250, 247, 242, 0.7) 0%, transparent 100%);
  user-select: none;
  cursor: grab;
}

body.theme-dark .ai-window-header,
.theme-dark .ai-window-header {
  background: linear-gradient(180deg, rgba(24, 21, 18, 0.7) 0%, transparent 100%);
  border-bottom-color: rgba(226, 199, 153, 0.2);
}

.ai-window-header:active {
  cursor: grabbing;
}

.ai-header-drag-zone {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

/* Drag Grip Dots */
.ai-drag-grip {
  display: flex;
  gap: 3px;
  padding: 4px 2px;
  opacity: 0.35;
  transition: opacity 0.2s;
}

.ai-header-drag-zone:hover .ai-drag-grip {
  opacity: 0.75;
}

.ai-drag-grip span {
  width: 3px;
  height: 14px;
  border-radius: 999px;
  background: #C5A880;
}

/* Header Brand Lockup */
.ai-header-brand {
  display: flex;
  align-items: center;
  gap: 9px;
}

.ai-brand-mark {
  width: 22px;
  height: 22px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 6px rgba(226, 199, 153, 0.45));
}

.ai-header-title {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #1A1715;
  text-transform: uppercase;
}

body.theme-dark .ai-header-title,
.theme-dark .ai-header-title {
  color: #F5E6D3;
}

.ai-header-persona-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #8C6D3B;
  background: rgba(226, 199, 153, 0.16);
  border: 1px solid rgba(226, 199, 153, 0.38);
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
  line-height: 1.3;
}

body.theme-dark .ai-header-persona-tag,
.theme-dark .ai-header-persona-tag {
  color: #E2C799;
  background: rgba(226, 199, 153, 0.1);
  border-color: rgba(226, 199, 153, 0.28);
}

/* Header Control Buttons */
.ai-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-icon-btn {
  background: transparent;
  border: 1px solid rgba(226, 199, 153, 0.28);
  color: #6E6862;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.18s ease;
  font-size: 13px;
}

body.theme-dark .ai-icon-btn,
.theme-dark .ai-icon-btn {
  color: #A89D91;
  border-color: rgba(226, 199, 153, 0.22);
}

.ai-icon-btn:hover {
  background: rgba(226, 199, 153, 0.2);
  border-color: #E2C799;
  color: #1A1715;
  transform: translateY(-1px);
}

body.theme-dark .ai-icon-btn:hover,
.theme-dark .ai-icon-btn:hover {
  color: #F5E6D3;
}

.ai-icon-btn.ai-btn-close:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #EF4444;
}

/* =========================================================================
   6. STRATEGY PRESETS RAIL (Zero Emojis, Pure Haute Elegance)
   ========================================================================= */
.ai-presets-wrap {
  padding: 9px 14px;
  border-bottom: 1px solid rgba(226, 199, 153, 0.2);
  background: rgba(250, 247, 242, 0.45);
  overflow-x: auto;
  white-space: nowrap;
  display: flex;
  gap: 7px;
  scrollbar-width: none;
}

.ai-presets-wrap::-webkit-scrollbar {
  display: none;
}

body.theme-dark .ai-presets-wrap,
.theme-dark .ai-presets-wrap {
  background: rgba(18, 15, 13, 0.45);
  border-bottom-color: rgba(226, 199, 153, 0.16);
}

.ai-preset-chip {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(226, 199, 153, 0.4);
  font-size: 11px;
  font-weight: 600;
  color: #4A443E;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
  letter-spacing: 0.01em;
}

body.theme-dark .ai-preset-chip,
.theme-dark .ai-preset-chip {
  background: rgba(26, 22, 19, 0.7);
  color: #D6CEC5;
  border-color: rgba(226, 199, 153, 0.28);
}

.ai-preset-chip:hover {
  background: #E2C799;
  color: #080706;
  border-color: #E2C799;
  box-shadow: 0 3px 12px rgba(226, 199, 153, 0.35);
  transform: translateY(-1px);
}

/* =========================================================================
   7. MESSAGES CONTAINER & SCROLL VIEW
   ========================================================================= */
.ai-messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scrollbar-width: thin;
  scrollbar-color: rgba(226, 199, 153, 0.35) transparent;
}

.ai-messages-container::-webkit-scrollbar {
  width: 4px;
}

.ai-messages-container::-webkit-scrollbar-thumb {
  background: rgba(226, 199, 153, 0.35);
  border-radius: 999px;
}

/* Message Item */
.ai-message {
  display: flex;
  gap: 10px;
  animation: aiMsgFadeIn 0.22s ease-out;
}

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

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

.ai-msg-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.ai-message.assistant .ai-msg-avatar {
  background: transparent;
  border: none;
}

.ai-message.assistant .ai-msg-avatar img {
  width: 18px;
  height: 18px;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(226, 199, 153, 0.45));
}

.ai-message.user .ai-msg-avatar {
  background: #E2C799;
  color: #080706;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.ai-msg-body {
  max-width: 88%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Message Bubbles */
.ai-message.user .ai-msg-bubble {
  background: #1A1715;
  color: #FFFFFF;
  border: 1px solid rgba(226, 199, 153, 0.3);
  border-radius: 14px 14px 3px 14px;
  padding: 9px 14px;
  font-size: 12.5px;
  line-height: 1.5;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

body.theme-dark .ai-message.user .ai-msg-bubble,
.theme-dark .ai-message.user .ai-msg-bubble {
  background: #24201C;
  color: #FAF7F2;
  border-color: rgba(226, 199, 153, 0.35);
}

.ai-message.assistant .ai-msg-bubble {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(226, 199, 153, 0.38);
  border-radius: 14px;
  padding: 13px 16px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.04);
  font-size: 12.5px;
  line-height: 1.6;
  color: #1A1715;
}

body.theme-dark .ai-message.assistant .ai-msg-bubble,
.theme-dark .ai-message.assistant .ai-msg-bubble {
  background: rgba(22, 19, 16, 0.9);
  border-color: rgba(226, 199, 153, 0.25);
  color: #FAF7F2;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.35);
}

.ai-msg-bubble h1, .ai-msg-bubble h2, .ai-msg-bubble h3, .ai-msg-bubble h4 {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  font-style: italic;
  color: #8C6F4B;
  margin: 10px 0 4px;
}

body.theme-dark .ai-msg-bubble h1,
body.theme-dark .ai-msg-bubble h2,
body.theme-dark .ai-msg-bubble h3,
body.theme-dark .ai-msg-bubble h4,
.theme-dark .ai-msg-bubble h1,
.theme-dark .ai-msg-bubble h2,
.theme-dark .ai-msg-bubble h3,
.theme-dark .ai-msg-bubble h4 {
  color: #E2C799;
}

.ai-msg-bubble h3 { font-size: 15px; }
.ai-msg-bubble h4 { font-size: 14px; }

.ai-msg-bubble p {
  margin: 6px 0;
}

.ai-msg-bubble strong {
  font-weight: 700;
  color: #1A1715;
}

body.theme-dark .ai-msg-bubble strong,
.theme-dark .ai-msg-bubble strong {
  color: #F5E6D3;
}

.ai-msg-bubble ul, .ai-msg-bubble ol {
  margin: 6px 0;
  padding-left: 16px;
}

.ai-msg-bubble li {
  margin: 4px 0;
}

/* Metric / Operational Highlight Callout Box */
.ai-metric-highlight {
  border-left: 2.5px solid #E2C799;
  background: rgba(226, 199, 153, 0.08);
  padding: 8px 12px;
  margin: 8px 0;
  border-radius: 0 8px 8px 0;
  font-variant-numeric: tabular-nums;
}

/* =========================================================================
   8. STRATEGY CARD DECK SPAWNER (Structured Board Cards)
   ========================================================================= */
.ai-deck-spawner {
  margin-top: 4px;
  padding: 12px 14px;
  background: linear-gradient(135deg, rgba(226, 199, 153, 0.16) 0%, rgba(197, 168, 128, 0.06) 100%);
  border: 1px solid rgba(226, 199, 153, 0.5);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

.ai-deck-count-info {
  font-size: 11px;
  font-weight: 700;
  color: #8C6F4B;
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

body.theme-dark .ai-deck-count-info,
.theme-dark .ai-deck-count-info {
  color: #E2C799;
}

/* Mini Card Preview Stack */
.ai-deck-preview-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.ai-deck-preview-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(226, 199, 153, 0.35);
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
}

body.theme-dark .ai-deck-preview-item,
.theme-dark .ai-deck-preview-item {
  background: rgba(18, 15, 12, 0.85);
  border-color: rgba(226, 199, 153, 0.25);
  color: #F5E6D3;
}

.ai-deck-tag {
  font-size: 8.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(226, 199, 153, 0.25);
  color: #8C6F4B;
  flex-shrink: 0;
}

body.theme-dark .ai-deck-tag,
.theme-dark .ai-deck-tag {
  color: #E2C799;
}

.ai-deck-item-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

/* Primary Action Button */
.btn-add-to-canvas {
  background: linear-gradient(135deg, #E2C799 0%, #C5A880 100%);
  border: none;
  color: #080706;
  font-weight: 800;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 3px 12px rgba(197, 168, 128, 0.4);
  width: 100%;
}

.btn-add-to-canvas:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 5px 18px rgba(226, 199, 153, 0.55);
  filter: brightness(1.04);
}

.btn-add-to-canvas:disabled {
  opacity: 0.65;
  cursor: default;
  transform: none;
}

/* =========================================================================
   9. TYPING INDICATOR
   ========================================================================= */
.ai-typing-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 10px 14px;
}

.ai-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #C5A880;
  animation: aiBounce 1.4s infinite ease-in-out both;
}

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

@keyframes aiBounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* =========================================================================
   10. INPUT AREA (Minimal, Zero Clutter Footer)
   ========================================================================= */
.ai-input-area {
  padding: 12px 16px;
  border-top: 1px solid rgba(226, 199, 153, 0.25);
  background: rgba(255, 255, 255, 0.7);
}

body.theme-dark .ai-input-area,
.theme-dark .ai-input-area {
  background: rgba(14, 12, 10, 0.7);
  border-top-color: rgba(226, 199, 153, 0.18);
}

.ai-input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: rgba(250, 247, 242, 0.85);
  border: 1px solid rgba(226, 199, 153, 0.45);
  border-radius: 12px;
  padding: 8px 10px;
  transition: all 0.18s ease;
}

body.theme-dark .ai-input-wrapper,
.theme-dark .ai-input-wrapper {
  background: rgba(22, 19, 16, 0.85);
  border-color: rgba(226, 199, 153, 0.28);
}

.ai-input-wrapper:focus-within {
  border-color: #E2C799;
  box-shadow: 0 0 0 2px rgba(226, 199, 153, 0.25);
}

.ai-textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 12.5px;
  line-height: 1.45;
  color: inherit;
  resize: none;
  max-height: 110px;
  min-height: 22px;
}

.ai-textarea::placeholder {
  color: #9C958D;
}

body.theme-dark .ai-textarea::placeholder,
.theme-dark .ai-textarea::placeholder {
  color: #7A726A;
}

.ai-send-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: #1A1715;
  color: #E2C799;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.18s ease;
  flex-shrink: 0;
}

body.theme-dark .ai-send-btn,
.theme-dark .ai-send-btn {
  background: #E2C799;
  color: #080706;
}

.ai-send-btn:hover:not(:disabled) {
  transform: scale(1.05);
  background: #E2C799;
  color: #080706;
}

.ai-send-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* =========================================================================
   11. RESPONSIVE MOBILE ADAPTATION (< 768px)
   ========================================================================= */
@media (max-width: 768px) {
  .ai-copilot-window {
    right: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    top: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 70vh !important;
    max-height: 85vh !important;
    border-radius: 20px 20px 0 0 !important;
    border-bottom: none !important;
    border-left: none !important;
    border-right: none !important;
    transform: translateY(100%);
  }

  .ai-copilot-window.is-open {
    transform: translateY(0);
  }

  .ai-minimized-pill {
    bottom: 16px;
    right: 16px;
    padding: 6px 12px;
  }
}

/* =========================================================================
   SELECTION CONTEXT BADGE
   ========================================================================= */
.ai-selection-badge {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 8px;
  margin: 0 12px 6px;
  background: rgba(226, 199, 153, 0.12);
  border: 1px solid rgba(226, 199, 153, 0.4);
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  color: #E2C799;
  letter-spacing: 0.04em;
  line-height: 1;
  animation: aiBadgeFadeIn 0.2s ease;
}

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

.ai-selection-badge svg {
  flex-shrink: 0;
  stroke: #E2C799;
  opacity: 0.85;
}

.ai-selection-badge-clear {
  margin-left: auto;
  background: none;
  border: none;
  color: rgba(226, 199, 153, 0.6);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  border-radius: 4px;
  transition: color 0.15s ease;
}

.ai-selection-badge-clear:hover {
  color: #FFFFFF;
}

body.theme-dark .ai-selection-badge {
  background: rgba(226, 199, 153, 0.1);
  border-color: rgba(226, 199, 153, 0.35);
  color: #FFDF9E;
}
