/* ============================================
   AI Search SaaS - Main Stylesheet
   Design: Dark academic warmth, amber accents
   ============================================ */

/* --- Reset & Base --- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-deep: #09090b;
  --bg-surface: #111118;
  --bg-card: #1a1a24;
  --border: #2a2a3a;
  --accent: #d4a853;
  --accent-hover: #e4b863;
  --accent-dim: rgba(212, 168, 83, 0.15);
  --text-primary: #e8e6e3;
  --text-secondary: #8a8a9a;
  --text-muted: #5a5a6a;
  --glass: rgba(255, 255, 255, 0.04);
  --glass-hover: rgba(255, 255, 255, 0.08);
  --success: #4ade80;
  --error: #f87171;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --transition: cubic-bezier(0.4, 0, 0.2, 1);
  --font-sans: 'Inter', 'Noto Sans SC', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --sidebar-width: 200px;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-deep);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(212, 168, 83, 0.06), transparent),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(212, 168, 83, 0.03), transparent);
  pointer-events: none;
  z-index: 0;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 200ms var(--transition);
}

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

.hidden {
  display: none !important;
}

/* ============================================
   Sidebar
   ============================================ */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  padding: 16px 12px;
}

.sidebar-header {
  padding: 4px 4px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
  transition: opacity 200ms var(--transition);
}

.logo:hover {
  opacity: 0.8;
}

.logo-img {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  object-fit: cover;
}

.logo-text {
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: none;
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 200ms var(--transition);
  text-align: left;
  width: 100%;
}

.sidebar-item:hover {
  background: var(--glass-hover);
  color: var(--text-primary);
}

.sidebar-item.active {
  background: var(--accent-dim);
  color: var(--accent);
}

.sidebar-item svg {
  flex-shrink: 0;
}

/* ==================== Persona Selector ==================== */
.sidebar-persona {
  margin-top: auto;
  margin-bottom: 12px;
  padding: 12px 8px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.persona-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  padding-left: 4px;
}

.persona-options {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.persona-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.persona-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
}

.persona-btn.active {
  background: var(--accent-dim);
  color: var(--accent);
}

.persona-btn svg {
  flex-shrink: 0;
  opacity: 0.7;
}

.persona-btn.active svg {
  opacity: 1;
}

.persona-text {
  font-weight: 500;
}

/* ==================== Language Selector ==================== */
.language-selector {
  position: relative;
}

.language-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.language-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--accent);
}

.language-btn .lang-flag {
  font-size: 16px;
}

.language-btn .lang-name {
  flex: 1;
  text-align: left;
  font-weight: 500;
}

.language-btn svg {
  opacity: 0.5;
  transition: transform 0.2s ease;
}

.language-menu {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  margin-bottom: 4px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  z-index: 100;
  overflow: hidden;
  animation: slideUp 0.2s ease;
}

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

.lang-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.lang-option:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

.lang-option .lang-flag {
  font-size: 16px;
}

.sidebar-footer {
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* User Status */
.user-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

.user-details {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.user-email {
  font-size: 11px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100px;
}

.user-membership {
  font-size: 10px;
  color: var(--text-secondary);
}

.user-membership.pro {
  color: var(--accent);
}

.logout-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
  flex-shrink: 0;
}

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

/* Sidebar Login Button */
.sidebar-login-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 8px 12px;
  background: var(--accent);
  color: var(--bg-deep);
  border: none;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.sidebar-login-btn:hover {
  background: var(--accent-hover);
}

.badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.05em;
}

/* ============================================
   Main Content
   ============================================ */
.main-content {
  position: relative;
  z-index: 1;
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
}

.view-panel {
  min-height: 100vh;
}

/* ============================================
   Welcome View
   ============================================ */
.welcome-view {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 40px 24px;
}

.welcome-inner {
  max-width: 680px;
  width: 100%;
  text-align: center;
}

.welcome-icon {
  margin-bottom: 24px;
  opacity: 0.9;
}

.welcome-title {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin-bottom: 12px;
  line-height: 1.2;
}

.welcome-subtitle {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 40px;
  line-height: 1.6;
}

/* --- Search Box (Large) --- */
.search-box-large {
  margin-bottom: 48px;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg-surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0 16px;
  transition: all 300ms var(--transition);
}

.search-input-wrapper:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim), 0 8px 32px rgba(0, 0, 0, 0.3);
}

.search-icon {
  flex-shrink: 0;
  margin-right: 12px;
}

.search-input-wrapper input {
  flex: 1;
  height: 52px;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
}

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

.search-submit {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  border: none;
  border-radius: 8px;
  color: var(--bg-deep);
  cursor: pointer;
  transition: all 200ms var(--transition);
}

