/* ==========================================================================
   АЛФАВИТ AI STUDIO — MODERN UI SYSTEM
   Version: 2.0
   Author: AI Design System
   ========================================================================== */

/* ==========================================================================
   CSS CUSTOM PROPERTIES (DESIGN TOKENS)
   ========================================================================== */
:root {
  /* === ЦВЕТОВАЯ ПАЛИТРА — СВЕТЛАЯ ТЕМА === */
  --bg-app: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-input: #f1f5f9;
  --bg-input-focus: #ffffff;
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-inverse: #ffffff;
  
  /* Акцентные цвета */
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-light: rgba(59, 130, 246, 0.1);
  --primary-glow: rgba(59, 130, 246, 0.25);
  
  --accent-purple: #8b5cf6;
  --accent-purple-hover: #7c3aed;
  --accent-purple-light: rgba(139, 92, 246, 0.1);
  --accent-purple-glow: rgba(139, 92, 246, 0.3);
  
  --accent-pink: #d946ef;
  --accent-pink-light: rgba(217, 70, 239, 0.1);
  
  --success: #10b981;
  --success-light: rgba(16, 185, 129, 0.1);
  
  --warning: #f59e0b;
  --warning-light: rgba(245, 158, 11, 0.1);
  
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --danger-light: rgba(239, 68, 68, 0.1);
  
  /* Границы и разделители */
  --border-color: #e2e8f0;
  --border-color-hover: #cbd5e1;
  --divider: #f1f5f9;
  
  /* Радиусы */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;
  
  /* Тени */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.03);
  --shadow-glow-primary: 0 0 20px var(--primary-glow);
  --shadow-glow-purple: 0 0 20px var(--accent-purple-glow);
  
  /* Переходы */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
  
  /* Размеры */
  --header-height: 64px;
  --sidebar-width: 340px;
  --container-max: 1200px;
  
  /* Типографика */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  
  /* Z-индексы */
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-modal-backdrop: 900;
  --z-modal: 1000;
  --z-toast: 1100;
  
  /* === SEEDREAM СПЕЦИФИЧНЫЕ === */
  --sd-bg-main: #09090b;
  --sd-bg-sidebar: #0f0f12;
  --sd-bg-panel: #18181b;
  --sd-bg-input: #27272a;
  --sd-bg-input-hover: #3f3f46;
  --sd-border: #27272a;
  --sd-border-hover: #3f3f46;
  --sd-text: #fafafa;
  --sd-text-muted: #a1a1aa;
  --sd-primary: #d946ef;
  --sd-primary-glow: rgba(217, 70, 239, 0.4);
  --sd-gradient: linear-gradient(135deg, #d946ef, #8b5cf6, #3b82f6);
}

/* === ТЁМНАЯ ТЕМА === */
[data-theme="dark"] {
  --bg-app: #0f172a;
  --bg-card: #1e293b;
  --bg-card-hover: #334155;
  --bg-input: #1e293b;
  --bg-input-focus: #334155;
  
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #64748b;
  
  --border-color: #334155;
  --border-color-hover: #475569;
  --divider: #1e293b;
  
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6);
}

/* ==========================================================================
   CSS RESET & BASE
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-app);
  min-height: 100vh;
  transition: background-color var(--transition-slow), color var(--transition-slow);
}

/* Убираем outline по умолчанию, добавим свой */
:focus {
  outline: none;
}

/* Красивый focus для accessibility */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Скрытый элемент для screen readers */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ==========================================================================
   TYPOGRAPHY
   ========================================================================== */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; margin-bottom: 1rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }

p { margin-bottom: 1rem; }

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--primary-hover);
}

.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }

.muted {
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* ==========================================================================
   HEADER & NAVIGATION TABS
   ========================================================================== */
.tabs {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  flex-wrap: wrap;
}

/* Разделитель в табах */
.vr-separator {
  width: 1px;
  height: 24px;
  background: var(--border-color);
  margin: 0 4px;
  flex-shrink: 0;
}

.tabs-spacer {
  flex: 1;
  min-width: 20px;
}

/* Кнопка таба */
.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
  white-space: nowrap;
}

.tab-btn i {
  font-size: 1rem;
  transition: transform var(--transition-base);
}

.tab-btn:hover {
  color: var(--text-primary);
  background: var(--bg-input);
}

.tab-btn:hover i {
  transform: scale(1.1);
}

.tab-btn.active {
  color: var(--text-inverse);
  background: var(--text-primary);
  box-shadow: var(--shadow-md);
}

/* Специальные стили для Seedream таба */
.tab-btn.tab-seedream {
  color: var(--accent-purple);
}

.tab-btn.tab-seedream:hover {
  background: var(--accent-purple-light);
  color: var(--accent-purple);
}

.tab-btn.tab-seedream.active {
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-pink));
  color: white;
  box-shadow: var(--shadow-glow-purple);
}

/* Специальные стили для Gemini таба */
.tab-btn.tab-gemini {
  color: var(--primary);
}

.tab-btn.tab-gemini:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.tab-btn.tab-gemini.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: white;
  box-shadow: var(--shadow-glow-primary);
}

/* Кнопка выхода */
.logout {
  padding: 10px 16px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--danger);
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
}

.logout:hover {
  background: var(--danger-light);
  color: var(--danger-hover);
}

/* ==========================================================================
   BUTTONS SYSTEM
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.4;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
  white-space: nowrap;
  user-select: none;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn i {
  font-size: 1em;
  transition: transform var(--transition-fast);
}

.btn:hover i {
  transform: scale(1.1);
}

.btn:active {
  transform: scale(0.98);
}

/* Варианты кнопок */
.btn.primary {
  color: white;
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  box-shadow: 0 4px 14px var(--primary-glow);
}

.btn.primary:hover {
  box-shadow: 0 6px 20px var(--primary-glow);
  transform: translateY(-1px);
}

.btn.accent {
  color: white;
  background: linear-gradient(135deg, var(--warning), #d97706);
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.3);
}

.btn.accent:hover {
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
  transform: translateY(-1px);
}

.btn.danger {
  color: white;
  background: linear-gradient(135deg, var(--danger), var(--danger-hover));
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3);
}

.btn.danger:hover {
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
  transform: translateY(-1px);
}

.btn.success {
  color: white;
  background: linear-gradient(135deg, var(--success), #059669);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

.btn.ghost {
  color: var(--text-secondary);
  background: transparent;
  border-color: var(--border-color);
}

.btn.ghost:hover {
  color: var(--text-primary);
  background: var(--bg-input);
  border-color: var(--border-color-hover);
}

/* Размеры кнопок */
.btn.btn-sm {
  padding: 6px 12px;
  font-size: 0.8125rem;
}

.btn.btn-lg {
  padding: 14px 28px;
  font-size: 1rem;
}

.btn.btn-icon {
  padding: 10px;
  width: 40px;
  height: 40px;
}

.btn.btn-icon.btn-sm {
  padding: 6px;
  width: 32px;
  height: 32px;
}
/* ==========================================================================
   FORMS & INPUTS
   ========================================================================== */
.row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.row-inline {
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

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

label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Базовые инпуты */
input[type="text"],
input[type="number"],
input[type="date"],
input[type="email"],
input[type="password"],
select,
textarea {
  width: 100%;
  padding: 12px 16px;
  font-family: inherit;
  font-size: 0.9375rem;
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--border-color-hover);
}

input:focus,
select:focus,
textarea:focus {
  background: var(--bg-input-focus);
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-light);
}

textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.6;
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

/* File input styling */
input[type="file"] {
  padding: 10px;
  font-size: 0.875rem;
  cursor: pointer;
}

input[type="file"]::file-selector-button {
  padding: 8px 16px;
  margin-right: 12px;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-base);
}

input[type="file"]::file-selector-button:hover {
  background: var(--bg-input);
  border-color: var(--border-color-hover);
}

/* ==========================================================================
   CARDS & CONTAINERS
   ========================================================================== */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 24px 20px;
}

.container-fluid {
  width: 100%;
  padding: 0 20px;
}

.classic-tabs-wrap {
  padding-top: 24px;
  animation: slideUp 0.4s ease-out;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-base), border-color var(--transition-base);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card h2 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--divider);
}

.card h2 i {
  color: var(--primary);
}

.card h3 {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--divider);
}

/* Tab sections */
.tab {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab.active {
  display: block;
}

/* Actions row */
.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 8px;
}

/* Status messages */
.status {
  padding: 12px 16px;
  margin-top: 16px;
  font-size: 0.875rem;
  border-radius: var(--radius-md);
  background: var(--bg-input);
  color: var(--text-secondary);
}

