@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ===== THEME VARIABLES ===== */
:root {
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --bg-input: #ffffff;
  --bg-header: #ffffff;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-faint: #cbd5e1;
  --text-header: #1e293b;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-bg: #eef2ff;
  --accent-text: #4338ca;
  --success: #059669;
  --success-bg: #d1fae5;
  --success-text: #065f46;
  --warning: #d97706;
  --warning-bg: #fef3c7;
  --warning-text: #92400e;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --danger-text: #991b1b;
  --review-bg: #dbeafe;
  --review-text: #2563eb;
  --ready-bg: #f3e8ff;
  --ready-text: #7c3aed;
  --sent-bg: #d1fae5;
  --sent-text: #059669;
  --routing-bg: #fffbeb;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07);
  --radius: 10px;
  --radius-sm: 6px;
}

.dark {
  --bg-page: #0f172a;
  --bg-card: #1e293b;
  --bg-card-hover: #334155;
  --bg-input: #1e293b;
  --bg-header: #0f172a;
  --border: #334155;
  --border-light: #1e293b;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-faint: #475569;
  --text-header: #f1f5f9;
  --accent-bg: rgba(99,102,241,0.15);
  --accent-text: #818cf8;
  --success-bg: rgba(5,150,105,0.15);
  --success-text: #34d399;
  --warning-bg: rgba(245,158,11,0.15);
  --warning-text: #fbbf24;
  --danger-bg: rgba(220,38,38,0.15);
  --danger-text: #fca5a5;
  --review-bg: rgba(59,130,246,0.15);
  --review-text: #60a5fa;
  --ready-bg: rgba(168,85,247,0.15);
  --ready-text: #c084fc;
  --sent-bg: rgba(52,211,153,0.15);
  --sent-text: #34d399;
  --routing-bg: rgba(245,158,11,0.08);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.3);
}

/* ===== BASE ===== */
body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-page);
  color: var(--text-primary);
  transition: background 0.2s ease, color 0.2s ease;
}
[x-cloak] { display: none !important; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--border-light); }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 3px; }
.dark ::-webkit-scrollbar-track { background: rgba(15,23,42,0.5); }
.dark ::-webkit-scrollbar-thumb { background: #334155; }

/* ===== ANIMATIONS ===== */
@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(99,102,241,0.5); }
  70% { box-shadow: 0 0 0 10px rgba(99,102,241,0); }
  100% { box-shadow: 0 0 0 0 rgba(99,102,241,0); }
}
.pulse-running { animation: pulse-ring 1.5s ease-out infinite; }

@keyframes card-enter {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.card-animate { animation: card-enter 0.4s ease-out forwards; opacity: 0; }

@keyframes spin { to { transform: rotate(360deg); } }
.spinner { animation: spin 1s linear infinite; }

@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0} }
.typing-cursor::after { content: '\u258C'; animation: blink 0.8s ease-in-out infinite; color: var(--accent); }

@keyframes fade-in { from { opacity:0; } to { opacity:1; } }
.fade-in { animation: fade-in 0.3s ease-out forwards; }

@keyframes toast-in {
  from { transform: translateY(20px) scale(0.95); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}
@keyframes toast-out {
  from { transform: translateY(0) scale(1); opacity: 1; }
  to { transform: translateY(-10px) scale(0.95); opacity: 0; }
}
.toast-enter { animation: toast-in 0.3s ease-out forwards; }
.toast-exit { animation: toast-out 0.3s ease-in forwards; }

/* ===== COMPONENTS ===== */
.step-connector { height: 2px; flex: 1; min-width: 20px; transition: background-color 0.5s ease; }
.chat-ai { border-radius: 2px 12px 12px 12px; }
.chat-ref { border-radius: 12px 2px 12px 12px; }
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.search-pulse { animation: pulse-ring 2s ease-out infinite; }

.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  transition: all 0.2s ease;
  cursor: pointer;
}
.drop-zone:hover, .drop-zone.drag-over { border-color: var(--accent); background: var(--accent-bg); }
.drop-zone.drag-over { transform: scale(1.01); }

.resume-page {
  background: white; color: #1a1a2e; font-family: 'Georgia', serif;
  box-shadow: var(--shadow-md);
}

/* Toast container */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 8px;
}
.toast-success { background: var(--success); color: white; }
.toast-info { background: var(--accent); color: white; }

/* Theme-aware utilities */
.th-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.th-card-elevated { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-md); }
.th-input { background: var(--bg-input); border: 1px solid var(--border); color: var(--text-primary); }
.th-input:focus { outline: none; box-shadow: 0 0 0 2px rgba(99,102,241,0.3); border-color: var(--accent); }
.th-btn-primary { background: var(--accent); color: white; font-weight: 600; border: none; cursor: pointer; transition: background 0.15s; }
.th-btn-primary:hover { background: var(--accent-hover); }
.th-btn-success { background: var(--success); color: white; font-weight: 600; border: none; cursor: pointer; }
.th-btn-success:hover { background: #047857; }
.th-btn-secondary { background: var(--bg-page); border: 1px solid var(--border); color: var(--text-secondary); cursor: pointer; transition: all 0.15s; }
.th-btn-secondary:hover { background: var(--bg-card-hover); }
.th-btn-ghost { background: transparent; border: none; color: var(--text-muted); cursor: pointer; transition: color 0.15s; }
.th-btn-ghost:hover { color: var(--text-primary); }

/* ===== MOBILE ===== */
@media (max-width: 640px) {
  .grid-cols-6 { grid-template-columns: repeat(3, 1fr); }
  .grid-cols-3 { grid-template-columns: repeat(1, 1fr); }
}