.search-submit:hover {
  background: var(--accent-hover);
  transform: translateX(2px);
}

/* --- Suggestions --- */
.suggestions-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 14px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 500;
}

.suggestions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.suggestion-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: all 250ms var(--transition);
  line-height: 1.4;
}

.suggestion-card:hover {
  background: var(--glass-hover);
  border-color: rgba(212, 168, 83, 0.3);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.suggestion-icon {
  font-size: 18px;
  flex-shrink: 0;
}

/* ============================================
   Result View (Search)
   ============================================ */
.result-view {
  padding: 24px;
  max-width: 1200px;
  margin: 0 auto;
}

.result-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 32px;
  align-items: start;
}

.query-display {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.query-title {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
  margin-bottom: 8px;
}

.query-mode {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--glass);
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
}

/* --- AI Answer Section --- */
.ai-answer-section {
  margin-bottom: 24px;
}

.answer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.answer-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}

.answer-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  transition: all 300ms var(--transition);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.5s ease-in-out infinite;
}

.status-dot.done {
  background: var(--success);
  animation: none;
}

.status-dot.error {
  background: var(--error);
  animation: none;
}

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

.answer-content {
  font-size: 15px;
  line-height: 1.75;
  color: var(--text-primary);
  min-height: 100px;
}

/* Markdown rendering */
.answer-content h1,
.answer-content h2,
.answer-content h3 {
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.answer-content h1 { font-size: 1.5em; }
.answer-content h2 { font-size: 1.25em; }
.answer-content h3 { font-size: 1.1em; }

.answer-content p {
  margin-bottom: 0.8em;
}

.answer-content ul,
.answer-content ol {
  margin-bottom: 0.8em;
  padding-left: 1.5em;
}

.answer-content li {
  margin-bottom: 0.3em;
}

.answer-content strong {
  color: var(--accent-hover);
  font-weight: 600;
}

.answer-content code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--bg-card);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.answer-content pre {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  overflow-x: auto;
  margin-bottom: 1em;
}

.answer-content pre code {
  background: none;
  border: none;
  padding: 0;
}

.answer-content blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 16px;
  margin: 1em 0;
  color: var(--text-secondary);
  font-style: italic;
}

/* Citation markers */
.answer-content sup {
  color: var(--accent);
  font-size: 0.75em;
  font-weight: 600;
  cursor: help;
}

/* --- Loading --- */
.loading-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 40px;
  color: var(--text-muted);
}

.loading-dots {
  display: flex;
  gap: 6px;
}

.loading-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: bounce 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

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

/* --- Follow-up --- */
.follow-up-section {
  margin-top: 24px;
}

.follow-up-input-wrapper {
  display: flex;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0 12px;
  transition: all 300ms var(--transition);
}

.follow-up-input-wrapper:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
}

.follow-up-input-wrapper input {
  flex: 1;
  height: 44px;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
}

.follow-up-input-wrapper input::placeholder {
  color: var(--text-muted);
}

.follow-up-submit {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  border: none;
  border-radius: 6px;
  color: var(--bg-deep);
  cursor: pointer;
  transition: all 200ms var(--transition);
}

.follow-up-submit:hover {
  background: var(--accent-hover);
}

/* --- Sources Sidebar --- */
.result-sidebar {
  position: sticky;
  top: 24px;
}

.sources-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.sources-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.sources-count {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--glass);
  padding: 2px 8px;
  border-radius: 10px;
}

.sources-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sources-empty {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  padding: 20px;
}

.source-card {
  display: block;
  padding: 12px;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all 200ms var(--transition);
  text-decoration: none;
}

.source-card:hover {
  background: var(--glass-hover);
  border-color: rgba(212, 168, 83, 0.3);
  transform: translateY(-1px);
}

.source-title {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 6px;
  line-height: 1.4;
}

.source-index {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-dim);
  color: var(--accent);
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
}

.source-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

.source-snippet {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-top: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ============================================
   Chat View
   ============================================ */
.chat-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 800px;
  margin: 0 auto;
}

.chat-header {
  padding: 24px 24px 16px;
  border-bottom: 1px solid var(--border);
}

.chat-header h2 {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.chat-header p {
  font-size: 14px;
  color: var(--text-secondary);
}

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

.chat-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 60px 20px;
  text-align: center;
  color: var(--text-muted);
}

.chat-welcome h3 {
  font-size: 18px;
  color: var(--text-secondary);
}

.chat-welcome p {
  font-size: 14px;
  max-width: 400px;
}

.chat-msg {
  display: flex;
  gap: 12px;
  animation: fadeIn 300ms var(--transition);
}

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