.status:empty {
  display: none;
}

/* Result blocks */
.result {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px;
  margin-top: 16px;
  background: var(--success-light);
  border: 1px solid var(--success);
  border-radius: var(--radius-md);
}

/* Share blocks */
.share {
  margin-top: 16px;
  padding: 16px;
  background: var(--bg-input);
  border-radius: var(--radius-md);
}

.share-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.share-row a {
  word-break: break-all;
  flex: 1;
  min-width: 200px;
}

/* ==========================================================================
   PROGRESS BAR
   ========================================================================== */
.progress-wrap {
  margin-top: 16px;
}

.progress {
  height: 8px;
  background: var(--bg-input);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent-purple));
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 0.8125rem;
  color: var(--text-muted);
}
/* ==========================================================================
   SEEDREAM INTERFACE (STUDIO MODE)
   ========================================================================== */
.sd-interface {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  height: calc(100vh - var(--header-height));
  background: var(--sd-bg-main);
  color: var(--sd-text);
  overflow: hidden;
}

/* === SIDEBAR === */
.sd-sidebar {
  background: var(--sd-bg-sidebar);
  border-right: 1px solid var(--sd-border);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--sd-border) transparent;
}

.sd-header {
  display: flex;
  align-items: center;
  gap: 14px;
}

.sd-logo-icon {
  width: 48px;
  height: 48px;
  background: var(--sd-gradient);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: white;
  box-shadow: 0 0 24px var(--sd-primary-glow);
  flex-shrink: 0;
}

.sd-header h3 {
  margin: 0;
  padding: 0;
  border: none;
  font-size: 1.125rem;
  font-weight: 800;
  color: var(--sd-text);
}

.sd-sub {
  font-size: 0.6875rem;
  color: var(--sd-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 2px;
}

/* === SECTIONS === */
.sd-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sd-label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--sd-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* === MODEL SELECTOR === */
.sd-model-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.sd-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 12px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--sd-text-muted);
  background: var(--sd-bg-panel);
  border: 1px solid var(--sd-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
}

.sd-chip i {
  font-size: 1rem;
}

.sd-chip:hover {
  color: var(--sd-text);
  background: var(--sd-bg-input);
  border-color: var(--sd-border-hover);
}

.sd-chip.active {
  color: #e9d5ff;
  background: rgba(139, 92, 246, 0.15);
  border-color: var(--accent-purple);
  box-shadow: 0 0 16px rgba(139, 92, 246, 0.15);
}

/* === MODE TABS (T2I / I2I) === */
.sd-tabs-pill {
  display: flex;
  background: var(--sd-bg-input);
  border-radius: var(--radius-md);
  padding: 4px;
  gap: 4px;
}

.sd-pill {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--sd-text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-base);
}

.sd-pill:hover {
  color: var(--sd-text);
}

.sd-pill.active {
  color: white;
  background: var(--sd-gradient);
  box-shadow: 0 2px 8px var(--sd-primary-glow);
}

.sd-pill i {
  font-size: 0.875rem;
}

/* === IMAGE SLOTS === */
.sd-slots-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.sd-slot {
  aspect-ratio: 1;
  background: var(--sd-bg-input);
  border: 2px dashed var(--sd-border-hover);
  border-radius: var(--radius-md);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all var(--transition-base);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sd-slot:hover {
  border-color: var(--sd-primary);
  background: var(--sd-bg-input-hover);
  transform: translateY(-2px);
}

.sd-slot-empty i {
  font-size: 1.5rem;
  color: var(--sd-text-muted);
  transition: all var(--transition-base);
}

.sd-slot:hover .sd-slot-empty i {
  color: var(--sd-primary);
  transform: scale(1.15);
}

.sd-slot-number {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 22px;
  height: 22px;
  background: rgba(0, 0, 0, 0.7);
  color: var(--sd-text-muted);
  font-size: 0.625rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 5;
}

.sd-slot-filled {
  width: 100%;
  height: 100%;
  position: relative;
}

.sd-slot-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  animation: fadeIn var(--transition-slow);
}

.sd-slot-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  background: var(--danger);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  opacity: 0;
  transform: scale(0.8);
  transition: all var(--transition-base);
  z-index: 10;
}

.sd-slot:hover .sd-slot-remove {
  opacity: 1;
  transform: scale(1);
}

.sd-slot-remove:hover {
  background: var(--danger-hover);
  transform: scale(1.1) !important;
}

/* === TEXTAREA === */
.sd-textarea {
  width: 100%;
  min-height: 120px;
  padding: 14px 16px;
  font-family: inherit;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--sd-text);
  background: var(--sd-bg-input);
  border: 1px solid var(--sd-border);
  border-radius: var(--radius-md);
  resize: none;
  transition: all var(--transition-base);
}

.sd-textarea::placeholder {
  color: var(--sd-text-muted);
}

.sd-textarea:hover {
  border-color: var(--sd-border-hover);
}

.sd-textarea:focus {
  border-color: var(--sd-primary);
  box-shadow: 0 0 0 3px rgba(217, 70, 239, 0.15);
  outline: none;
}

.sd-char-count {
  font-size: 0.6875rem;
  color: var(--sd-text-muted);
  text-align: right;
  margin-top: 4px;
}

/* === SELECT === */
.sd-select-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sd-select-wrap label {
  font-size: 0.625rem;
  color: var(--sd-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sd-select {
  width: 100%;
  padding: 10px 14px;
  padding-right: 36px;
  font-family: inherit;
  font-size: 0.8125rem;
  color: var(--sd-text);
  background: var(--sd-bg-input);
  border: 1px solid var(--sd-border);
  border-radius: var(--radius-sm);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23a1a1aa' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
  transition: all var(--transition-base);
}

.sd-select:hover {
  border-color: var(--sd-border-hover);
}

.sd-select:focus {
  border-color: var(--sd-primary);
  outline: none;
}

.sd-settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* === GENERATE BUTTON === */
.sd-actions {
  margin-top: auto;
  padding-top: 16px;
}

.sd-btn-generate {
  width: 100%;
  padding: 16px 24px;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: white;
  background: var(--sd-gradient);
  background-size: 200% auto;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: 0 8px 24px var(--sd-primary-glow);
  transition: all var(--transition-base);
}

.sd-btn-generate:hover {
  background-position: right center;
  transform: translateY(-2px);
  box-shadow: 0 12px 32px var(--sd-primary-glow);
}

.sd-btn-generate:active {
  transform: translateY(0);
}

.sd-btn-generate:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* === STATUS BOX === */
.sd-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px;
  margin-top: 16px;
  background: var(--sd-bg-panel);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  color: var(--sd-text-muted);
}

/* === MAIN GALLERY AREA === */
.sd-main-area {
  padding: 32px 40px;
  background: var(--sd-bg-main);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--sd-border) transparent;
}

.sd-top-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.sd-top-bar h2 {
  margin: 0;
  padding: 0;
  border: none;
  font-size: 1.5rem;
  color: var(--sd-text);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sd-top-bar h2 i {
  color: var(--sd-primary);
}

.sd-top-actions {
  display: flex;
  gap: 8px;
}

.sd-pill-small {
  padding: 8px 14px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--sd-text-muted);
  background: var(--sd-bg-panel);
  border: 1px solid var(--sd-border);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-base);
}

.sd-pill-small:hover {
  color: var(--sd-text);
  border-color: var(--sd-border-hover);
}

.sd-pill-small.active {
  color: white;
  background: var(--sd-primary);
  border-color: var(--sd-primary);
}

.sd-btn-history {
  margin-left: auto;
  padding: 10px 16px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--sd-text-muted);
  background: var(--sd-bg-panel);
  border: 1px solid var(--sd-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
}

.sd-btn-history:hover {
  color: var(--sd-text);
  border-color: var(--sd-border-hover);
}

/* === GALLERY GRID === */
.sd-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

.sd-empty-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 40px;
  color: var(--sd-text-muted);
  text-align: center;
}

.sd-empty-state i {
  font-size: 4rem;
  margin-bottom: 20px;
  opacity: 0.3;
}

.sd-empty-state p {
  font-size: 1rem;
  margin: 0;
}

/* === RESULT CARD === */
.sd-card {
  background: var(--sd-bg-panel);
  border: 1px solid var(--sd-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition-base);
}

.sd-card:hover {
  border-color: var(--sd-border-hover);
  transform: translateY(-4px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.sd-card.fade-in {
  animation: cardFadeIn 0.4s ease-out;
}

.sd-image-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  background: #000;
  cursor: zoom-in;
}

.sd-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.sd-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  opacity: 0;
  transition: opacity var(--transition-base);
}

