/* ═══════════════════════════════════════════════════════════════════
   AICQ Design System — Unified Theme v1.0
   Shared across: chat.html, index.html, plugin-js/index.html
   ═══════════════════════════════════════════════════════════════════ */

/* ─── Design Tokens ──────────────────────────────────────────────── */
:root {
  /* Brand Colors */
  --accent:        #D97757;
  --accent-hover:  #C4613F;
  --accent-light:  rgba(217,119,87,0.10);
  --accent-soft:   rgba(217,119,87,0.18);
  --brown:         #8B6F4E;
  --brown-light:   rgba(139,111,78,0.10);

  /* Surfaces */
  --bg:            #FAF9F6;
  --bg-warm:       #F5F1EB;
  --bg-card:       #FFFFFF;

  /* Text */
  --text:          #2D2A26;
  --text-sec:      #6B6560;
  --text-muted:    #9B958E;

  /* Borders & Dividers */
  --beige:         #E8DFD3;
  --cream:         #F0EAE0;

  /* Semantic Colors */
  --green:         #4CAF7D;
  --green-light:   rgba(76,175,125,0.10);
  --red:           #E05555;
  --red-light:     rgba(224,85,85,0.10);
  --amber:         #E5A54B;
  --amber-light:   rgba(229,165,75,0.12);
  --blue:          #5B8DEF;
  --blue-light:    rgba(91,141,239,0.10);
  --purple:        #7B6CB0;
  --purple-light:  rgba(123,108,176,0.10);

  /* Chat Bubbles */
  --bubble-me:     #D97757;
  --bubble-them:   #FFFFFF;

  /* Shadows */
  --shadow-sm:     0 1px 3px rgba(45,42,38,0.06);
  --shadow-md:     0 4px 16px rgba(45,42,38,0.08);
  --shadow-lg:     0 8px 32px rgba(45,42,38,0.10);

  /* Radii */
  --radius:        12px;
  --radius-sm:     8px;
  --radius-lg:     20px;
  --radius-full:   9999px;

  /* Spacing */
  --space-xs:      4px;
  --space-sm:      8px;
  --space-md:      12px;
  --space-lg:      16px;
  --space-xl:      24px;
  --space-2xl:     32px;

  /* Typography */
  --font-sans:     'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:     'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;

  /* Transitions */
  --transition:    all 0.25s cubic-bezier(0.4,0,0.2,1);
  --transition-fast: all 0.15s cubic-bezier(0.4,0,0.2,1);

  /* Layout */
  --sidebar-w:     320px;
  --drawer-w:      380px;
}

/* ─── AICQ SVG Icon System ────────────────────────────────────────── */
.aicq-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}
.aicq-icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Icon sizes */
.aicq-icon-sm { width: 16px; height: 16px; }
.aicq-icon-md { width: 20px; height: 20px; }
.aicq-icon-lg { width: 24px; height: 24px; }
.aicq-icon-xl { width: 32px; height: 32px; }

/* ─── AICQ Logo ───────────────────────────────────────────────────── */
.aicq-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}
.aicq-logo-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--brown));
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.aicq-logo-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.aicq-logo-text {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 1px;
  background: linear-gradient(135deg, var(--accent), var(--brown));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ─── Unified Button System ───────────────────────────────────────── */
.aicq-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
  white-space: nowrap;
  font-family: var(--font-sans);
}
.aicq-btn:active { transform: scale(0.97); }

.aicq-btn-primary {
  background: var(--accent);
  color: #fff;
}
.aicq-btn-primary:hover { background: var(--accent-hover); }

.aicq-btn-secondary {
  background: var(--cream);
  color: var(--text);
}
.aicq-btn-secondary:hover { background: var(--beige); }

.aicq-btn-ghost {
  background: transparent;
  color: var(--text-sec);
}
.aicq-btn-ghost:hover { background: var(--cream); color: var(--text); }

.aicq-btn-danger {
  background: var(--red-light);
  color: var(--red);
}
.aicq-btn-danger:hover { background: var(--red); color: #fff; }

.aicq-btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-sec);
}
.aicq-btn-icon:hover { background: var(--cream); color: var(--text); }

/* ─── Emoji Picker ────────────────────────────────────────────────── */
.aicq-emoji-picker {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  width: 340px;
  max-height: 320px;
  background: var(--bg-card);
  border: 1px solid var(--beige);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: emojiPickerIn 0.2s ease;
}
.aicq-emoji-picker.open { display: flex; }

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

.aicq-emoji-tabs {
  display: flex;
  border-bottom: 1px solid var(--beige);
  padding: 0 4px;
  overflow-x: auto;
  flex-shrink: 0;
}
.aicq-emoji-tab {
  padding: 8px 10px;
  font-size: 16px;
  cursor: pointer;
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  transition: var(--transition-fast);
  flex-shrink: 0;
  line-height: 1;
}
.aicq-emoji-tab:hover { background: var(--cream); }
.aicq-emoji-tab.active { border-bottom-color: var(--accent); }

.aicq-emoji-search {
  padding: 6px 8px;
  border-bottom: 1px solid var(--beige);
  flex-shrink: 0;
}
.aicq-emoji-search input {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--beige);
  border-radius: var(--radius-sm);
  font-size: 13px;
  outline: none;
  background: var(--bg);
  transition: var(--transition-fast);
}
.aicq-emoji-search input:focus { border-color: var(--accent); }

.aicq-emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  padding: 6px;
  overflow-y: auto;
  flex: 1;
}
.aicq-emoji-grid::-webkit-scrollbar { width: 4px; }
.aicq-emoji-grid::-webkit-scrollbar-thumb { background: var(--beige); border-radius: 2px; }

.aicq-emoji-item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  font-size: 22px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
  border: none;
  background: none;
  padding: 0;
  line-height: 1;
}
.aicq-emoji-item:hover { background: var(--cream); transform: scale(1.15); }

/* ─── Scrollbar ───────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--beige); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ─── Toast / Notification ────────────────────────────────────────── */
.aicq-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  box-shadow: var(--shadow-md);
  z-index: 9999;
  animation: toastIn 0.3s ease;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}