.chat-msg-avatar {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.chat-msg.user .chat-msg-avatar {
  background: var(--accent-dim);
  color: var(--accent);
}

.chat-msg.assistant .chat-msg-avatar {
  background: var(--glass-hover);
  color: var(--text-secondary);
}

.chat-msg-body {
  flex: 1;
  min-width: 0;
}

.chat-msg-role {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.chat-msg-content {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-primary);
}

.chat-msg-content p { margin-bottom: 0.5em; }
.chat-msg-content ul, .chat-msg-content ol { padding-left: 1.5em; margin-bottom: 0.5em; }
.chat-msg-content strong { color: var(--accent-hover); }
.chat-msg-content code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--bg-card);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.chat-input-area {
  padding: 16px 24px 24px;
  border-top: 1px solid var(--border);
}

.chat-input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  transition: all 300ms var(--transition);
}

.chat-input-wrapper:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
}

.chat-input-wrapper textarea {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  resize: none;
  max-height: 120px;
}

.chat-input-wrapper textarea::placeholder {
  color: var(--text-muted);
}

.chat-submit {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  border: none;
  border-radius: 6px;
  color: var(--bg-deep);
  cursor: pointer;
  transition: all 200ms var(--transition);
}

.chat-submit:hover {
  background: var(--accent-hover);
}

/* ============================================
   Image View
   ============================================ */
.image-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 32px 24px;
}

.image-header {
  margin-bottom: 32px;
}

.image-header h2 {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.image-header p {
  font-size: 14px;
  color: var(--text-secondary);
}

.image-input-section {
  margin-bottom: 32px;
}

.image-input-wrapper {
  background: var(--bg-surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  transition: all 300ms var(--transition);
  margin-bottom: 16px;
}

.image-input-wrapper:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.image-input-wrapper textarea {
  width: 100%;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  resize: none;
  min-height: 80px;
}

.image-input-wrapper textarea::placeholder {
  color: var(--text-muted);
}

.image-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.generate-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-md);
  color: var(--bg-deep);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 200ms var(--transition);
}

.generate-btn:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(212, 168, 83, 0.3);
}

.generate-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.image-status {
  font-size: 13px;
  color: var(--text-muted);
}

.image-status.error {
  color: var(--error);
}

/* --- Image Progress --- */
.image-progress {
  margin-top: 24px;
  padding: 20px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  animation: fadeIn 300ms var(--transition);
}

.progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.progress-message {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.progress-percent {
  font-size: 13px;
  font-family: var(--font-mono);
  color: var(--accent);
  font-weight: 600;
}

.progress-track {
  width: 100%;
  height: 6px;
  background: var(--bg-surface);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 14px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  border-radius: 3px;
  transition: width 600ms cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.progress-stages {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.progress-stage {
  color: var(--text-muted);
  transition: color 300ms var(--transition);
}

.progress-stage.active {
  color: var(--accent);
  font-weight: 600;
}

.progress-stage.done {
  color: var(--success);
}

.progress-stage-sep {
  color: var(--text-muted);
  opacity: 0.4;
  font-size: 11px;
}

/* --- Image Result --- */
.image-result {
  animation: fadeIn 400ms var(--transition);
}

.image-preview-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 20px;
}

.image-preview {
  width: 100%;
  height: auto;
  display: block;
}

.image-meta {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 32px;
}

.image-meta-item {
  margin-bottom: 16px;
}

.image-meta-item:last-of-type {
  margin-bottom: 0;
}

.image-meta-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

.image-meta-value {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.image-meta-value.mono {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
}

.image-meta-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.meta-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 13px;
  cursor: pointer;
  transition: all 200ms var(--transition);
}

.meta-btn:hover {
  background: var(--glass-hover);
  color: var(--text-primary);
  border-color: rgba(212, 168, 83, 0.3);
}

/* --- Image History --- */
.image-history-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.image-history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.history-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 200ms var(--transition);
}

.history-thumb:hover {
  border-color: var(--accent);
  transform: scale(1.02);
}

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

.history-thumb-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px;
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 1024px) {
  .result-layout {
    grid-template-columns: 1fr;
  }

  .result-sidebar {
    position: static;
  }
}

@media (max-width: 768px) {
  :root {
    --sidebar-width: 60px;
  }

  .logo-text,
  .sidebar-label {
    display: none;
  }

  .sidebar-item {
    justify-content: center;
    padding: 10px;
  }

  .sidebar-header {
    display: flex;
    justify-content: center;
  }

  .sidebar-footer {
    display: flex;
    justify-content: center;
  }

  .suggestions-grid {
    grid-template-columns: 1fr;
  }

  .welcome-title {
    font-size: 28px;
  }

  .image-history-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }
}