.sd-card:hover .sd-overlay {
  opacity: 1;
}

.sd-icon-btn {
  width: 48px;
  height: 48px;
  background: white;
  color: #000;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1.125rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-base);
}

.sd-icon-btn:hover {
  background: var(--sd-primary);
  color: white;
  transform: scale(1.1) rotate(5deg);
}

.sd-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-top: 1px solid var(--sd-border);
}

.sd-time {
  font-size: 0.75rem;
  color: var(--sd-text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.sd-tag {
  padding: 4px 10px;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--sd-primary);
  background: rgba(217, 70, 239, 0.15);
  border-radius: var(--radius-full);
}

/* === PLACEHOLDER PULSE === */
.sd-placeholder-pulse {
  animation: pulse 1.5s ease-in-out infinite;
}

.sd-pulse-loader {
  width: 48px;
  height: 48px;
  border: 4px solid var(--sd-border);
  border-top-color: var(--sd-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* ==========================================================================
   GEMINI CHAT INTERFACE
   ========================================================================== */
.gm-chat-container {
  display: flex;
  height: calc(100vh - var(--header-height) - 40px);
  margin: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.4s ease-out;
}

/* === SIDEBAR === */
.gm-sidebar {
  width: 280px;
  background: var(--bg-input);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.gm-sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
}

.gm-btn-new-chat {
  width: 100%;
  padding: 14px 20px;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  background: var(--bg-card);
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all var(--transition-base);
}

.gm-btn-new-chat:hover {
  color: white;
  background: var(--primary);
  border-color: var(--primary);
  border-style: solid;
}

.gm-btn-new-chat i {
  font-size: 1rem;
}

.gm-history-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.gm-history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 6px;
  font-size: 0.875rem;
  color: var(--text-secondary);
  background: transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
}

.gm-history-item:hover {
  color: var(--text-primary);
  background: var(--bg-card);
}

.gm-history-item.active {
  color: var(--primary);
  background: var(--primary-light);
  font-weight: 600;
}

.gm-chat-name {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.gm-del-chat {
  font-size: 0.75rem;
  color: var(--text-muted);
  opacity: 0;
  transition: all var(--transition-fast);
}

.gm-history-item:hover .gm-del-chat {
  opacity: 1;
}

.gm-del-chat:hover {
  color: var(--danger);
}

/* === MAIN CHAT === */
.gm-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-app);
  min-width: 0;
}

.gm-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
}

.gm-header-info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.gm-header-info > i {
  font-size: 1.5rem;
  color: var(--primary);
}

.gm-header-info h3 {
  margin: 0;
  padding: 0;
  border: none;
  font-size: 1.125rem;
}

/* === MESSAGES === */
.gm-messages {
  flex: 1;
  overflow-y: auto;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.gm-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 40px;
  color: var(--text-secondary);
}

.gm-welcome h2 {
  margin-bottom: 12px;
  border: none;
  padding: 0;
}

.gm-welcome p {
  max-width: 400px;
  color: var(--text-muted);
}

.msg {
  max-width: 75%;
  padding: 16px 20px;
  font-size: 0.9375rem;
  line-height: 1.65;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  animation: messageFadeIn 0.3s ease-out;
}

.msg-user {
  align-self: flex-end;
  color: white;
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  border-bottom-right-radius: 4px;
}

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

/* === INPUT AREA === */
.gm-input-area {
  padding: 20px 32px;
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
}

.gm-input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  max-width: 900px;
  margin: 0 auto;
}

.gm-input-wrapper textarea {
  flex: 1;
  min-height: 52px;
  max-height: 180px;
  padding: 14px 18px;
  font-family: inherit;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  resize: none;
  transition: all var(--transition-base);
}

.gm-input-wrapper textarea:focus {
  background: var(--bg-input-focus);
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-light);
  outline: none;
}

.gm-input-wrapper button {
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1.125rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-base);
  flex-shrink: 0;
}

.gm-input-wrapper button:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-glow-primary);
}

.gm-input-wrapper button:active {
  transform: scale(0.98);
}

/* === VOICE INPUT BUTTON === */
.gm-mic-btn {
  width: 52px;
  height: 52px;
  background: var(--bg-input);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 1.125rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-base);
  flex-shrink: 0;
}

.gm-mic-btn:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-light);
}

.gm-mic-btn.recording {
  color: white;
  background: var(--danger);
  border-color: var(--danger);
  animation: micPulse 1s ease-in-out infinite;
}

/* === PHOTO INPUT BUTTON === */
.gm-photo-btn {
  width: 52px;
  height: 52px;
  background: var(--bg-input);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 1.125rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-base);
  flex-shrink: 0;
}

.gm-photo-btn:hover {
  color: var(--success);
  border-color: var(--success);
  background: var(--success-light);
}

.gm-photo-btn.has-photo {
  color: white;
  background: var(--success);
  border-color: var(--success);
}

/* === INPUT CONTAINER WITH PREVIEW === */
.gm-input-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.gm-photo-preview {
  display: none;
  position: relative;
  max-width: 200px;
}

.gm-photo-preview.active {
  display: block;
}

.gm-photo-preview img {
  max-width: 100%;
  max-height: 150px;
  border-radius: var(--radius-md);
  border: 2px solid var(--success);
}

.gm-photo-remove {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 24px;
  height: 24px;
  background: var(--danger);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 0.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-base);
}

.gm-photo-remove:hover {
  background: var(--danger-hover);
  transform: scale(1.1);
}

/* Image in chat message */
.gm-msg-image {
  max-width: 280px;
  max-height: 200px;
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  display: block;
  object-fit: cover;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.gm-msg-image:hover {
  transform: scale(1.02);
}

.msg-user .gm-msg-image {
  margin-left: auto;
  border: 2px solid rgba(255, 255, 255, 0.2);
}

/* Ограничение ширины сообщения с картинкой */
.msg-user:has(.gm-msg-image) {
  max-width: 320px;
}

/* Message with image */
.msg-image {
  max-width: 300px;
  border-radius: var(--radius-md);
  margin-bottom: 8px;
}

@keyframes micPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50% { transform: scale(1.05); box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}

/* ==========================================================================
   TABLES
   ========================================================================== */
.table-wrap,
.data-table-container {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-top: 16px;
}

.table,
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
}

.table th,
.data-table th {
  padding: 14px 16px;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--bg-input);
  border-bottom: 2px solid var(--border-color);
  text-align: left;
}

.table td,
.data-table td {
  padding: 14px 16px;
  font-size: 0.875rem;
  color: var(--text-primary);
  border-bottom: 1px solid var(--divider);
  vertical-align: middle;
}

.table tr:last-child td,
.data-table tr:last-child td {
  border-bottom: none;
}

.table tr:hover td,
.data-table tr:hover td {
  background: var(--bg-input);
}

/* Status badges */
.status-badge {
  display: inline-block;
  padding: 5px 12px;
  font-size: 0.6875rem;
  font-weight: 700;
  border-radius: var(--radius-full);
}

.status-success {
  color: var(--success);
  background: var(--success-light);
}

.status-warning {
  color: var(--warning);
  background: var(--warning-light);
}

.status-danger {
  color: var(--danger);
  background: var(--danger-light);
}

/* ==========================================================================
   MODAL & LIGHTBOX
   ========================================================================== */
.sd-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(12px);
  padding: 40px;
  align-items: center;
  justify-content: center;
  animation: fadeIn var(--transition-base);
}

.sd-modal-content {
  max-width: 95%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.8);
}

.sd-modal-close {
  position: absolute;
  top: 24px;
  right: 32px;
  font-size: 2.5rem;
  color: white;
  cursor: pointer;
  transition: all var(--transition-base);
  line-height: 1;
}

.sd-modal-close:hover {
  color: var(--sd-primary);
  transform: rotate(90deg);
}

#sdLightboxCaption {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--sd-text-muted);
  font-size: 0.875rem;
  text-align: center;
}

/* ==========================================================================
   LOADERS & ANIMATIONS
   ========================================================================== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

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

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

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

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Generic loaders */
.loading-spinner,
.sd-loader {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.sd-loader {
  border-color: var(--sd-border);
  border-top-color: var(--sd-primary);
}

/* ==========================================================================
   SCROLLBAR CUSTOMIZATION
   ========================================================================== */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 10px;
  border: 3px solid transparent;
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
  background-clip: padding-box;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: var(--border-color);
  background-clip: padding-box;
}

[data-theme="light"] .nav-dropdown-menu {
  background: #ffffff;
  border-color: #e5e7eb;
}

[data-theme="light"] .nav-dropdown-menu .tab-btn {
  color: #374151;
}

[data-theme="light"] .nav-dropdown-menu .tab-btn:hover {
  background: #f3f4f6;
  color: #111827;
}


/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 1024px) {
  .sd-interface {
    grid-template-columns: 1fr;
    height: auto;
    min-height: calc(100vh - var(--header-height));
  }
  
  .sd-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--sd-border);
    max-height: none;
  }
  
  .sd-main-area {
    min-height: 60vh;
  }
  
  .gm-sidebar {
    display: none;
  }
  
  .gm-chat-container {
    margin: 12px;
    height: calc(100vh - var(--header-height) - 24px);
  }
}

@media (max-width: 768px) {
  :root {
    --header-height: 56px;
  }
  
  .tabs {
    padding: 10px 12px;
    gap: 6px;
  }
  
  .tab-btn {
    padding: 8px 12px;
    font-size: 0.8125rem;
  }
  
  .tab-btn span {
    display: none;
  }
  
  .vr-separator {
    display: none;
  }
  
  .container,
  .container-fluid {
    padding-left: 12px;
    padding-right: 12px;
  }
  
  .card {
    padding: 16px;
    border-radius: var(--radius-md);
  }
  
  .sd-sidebar {
    padding: 16px;
    gap: 16px;
  }
  
  .sd-main-area {
    padding: 20px 16px;
  }
  
  .sd-gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
  }
  
  .gm-messages {
    padding: 20px 16px;
  }
  
  .gm-input-area {
    padding: 16px;
  }
  
  .msg {
    max-width: 90%;
    padding: 12px 16px;
  }
}

@media (max-width: 480px) {
  .tabs {
    justify-content: center;
  }
  
  .tabs-spacer {
    display: none;
  }
  
  .logout {
    position: absolute;
    right: 12px;
  }
  
  .sd-slots-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  
  .sd-settings-grid {
    grid-template-columns: 1fr;
  }
  
  .sd-gallery-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   GEMINI IMAGE TAB STYLES
   ========================================================================== */

/* Стиль кнопки таба Gemini Image */
.tab-btn.tab-gemini-image {
  color: #667eea;
}

.tab-btn.tab-gemini-image:hover {
  background: rgba(102, 126, 234, 0.1);
  color: #667eea;
}

.tab-btn.tab-gemini-image.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  box-shadow: 0 0 20px rgba(102, 126, 234, 0.4);
}

/* Gemini Image Upload Slot */
.gi-image-slot {
  width: 100%;
  aspect-ratio: 16/10;
  background: var(--sd-bg-input);
  border: 2px dashed var(--sd-border-hover);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all var(--transition-base);
}

.gi-image-slot:hover {
  border-color: #667eea;
  background: var(--sd-bg-input-hover);
}

.gi-slot-empty {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  cursor: pointer;
  color: var(--sd-text-muted);
  transition: all var(--transition-base);
}

.gi-slot-empty i {
  font-size: 2.5rem;
  transition: transform var(--transition-base);
}

.gi-slot-empty span {
  font-size: 0.875rem;
  font-weight: 500;
}

.gi-slot-empty:hover {
  color: #667eea;
}

.gi-slot-empty:hover i {
  transform: scale(1.1);
}

.gi-slot-filled {
  width: 100%;
  height: 100%;
  position: relative;
}

.gi-slot-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.gi-slot-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  background: var(--danger);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  opacity: 0;
  transform: scale(0.8);
  transition: all var(--transition-base);
  z-index: 10;
}

.gi-slot-filled:hover .gi-slot-remove {
  opacity: 1;
  transform: scale(1);
}

.gi-slot-remove:hover {
  background: var(--danger-hover);
  transform: scale(1.1) !important;
}

/* Gemini Image Empty State */
.gi-empty-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 40px;
  color: var(--sd-text-muted);
  text-align: center;
}

.gi-empty-state i {
  font-size: 4rem;
  margin-bottom: 20px;
  opacity: 0.3;
  background: linear-gradient(135deg, #667eea, #764ba2);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Edit button style for Gemini Image cards */
.gi-edit-btn:hover {
  background: #667eea !important;
}

/* Gemini Image — Grid для 14 слотов (7 колонок × 2 ряда) */
.gi-slots-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

/* Адаптивность для Gemini Image slots */
@media (max-width: 768px) {
  .gi-slots-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 480px) {
  .gi-slots-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.gi-slot {
  aspect-ratio: 1;
  background: var(--sd-bg-input);
  border: 2px dashed var(--sd-border-hover);
  border-radius: var(--radius-md);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all var(--transition-base);
  display: flex;
  align-items: center;
  justify-content: center;
}

.gi-slot:hover {
  border-color: #667eea;
  background: var(--sd-bg-input-hover);
  transform: translateY(-2px);
}

.gi-slot-empty i {
  font-size: 1.25rem;
  color: var(--sd-text-muted);
  transition: all var(--transition-base);
}

.gi-slot:hover .gi-slot-empty i {
  color: #667eea;
  transform: scale(1.15);
}

.gi-slot-number {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 18px;
  height: 18px;
  background: rgba(0, 0, 0, 0.7);
  color: var(--sd-text-muted);
  font-size: 0.5rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  z-index: 5;
}

.gi-slot-filled {
  width: 100%;
  height: 100%;
  position: relative;
}

.gi-slot-filled img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gi-slot-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  background: var(--danger);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  opacity: 0;
  transition: all var(--transition-base);
  z-index: 10;
}

.gi-slot:hover .gi-slot-remove {
  opacity: 1;
}

/* Кнопка "Edit in Gemini" на карточках Seedream */
.sd-gemini-edit-btn {
  background: linear-gradient(135deg, #667eea, #764ba2) !important;
}

.sd-gemini-edit-btn:hover {
  box-shadow: 0 0 16px rgba(102, 126, 234, 0.5) !important;
}

/* ==========================================================================
   PRINT STYLES
   ========================================================================== */
@media print {
  .tabs,
  .sd-sidebar,
  .gm-sidebar,
  .gm-input-area,
  .btn,
  .sd-overlay {
    display: none !important;
  }
  
  body {
    background: white;
    color: black;
  }
  
  .card {
    box-shadow: none;
    border: 1px solid #ddd;
  }
}

/* Кнопка "Загрузить ещё" */
.gi-load-more {
  grid-column: 1 / -1;
  padding: 12px 24px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  margin-top: 16px;
}

.gi-load-more:hover {
  background: var(--primary-dark, #1557b0);
  transform: translateY(-1px);
}

.gi-load-more:active {
  transform: translateY(0);
}

/* ============================================================================
   SEEDREAM REAL — BytePlus Official API
   ============================================================================ */

/* Tab Button Accent */
.tab-btn.tab-seedream-real {
  color: #f97316;
}

.tab-btn.tab-seedream-real:hover {
  background: rgba(249, 115, 22, 0.1);
  color: #f97316;
}

.tab-btn.tab-seedream-real.active {
  background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
  color: white;
  box-shadow: 0 0 20px rgba(249, 115, 22, 0.4);
}

/* Image Preview Area */
.sr-image-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border: 2px dashed var(--sd-border-hover);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition-base);
  background: var(--sd-bg-input);
}

.sr-image-preview:hover {
  border-color: #f97316;
  background: var(--sd-bg-input-hover);
}

.sr-upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 12px;
  color: var(--sd-text-muted);
}

.sr-upload-placeholder i {
  font-size: 2.5rem;
  opacity: 0.6;
  transition: all var(--transition-base);
}

.sr-upload-placeholder p {
  font-size: 0.875rem;
  margin: 0;
}

.sr-image-preview:hover .sr-upload-placeholder i {
  color: #f97316;
  transform: scale(1.1);
}

.sr-image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sr-remove-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--danger);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-base);
  z-index: 10;
}

.sr-remove-btn:hover {
  background: var(--danger-hover);
  transform: scale(1.1);
}

/* Empty State */
.sr-empty-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 40px;
  color: var(--sd-text-muted);
  text-align: center;
}

.sr-empty-state i {
  font-size: 4rem;
  margin-bottom: 20px;
  opacity: 0.4;
  color: #f97316;
}

.sr-empty-state p {
  font-size: 1rem;
  margin: 0;
}
/* ============================================================================
   SEEDREAM REAL — 14 Slots Grid (как Seedream AI)
   ============================================================================ */

/* Grid для 14 слотов — 7 колонок по 2 ряда */
.sr-slots-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

/* Каждый слот */
.sr-slot {
  aspect-ratio: 1;
  background: var(--sd-bg-input);
  border: 2px dashed var(--sd-border-hover);
  border-radius: var(--radius-sm);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all var(--transition-base);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sr-slot:hover {
  border-color: #f97316;
  background: var(--sd-bg-input-hover);
  transform: translateY(-2px);
}

.sr-slot-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.sr-slot-empty i {
  font-size: 1.25rem;
  color: var(--sd-text-muted);
  transition: all var(--transition-base);
}

.sr-slot:hover .sr-slot-empty i {
  color: #f97316;
  transform: scale(1.15);
}

.sr-slot-number {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 18px;
  height: 18px;
  background: rgba(0, 0, 0, 0.7);
  color: var(--sd-text-muted);
  font-size: 0.5rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  z-index: 5;
}

.sr-slot-filled {
  width: 100%;
  height: 100%;
  position: relative;
}

.sr-slot-filled img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sr-slot-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  background: var(--danger);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  opacity: 0;
  transition: all var(--transition-base);
  z-index: 10;
}

.sr-slot:hover .sr-slot-remove {
  opacity: 1;
}

.sr-slot-remove:hover {
  background: var(--danger-hover);
  transform: scale(1.1);
}

/* Адаптивность для мобильных */
@media (max-width: 768px) {
  .sr-slots-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 480px) {
  .sr-slots-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
/* ===== ТЫЛЬНАЯ СТОРОНА ОБЛОЖКИ ===== */

.back-side-layer {
    position: absolute;
    left: 0;
    top: 0;
    width: 48%;
    height: 100%;
    pointer-events: none;
    z-index: 20;
}

.back-side-content {
    position: absolute;
    left: 10%;
    right: 10%;
    top: 12%;
    bottom: 12%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
}

.back-logo {
    width: 35%;
    max-width: 150px;
}

.back-logo img {
    width: 100%;
    height: auto;
}

.back-text-block {
    text-align: center;
    color: #333;
}

.back-text-line {
    font-family: 'Montserrat', sans-serif;
    font-size: 12px;
    font-weight: 600;
    margin: 0 0 5px 0;
}

.back-text-site {
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    font-weight: 700;
    margin: 0;
}

.child-name-display {
    color: #e94560;
}

.back-qr {
    width: 40%;
    max-width: 120px;
}

.back-qr img {
    width: 100%;
    height: auto;
}

.back-text-bottom {
    text-align: center;
    color: #333;
}

.back-text-bottom p {
    font-family: 'Montserrat', sans-serif;
    font-size: 10px;
    margin: 2px 0;
}

/* Слой названия */
.cover-title-layer {
    position: absolute;
    z-index: 30;
    cursor: move;
    user-select: none;
    max-width: 45%;
}

.cover-title-layer .neon-text {
    font-family: 'Gagalin', sans-serif;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2px;
    line-height: 1.1;
}

/* Фон с возможностью двигать */
.background-wrapper {
    transition: none;
}

.background-wrapper:active {
    cursor: grabbing;
}

/* Превью обложки */
.cover-preview {
    background: #fff;
    overflow: hidden;
}
/* ============================================
   NAVIGATION DROPDOWNS - PREMIUM DESIGN
   ============================================ */

.nav-dropdown {
  position: relative;
}

.nav-dropdown-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: transparent;
  border: none;
  border-radius: var(--radius-lg);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.nav-dropdown-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.nav-dropdown-btn:hover::before {
  opacity: 1;
}

.nav-dropdown-btn:hover {
  transform: translateY(-2px);
}

.nav-dropdown-btn .nav-arrow {
  font-size: 0.625rem;
  transition: transform 0.3s ease;
  opacity: 0.6;
}

.nav-dropdown.open .nav-arrow {
  transform: rotate(180deg);
}

/* === AI GENERATION — Purple/Pink Gradient === */
#navAI .nav-dropdown-btn {
  color: #a855f7;
}
#navAI .nav-dropdown-btn::before {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.15), rgba(236, 72, 153, 0.15));
}
#navAI .nav-dropdown-btn:hover {
  color: #c084fc;
  text-shadow: 0 0 20px rgba(168, 85, 247, 0.5);
}
#navAI .nav-dropdown-btn i:first-child {
  background: linear-gradient(135deg, #a855f7, #ec4899);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* === CHATS — Blue/Cyan Gradient === */
#navChats .nav-dropdown-btn {
  color: #3b82f6;
}
#navChats .nav-dropdown-btn::before {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(6, 182, 212, 0.15));
}
#navChats .nav-dropdown-btn:hover {
  color: #60a5fa;
  text-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
}
#navChats .nav-dropdown-btn i:first-child {
  background: linear-gradient(135deg, #3b82f6, #06b6d4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* === BOOKS — Emerald/Teal Gradient === */
#navBooks .nav-dropdown-btn {
  color: #10b981;
}
#navBooks .nav-dropdown-btn::before {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(20, 184, 166, 0.15));
}
#navBooks .nav-dropdown-btn:hover {
  color: #34d399;
  text-shadow: 0 0 20px rgba(16, 185, 129, 0.5);
}
#navBooks .nav-dropdown-btn i:first-child {
  background: linear-gradient(135deg, #10b981, #14b8a6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* === BUSINESS — Amber/Orange Gradient === */
#navBusiness .nav-dropdown-btn {
  color: #f59e0b;
}
#navBusiness .nav-dropdown-btn::before {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(249, 115, 22, 0.15));
}
#navBusiness .nav-dropdown-btn:hover {
  color: #fbbf24;
  text-shadow: 0 0 20px rgba(245, 158, 11, 0.5);
}
#navBusiness .nav-dropdown-btn i:first-child {
  background: linear-gradient(135deg, #f59e0b, #f97316);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* === DASHBOARD — Indigo/Purple Gradient === */
.nav-single#tab-dashboard {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.1));
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: var(--radius-lg);
  color: #818cf8;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.nav-single#tab-dashboard::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
}

.nav-single#tab-dashboard:hover {
  color: white;
  border-color: transparent;
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
}

.nav-single#tab-dashboard:hover::before {
  opacity: 1;
}

.nav-single#tab-dashboard i {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  transition: all 0.3s ease;
}

.nav-single#tab-dashboard:hover i {
  background: white;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* === ADMIN — Red/Rose Gradient === */
#navAdmin .nav-dropdown-btn {
  color: #ef4444;
}
#navAdmin .nav-dropdown-btn::before {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(244, 63, 94, 0.15));
}
#navAdmin .nav-dropdown-btn:hover {
  color: #f87171;
  text-shadow: 0 0 20px rgba(239, 68, 68, 0.5);
}
#navAdmin .nav-dropdown-btn i:first-child {
  background: linear-gradient(135deg, #ef4444, #f43f5e);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* === DROPDOWN MENU (Premium Glass Effect) === */
.nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 220px;
  background: rgba(17, 24, 39, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  box-shadow: 
    0 20px 50px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.05) inset;
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px) scale(0.95);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
}

.nav-dropdown.open .nav-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* === DROPDOWN ITEMS === */
.nav-dropdown-menu .tab-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  background: transparent;
  border: none;
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  text-align: left;
  position: relative;
  overflow: hidden;
}

.nav-dropdown-menu .tab-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.nav-dropdown-menu .tab-btn:hover {
  color: white;
  transform: translateX(4px);
}

.nav-dropdown-menu .tab-btn:hover::before {
  opacity: 1;
}

.nav-dropdown-menu .tab-btn i {
  width: 20px;
  text-align: center;
  font-size: 1rem;
  position: relative;
  z-index: 1;
}

.nav-dropdown-menu .tab-btn span {
  position: relative;
  z-index: 1;
}

.nav-dropdown-menu .tab-btn.active {
  color: white;
}

/* AI Dropdown Items */
#navAI .nav-dropdown-menu .tab-btn:hover::before {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.2), rgba(236, 72, 153, 0.2));
}
#navAI .nav-dropdown-menu .tab-btn:hover i {
  color: #c084fc;
}
#navAI .nav-dropdown-menu .tab-btn.active {
  background: linear-gradient(135deg, #a855f7, #ec4899);
}

/* Chats Dropdown Items */
#navChats .nav-dropdown-menu .tab-btn:hover::before {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(6, 182, 212, 0.2));
}
#navChats .nav-dropdown-menu .tab-btn:hover i {
  color: #60a5fa;
}
#navChats .nav-dropdown-menu .tab-btn.active {
  background: linear-gradient(135deg, #3b82f6, #06b6d4);
}

/* Books Dropdown Items */
#navBooks .nav-dropdown-menu .tab-btn:hover::before {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(20, 184, 166, 0.2));
}
#navBooks .nav-dropdown-menu .tab-btn:hover i {
  color: #34d399;
}
#navBooks .nav-dropdown-menu .tab-btn.active {
  background: linear-gradient(135deg, #10b981, #14b8a6);
}

/* Business Dropdown Items */
#navBusiness .nav-dropdown-menu .tab-btn:hover::before {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(249, 115, 22, 0.2));
}
#navBusiness .nav-dropdown-menu .tab-btn:hover i {
  color: #fbbf24;
}
#navBusiness .nav-dropdown-menu .tab-btn.active {
  background: linear-gradient(135deg, #f59e0b, #f97316);
}

/* Admin Dropdown Items */
#navAdmin .nav-dropdown-menu .tab-btn:hover::before {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(244, 63, 94, 0.2));
}
#navAdmin .nav-dropdown-menu .tab-btn:hover i {
  color: #f87171;
}
#navAdmin .nav-dropdown-menu .tab-btn.active {
  background: linear-gradient(135deg, #ef4444, #f43f5e);
}

/* === ACTIVE INDICATOR (Pulse) === */
.nav-dropdown.has-active > .nav-dropdown-btn::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  animation: pulse-dot 2s ease-in-out infinite;
}

#navAI.has-active > .nav-dropdown-btn::after {
  background: #a855f7;
  box-shadow: 0 0 10px #a855f7;
}

#navChats.has-active > .nav-dropdown-btn::after {
  background: #3b82f6;
  box-shadow: 0 0 10px #3b82f6;
}

#navBooks.has-active > .nav-dropdown-btn::after {
  background: #10b981;
  box-shadow: 0 0 10px #10b981;
}

#navBusiness.has-active > .nav-dropdown-btn::after {
  background: #f59e0b;
  box-shadow: 0 0 10px #f59e0b;
}

#navAdmin.has-active > .nav-dropdown-btn::after {
  background: #ef4444;
  box-shadow: 0 0 10px #ef4444;
}

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

/* === LIGHT THEME === */
[data-theme="light"] .nav-dropdown-menu {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow: 
    0 20px 50px rgba(0, 0, 0, 0.15),
    0 0 0 1px rgba(0, 0, 0, 0.05) inset;
}

[data-theme="light"] .nav-dropdown-menu .tab-btn {
  color: rgba(0, 0, 0, 0.6);
}

[data-theme="light"] .nav-dropdown-menu .tab-btn:hover {
  color: rgba(0, 0, 0, 0.9);
}

[data-theme="light"] .nav-dropdown-menu .tab-btn.active {
  color: white;
}

/* Admin dropdown visibility */
.nav-dropdown.admin-only {
  display: none;
}

body.is-admin .nav-dropdown.admin-only {
  display: block;
}
/* ============== ГЛОБАЛЬНЫЙ ПОИСК ============== */
.global-search {
    position: relative;
    margin-right: 10px;
}

.global-search input {
    width: 200px;
    padding: 8px 12px;
    border: 1px solid var(--border-color, #ddd);
    border-radius: 8px;
    font-size: 14px;
    background: var(--bg-secondary, #f5f5f5);
    color: var(--text-primary, #333);
    transition: all 0.2s;
}

.global-search input:focus {
    outline: none;
    border-color: var(--primary, #4f46e5);
    width: 280px;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.15);
}

.global-search input::placeholder {
    color: var(--text-muted, #999);
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    min-width: 350px;
    max-height: 400px;
    overflow-y: auto;
    background: var(--bg-primary, #fff);
    border: 1px solid var(--border-color, #ddd);
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    z-index: 1000;
    display: none;
    margin-top: 5px;
}

.search-results.active {
    display: block;
}

.search-results-empty {
    padding: 20px;
    text-align: center;
    color: var(--text-muted, #999);
}

.search-category {
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted, #999);
    background: var(--bg-secondary, #f5f5f5);
    border-bottom: 1px solid var(--border-color, #eee);
}

.search-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color, #eee);
    transition: background 0.15s;
    text-decoration: none;
    color: inherit;
}

.search-item:hover {
    background: var(--bg-secondary, #f5f5f5);
}

.search-item:last-child {
    border-bottom: none;
}

.search-item-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    font-size: 14px;
    color: white;
}

.search-item-icon.user { background: #8b5cf6; }
.search-item-icon.transaction { background: #10b981; }
.search-item-icon.audit { background: #f59e0b; }
.search-item-icon.amo_lead { background: #3b82f6; }
.search-item-icon.book { background: #ec4899; }

.search-item-content {
    flex: 1;
    min-width: 0;
}

.search-item-title {
    font-weight: 500;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-item-subtitle {
    font-size: 12px;
    color: var(--text-muted, #999);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-loading {
    padding: 20px;
    text-align: center;
    color: var(--text-muted, #999);
}

@media (max-width: 768px) {
    .global-search input {
        width: 150px;
    }
    .global-search input:focus {
        width: 200px;
    }
    .search-results {
        min-width: 280px;
        right: auto;
    }
}

/* ============================================================================
   GEMINI CHAT — Multiple Images & Audio Preview
   ============================================================================ */

/* Контейнер превью фото (множественные) */
#gmPhotoPreview {
  display: none;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

#gmPhotoPreview.active {
  display: flex;
}

.gm-photo-thumb {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 2px solid var(--primary);
}

.gm-photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gm-photo-thumb .gm-photo-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  background: var(--danger);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 0.625rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-base);
  opacity: 0;
}

.gm-photo-thumb:hover .gm-photo-remove {
  opacity: 1;
}

.gm-photo-thumb .gm-photo-remove:hover {
  background: var(--danger-hover);
  transform: scale(1.1);
}

.gm-photo-number {
  position: absolute;
  bottom: 2px;
  left: 2px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  font-size: 0.5rem;
  font-weight: 700;
  padding: 2px 4px;
  border-radius: 3px;
}

/* Аудио превью */
#gmAudioPreview {
  display: none;
  margin-bottom: 8px;
}

#gmAudioPreview.active {
  display: block;
}

.gm-audio-thumb {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--primary-light);
  border: 1px solid var(--primary);
  border-radius: var(--radius-md);
  color: var(--primary);
}

.gm-audio-thumb i {
  font-size: 1.25rem;
}

.gm-audio-status {
  font-size: 0.8125rem;
  font-weight: 500;
}

.gm-audio-remove {
  width: 24px;
  height: 24px;
  background: var(--danger);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 0.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 8px;
  transition: all var(--transition-base);
}

.gm-audio-remove:hover {
  background: var(--danger-hover);
  transform: scale(1.1);
}

/* Множественные картинки в сообщении */
.gm-msg-images {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.gm-msg-images .gm-msg-image {
  max-width: 120px;
  max-height: 90px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  cursor: pointer;
  transition: transform 0.2s ease;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.gm-msg-images .gm-msg-image:hover {
  transform: scale(1.05);
}

/* Кнопка микрофона — анимация записи */
.gm-mic-btn.recording {
  background: var(--danger) !important;
  border-color: var(--danger) !important;
  color: white !important;
  animation: micPulse 1s ease-in-out infinite;
}

@keyframes micPulse {
  0%, 100% { 
    transform: scale(1); 
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); 
  }
  50% { 
    transform: scale(1.05); 
    box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); 
  }
}

/* Счётчик изображений на кнопке */
.gm-photo-btn.has-images::after {
  content: attr(data-count);
  position: absolute;
  top: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  background: var(--primary);
  color: white;
  font-size: 0.625rem;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Улучшенный input wrapper */
.gm-input-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.gm-attachments-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
/* ============================================================================
   IMAGE EDIT MODAL - Multi-turn редактирование
   ============================================================================ */

.ie-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
}

.ie-modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.ie-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(4px);
}

.ie-modal-container {
  position: relative;
  width: 95vw;
  max-width: 1200px;
  height: 90vh;
  max-height: 800px;
  background: var(--card-bg, #1e1e2e);
  border-radius: var(--radius-lg, 16px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-color, #333);
}

/* Header */
.ie-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--bg-tertiary, #252536);
  border-bottom: 1px solid var(--border-color, #333);
}

.ie-modal-header h3 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary, #fff);
}

.ie-modal-header h3 i {
  color: var(--primary, #8b5cf6);
}

.ie-close-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: var(--text-muted, #888);
  font-size: 1.25rem;
  cursor: pointer;
  border-radius: var(--radius-sm, 8px);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ie-close-btn:hover {
  background: var(--danger, #ef4444);
  color: white;
}

/* Body - split layout */
.ie-modal-body {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* Image Panel */
.ie-image-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #0a0a0f;
  border-right: 1px solid var(--border-color, #333);
}

.ie-image-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow: hidden;
}

.ie-image-wrapper img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--radius-md, 12px);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.ie-image-wrapper img.ie-image-updated {
  animation: ieImagePulse 0.5s ease;
}

@keyframes ieImagePulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.5); }
  50% { transform: scale(1.02); box-shadow: 0 0 30px 10px rgba(139, 92, 246, 0.3); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(139, 92, 246, 0); }
}

.ie-image-actions {
  display: flex;
  gap: 10px;
  padding: 12px 20px;
  background: var(--bg-tertiary, #252536);
  border-top: 1px solid var(--border-color, #333);
}

.ie-image-actions .btn-sm {
  padding: 8px 14px;
  font-size: 0.8125rem;
  border-radius: var(--radius-sm, 8px);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  background: var(--primary, #8b5cf6);
  color: white;
}

.ie-image-actions .btn-sm:hover {
  background: var(--primary-hover, #7c3aed);
  transform: translateY(-1px);
}

.ie-image-actions .btn-outline {
  background: transparent;
  border: 1px solid var(--border-color, #444);
  color: var(--text-secondary, #aaa);
}

.ie-image-actions .btn-outline:hover {
  background: var(--bg-secondary, #2a2a3e);
  border-color: var(--text-muted, #666);
  color: var(--text-primary, #fff);
}

/* Chat Panel */
.ie-chat-panel {
  width: 380px;
  min-width: 320px;
  display: flex;
  flex-direction: column;
  background: var(--card-bg, #1e1e2e);
}

.ie-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Welcome screen */
.ie-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  color: var(--text-muted, #888);
  padding: 20px;
}

.ie-welcome i {
  font-size: 3rem;
  color: var(--primary, #8b5cf6);
  margin-bottom: 16px;
  opacity: 0.7;
}

.ie-welcome p {
  font-size: 1rem;
  margin-bottom: 20px;
}

.ie-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.ie-suggestion {
  padding: 8px 14px;
  font-size: 0.75rem;
  background: var(--bg-tertiary, #252536);
  border: 1px solid var(--border-color, #333);
  border-radius: 20px;
  color: var(--text-secondary, #bbb);
  cursor: pointer;
  transition: all 0.2s ease;
}

.ie-suggestion:hover {
  background: var(--primary, #8b5cf6);
  border-color: var(--primary, #8b5cf6);
  color: white;
  transform: translateY(-2px);
}

/* Messages */
.ie-msg {
  max-width: 90%;
  animation: ieMsgIn 0.3s ease;
}

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

.ie-msg-user {
  align-self: flex-end;
}

.ie-msg-ai {
  align-self: flex-start;
}

.ie-msg-text {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.875rem;
  line-height: 1.5;
}

.ie-msg-user .ie-msg-text {
  background: var(--primary, #8b5cf6);
  color: white;
  border-bottom-right-radius: 4px;
}

.ie-msg-ai .ie-msg-text {
  background: var(--bg-tertiary, #252536);
  color: var(--text-primary, #fff);
  border-bottom-left-radius: 4px;
}

.ie-msg-image-preview {
  margin-top: 8px;
}

.ie-msg-image-preview img {
  max-width: 150px;
  max-height: 100px;
  border-radius: var(--radius-sm, 8px);
  cursor: pointer;
  transition: transform 0.2s ease;
  border: 2px solid var(--primary, #8b5cf6);
}

.ie-msg-image-preview img:hover {
  transform: scale(1.05);
}

.ie-msg-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-tertiary, #252536);
  border-radius: 16px;
  color: var(--primary, #8b5cf6);
  font-size: 0.875rem;
}

.ie-msg-loading i {
  font-size: 1rem;
}

/* Input area */
.ie-input-area {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-tertiary, #252536);
  border-top: 1px solid var(--border-color, #333);
}

.ie-input-area textarea {
  flex: 1;
  padding: 10px 14px;
  background: var(--input-bg, #12121a);
  border: 1px solid var(--border-color, #333);
  border-radius: var(--radius-md, 12px);
  color: var(--text-primary, #fff);
  font-size: 0.875rem;
  resize: none;
  font-family: inherit;
  transition: border-color 0.2s ease;
}

.ie-input-area textarea:focus {
  outline: none;
  border-color: var(--primary, #8b5cf6);
}

.ie-input-area textarea::placeholder {
  color: var(--text-muted, #666);
}

#ieSendBtn {
  width: 44px;
  height: 44px;
  background: var(--primary, #8b5cf6);
  border: none;
  border-radius: var(--radius-md, 12px);
  color: white;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

#ieSendBtn:hover:not(:disabled) {
  background: var(--primary-hover, #7c3aed);
  transform: scale(1.05);
}

#ieSendBtn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .ie-modal-container {
    width: 100vw;
    height: 100vh;
    max-width: none;
    max-height: none;
    border-radius: 0;
  }

  .ie-modal-body {
    flex-direction: column;
  }

  .ie-image-panel {
    flex: none;
    height: 45%;
    border-right: none;
    border-bottom: 1px solid var(--border-color, #333);
  }

  .ie-chat-panel {
    width: 100%;
    flex: 1;
  }

  .ie-image-wrapper {
    padding: 10px;
  }

  .ie-image-actions {
    padding: 8px 12px;
  }
}
/* Load More Button */
.sd-load-more,
.sr-load-more,
.gi-load-more {
  grid-column: 1 / -1;
  padding: 16px 32px;
  margin: 16px auto;
  background: var(--bg-tertiary);
  border: 1px dashed var(--border-color);
  border-radius: 12px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sd-load-more:hover,
.sr-load-more:hover,
.gi-load-more:hover {
  background: var(--bg-card);
  border-color: var(--primary);
  color: var(--primary);
}

/* Lazy Loading States */
.sd-lazy,
.sr-lazy,
.gi-lazy {
  opacity: 0.5;
  filter: blur(5px);
  transition: opacity 0.3s, filter 0.3s;
}

.sd-loading,
.sr-loading,
.gi-loading {
  opacity: 0.7;
  filter: blur(2px);
}

.sd-card img:not(.sd-lazy):not(.sd-loading),
.sr-card img:not(.sr-lazy):not(.sr-loading) {
  opacity: 1;
  filter: none;
}

/* ============================================
   ALPHABET LOADING - Dancing Stickman
   ============================================ */
.alphabet-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px;
  gap: 20px;
}

.stickman-container {
  position: relative;
  width: 120px;
  height: 150px;
}

.stickman-head {
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 40px; height: 40px;
  border: 4px solid #3b82f6;
  border-radius: 50%;
  animation: headBob 0.5s ease-in-out infinite;
}

.stickman-body {
  position: absolute;
  top: 44px; left: 50%;
  width: 4px; height: 50px;
  background: #3b82f6;
  transform: translateX(-50%);
}

.stickman-arm-left, .stickman-arm-right {
  position: absolute;
  top: 50px;
  width: 4px; height: 40px;
  background: #3b82f6;
  transform-origin: top center;
  border-radius: 2px;
}

.stickman-arm-left { left: 30px; animation: armLeft 0.5s ease-in-out infinite; }
.stickman-arm-right { right: 30px; animation: armRight 0.5s ease-in-out infinite; }

.stickman-leg-left, .stickman-leg-right {
  position: absolute;
  top: 94px;
  width: 4px; height: 50px;
  background: #3b82f6;
  transform-origin: top center;
  border-radius: 2px;
}

.stickman-leg-left { left: 45px; animation: legLeft 0.5s ease-in-out infinite; }
.stickman-leg-right { right: 45px; animation: legRight 0.5s ease-in-out infinite; }

.sparkle {
  position: absolute;
  width: 8px; height: 8px;
  background: #fbbf24;
  border-radius: 50%;
  animation: sparkle 1s ease-in-out infinite;
}
.sparkle:nth-child(1) { top: 10px; left: 10px; }
.sparkle:nth-child(2) { top: 20px; right: 5px; animation-delay: 0.2s; }
.sparkle:nth-child(3) { bottom: 30px; left: 5px; animation-delay: 0.4s; }
.sparkle:nth-child(4) { bottom: 20px; right: 10px; animation-delay: 0.6s; }

@keyframes headBob {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-5px); }
}
@keyframes armLeft {
  0%, 100% { transform: rotate(-30deg); }
  50% { transform: rotate(30deg); }
}
@keyframes armRight {
  0%, 100% { transform: rotate(30deg); }
  50% { transform: rotate(-30deg); }
}
@keyframes legLeft {
  0%, 100% { transform: rotate(20deg); }
  50% { transform: rotate(-20deg); }
}
@keyframes legRight {
  0%, 100% { transform: rotate(-20deg); }
  50% { transform: rotate(20deg); }
}
@keyframes sparkle {
  0%, 100% { opacity: 0; transform: scale(0); }
  50% { opacity: 1; transform: scale(1); }
}

.alphabet-loading-text {
  text-align: center;
  color: #94a3b8;
}
.alphabet-loading-text strong {
  color: #3b82f6;
  display: block;
  font-size: 1.2rem;
  margin-bottom: 8px;
}

.alphabet-progress {
  width: 100%;
  max-width: 300px;
  height: 8px;
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  overflow: hidden;
}

.alphabet-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #8b5cf6, #3b82f6);
  background-size: 200% 100%;
  animation: progressShine 1.5s ease-in-out infinite;
  transition: width 0.3s ease;
}

@keyframes progressShine {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* History table improved */
#alphabetHistoryTable { width: 100%; border-collapse: collapse; }
#alphabetHistoryTable th {
  background: rgba(59,130,246,0.15);
  color: #94a3b8;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  padding: 12px 16px;
  text-align: left;
}
#alphabetHistoryTable td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  color: #cbd5e1;
}
#alphabetHistoryTable tr:hover { background: rgba(59,130,246,0.08); }

.history-actions { display: flex; gap: 8px; }
.history-btn {
  width: 32px; height: 32px;
  border: none; border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.history-btn-download { background: rgba(34,197,94,0.15); color: #22c55e; }
.history-btn-download:hover { background: rgba(34,197,94,0.3); }
.history-btn-delete { background: rgba(239,68,68,0.15); color: #ef4444; }
.history-btn-delete:hover { background: rgba(239,68,68,0.3); }
.history-btn-yadisk { background: rgba(251,191,36,0.15); color: #fbbf24; }
.history-btn-yadisk:hover { background: rgba(251,191,36,0.3); }

/* Hide broken/empty preview images */
#alphabetPreview[src=""],
#alphabetPreview:not([src]) {
  display: none !important;
}

#alphabetResult[hidden] {
  display: none !important;
}
/* ============================================
   MAIN HEADER - PREMIUM GLASSMORPHISM
   ============================================ */
.main-header {
  position: fixed;
  top: 16px;
  left: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  padding: 0 8px;
  
  /* Glassmorphism effect */
  background: linear-gradient(
    135deg,
    rgba(15, 15, 25, 0.75) 0%,
    rgba(25, 20, 40, 0.7) 50%,
    rgba(20, 15, 35, 0.75) 100%
  );
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  
  /* Border & glow */
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  
  /* Premium shadow */
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.35),
    0 2px 8px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    inset 0 -1px 0 rgba(0, 0, 0, 0.1);
}

/* Subtle gradient border effect */
.main-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(139, 92, 246, 0.4) 20%,
    rgba(168, 85, 247, 0.5) 50%,
    rgba(139, 92, 246, 0.4) 80%,
    transparent 100%
  );
  border-radius: 18px 18px 0 0;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-left: 8px;
}

/* ===== Navigation Links ===== */
.nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.2px;
  border-radius: 12px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-link:hover {
  color: #fff;
  background: rgba(139, 92, 246, 0.2);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.15);
}

.nav-link i {
  font-size: 14px;
  color: rgba(168, 85, 247, 0.9);
}

.nav-link:hover i {
  color: #a78bfa;
}

/* ===== Dropdown Buttons ===== */
.main-header .nav-dropdown-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.85);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.2px;
  cursor: pointer;
  border-radius: 12px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.main-header .nav-dropdown-btn:hover {
  color: #fff;
  background: rgba(139, 92, 246, 0.2);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.15);
}

.main-header .nav-dropdown-btn i:first-child {
  font-size: 14px;
  color: rgba(168, 85, 247, 0.9);
}

.main-header .nav-dropdown-btn:hover i:first-child {
  color: #a78bfa;
}

.main-header .nav-dropdown-btn .nav-arrow {
  font-size: 9px;
  opacity: 0.5;
  margin-left: 4px;
  transition: transform 0.3s ease;
}

.main-header .nav-dropdown:hover .nav-arrow {
  transform: rotate(180deg);
  opacity: 0.8;
}

/* ===== Dropdown Container ===== */
.main-header .nav-dropdown {
  position: relative;
}

/* ===== Dropdown Menu (Glass) ===== */
.main-header .nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 12px);
  left: 0;
  min-width: 220px;
  padding: 10px;
  
  /* Glass effect */
  background: linear-gradient(
    165deg,
    rgba(20, 15, 35, 0.92) 0%,
    rgba(30, 25, 50, 0.88) 100%
  );
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  
  border: 1px solid rgba(139, 92, 246, 0.15);
  border-radius: 16px;
  
  box-shadow: 
    0 20px 50px rgba(0, 0, 0, 0.5),
    0 8px 20px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px) scale(0.96);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Subtle top glow */
.main-header .nav-dropdown-menu::before {
  content: '';
  position: absolute;
  top: 0;
  left: 20px;
  right: 20px;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(139, 92, 246, 0.4),
    transparent
  );
}

.main-header .nav-dropdown:hover .nav-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* ===== Dropdown Menu Items ===== */
.main-header .nav-dropdown-menu .tab-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 12px 16px;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.8);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.main-header .nav-dropdown-menu .tab-btn:hover {
  background: linear-gradient(
    135deg,
    rgba(139, 92, 246, 0.2) 0%,
    rgba(168, 85, 247, 0.15) 100%
  );
  color: #fff;
  transform: translateX(4px);
}

.main-header .nav-dropdown-menu .tab-btn i {
  width: 22px;
  text-align: center;
  font-size: 14px;
  color: rgba(139, 92, 246, 0.7);
  transition: color 0.2s ease;
}

.main-header .nav-dropdown-menu .tab-btn:hover i {
  color: #a78bfa;
}

/* ===== Right Side ===== */
.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-right: 8px;
}

/* ===== Search ===== */
.header-right .global-search {
  position: relative;
}

.header-right .global-search input {
  width: 160px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  color: #fff;
  font-size: 13px;
  font-weight: 400;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.header-right .global-search input:focus {
  outline: none;
  width: 220px;
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(139, 92, 246, 0.4);
  box-shadow: 
    0 0 0 4px rgba(139, 92, 246, 0.1),
    0 4px 20px rgba(139, 92, 246, 0.15);
}

.header-right .global-search input::placeholder {
  color: rgba(255, 255, 255, 0.35);
}

/* ===== Header Buttons ===== */
.header-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.8);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.25s ease;
}

.header-btn:hover {
  color: #fff;
  background: rgba(139, 92, 246, 0.15);
  border-color: rgba(139, 92, 246, 0.2);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.1);
}

.header-btn i {
  font-size: 14px;
  color: rgba(168, 85, 247, 0.8);
}

.header-btn:hover i {
  color: #a78bfa;
}

/* Logout button */
.header-btn.logout-btn {
  color: rgba(248, 180, 180, 0.85);
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.1);
}

.header-btn.logout-btn i {
  color: rgba(248, 113, 113, 0.8);
}

.header-btn.logout-btn:hover {
  color: #fecaca;
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.2);
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.1);
}

.header-btn.logout-btn:hover i {
  color: #f87171;
}

/* ===== Body Padding ===== */
body {
  padding-top: 88px;
}

/* ===== Admin Only ===== */
.admin-only {
  display: none;
}

body.is-admin .admin-only {
  display: flex;
}

/* ===== Search Results Dropdown ===== */
.header-right .search-results {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 340px;
  max-height: 420px;
  overflow-y: auto;
  
  background: linear-gradient(
    165deg,
    rgba(20, 15, 35, 0.95) 0%,
    rgba(30, 25, 50, 0.92) 100%
  );
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  
  border: 1px solid rgba(139, 92, 246, 0.15);
  border-radius: 16px;
  
  box-shadow: 
    0 20px 50px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  
  display: none;
  padding: 8px;
}

.header-right .search-results.active {
  display: block;
}

/* ===== Responsive ===== */
@media (max-width: 1200px) {
  .main-header {
    top: 12px;
    left: 12px;
    right: 12px;
  }
  
  .nav-link span,
  .main-header .nav-dropdown-btn span {
    display: none;
  }
  
  .nav-link,
  .main-header .nav-dropdown-btn {
    padding: 10px 12px;
  }
  
  .header-btn span {
    display: none;
  }
  
  .header-btn {
    padding: 10px 12px;
  }
}
