/* ScholAIr — Digital Scholar theme */
:root {
  --bg: #0F0E0C;
  --surface: #1A1815;
  --surface-hover: #232019;
  --card: #1E1C18;
  --border: #2E2A23;
  --border-soft: #25221C;
  --accent: #D4A853;
  --accent-dim: #B8923F;
  --accent-glow: rgba(212, 168, 83, 0.12);
  --text: #E8E2D6;
  --text-muted: #9B9284;
  --text-dim: #6B6358;
  --success: #6BBF7A;
  --info: #6BA3D4;
  --warning: #D4A853;
  --danger: #D45353;
  --header-bg: rgba(15, 14, 12, 0.78);
  --tab-bg: rgba(15, 14, 12, 0.85);
  --modal-bg: rgba(8, 7, 6, 0.7);
  --glow-1: rgba(212, 168, 83, 0.12);
  --glow-2: rgba(107, 163, 212, 0.05);
  --on-accent: #0F0E0C;

  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'Source Sans 3', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', ui-monospace, monospace;
}

/* Light theme — warm paper / scholar's parchment */
:root[data-theme="light"] {
  --bg: #F5F0E4;
  --surface: #ECE5D3;
  --surface-hover: #E2D9C3;
  --card: #FBF7EC;
  --border: #D8CDB3;
  --border-soft: #E5DCC6;
  --accent: #9C7A2E;
  --accent-dim: #7E6224;
  --accent-glow: rgba(156, 122, 46, 0.14);
  --text: #2A2620;
  --text-muted: #6B6358;
  --text-dim: #9B9284;
  --success: #4F9F5F;
  --info: #4E80B1;
  --warning: #9C7A2E;
  --danger: #B53939;
  --header-bg: rgba(245, 240, 228, 0.82);
  --tab-bg: rgba(245, 240, 228, 0.88);
  --modal-bg: rgba(60, 50, 30, 0.35);
  --glow-1: rgba(156, 122, 46, 0.14);
  --glow-2: rgba(78, 128, 177, 0.07);
  --on-accent: #FBF7EC;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  top: -200px;
  right: -200px;
  width: 700px;
  height: 700px;
  background: radial-gradient(circle at center, var(--glow-1), transparent 65%);
  pointer-events: none;
  z-index: 0;
  transition: background 0.4s ease;
}

body::after {
  content: "";
  position: fixed;
  bottom: -300px;
  left: -200px;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle at center, var(--glow-2), transparent 65%);
  pointer-events: none;
  z-index: 0;
  transition: background 0.4s ease;
}

body {
  transition: background 0.3s ease, color 0.3s ease;
}

#root {
  position: relative;
  z-index: 1;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input, textarea, select {
  font-family: inherit;
  color: inherit;
}

/* scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-dim); }

/* Sticky header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  transition: background 0.3s ease, border-color 0.3s ease;
}

/* Generic utility */
.mono { font-family: var(--font-mono); }
.serif { font-family: var(--font-display); }

.fade-in {
  animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 0 rgba(107,191,122,0.6);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(107,191,122,0.4); }
  70% { box-shadow: 0 0 0 8px rgba(107,191,122,0); }
  100% { box-shadow: 0 0 0 0 rgba(107,191,122,0); }
}

/* progress bar fill animation */
.bar-fill {
  transition: width 0.7s cubic-bezier(.2,.7,.2,1);
}

/* shimmer for processing files */
.shimmer {
  background: linear-gradient(90deg, var(--border) 25%, #3a352b 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.6s infinite;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* slide-up for modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--modal-bg);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.18s ease;
}
.modal-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: min(520px, 92vw);
  max-height: 90vh;
  overflow: auto;
  animation: slideUp 0.22s cubic-bezier(.2,.7,.2,1);
  box-shadow: 0 30px 60px rgba(0,0,0,0.5), 0 0 0 1px rgba(212,168,83,0.06);
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* directory card hover */
.dir-card {
  transition: transform 0.22s ease, border-color 0.22s ease, background 0.22s ease;
}
.dir-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-dim);
  background: var(--surface-hover);
}

/* tab underline */
.tab-active::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
}

/* chat message bubble */
.bubble-ai {
  background: var(--surface);
  border: 1px solid var(--border);
}
.bubble-user {
  color: var(--on-accent);
}

/* theme toggle */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
  gap: 0;
  transition: all 0.18s ease;
}
.theme-toggle button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  color: var(--text-dim);
  transition: all 0.18s ease;
}
.theme-toggle button.active {
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: 0 0 10px var(--accent-glow);
}
.theme-toggle button:not(.active):hover {
  color: var(--text);
}

/* code-ish styling */
kbd, .chip-mono {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(212,168,83,0.08);
  color: var(--accent);
  border: 1px solid rgba(212,168,83,0.18);
}

/* dashed new-card */
.new-card {
  border: 1.5px dashed var(--border);
  transition: all 0.22s ease;
}
.new-card:hover {
  border-color: var(--accent);
  background: rgba(212,168,83,0.04);
}

/* focus rings */
input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent-dim) !important;
  box-shadow: 0 0 0 3px rgba(212,168,83,0.1);
}

/* drop zone */
.drop-zone {
  transition: all 0.2s ease;
}
.drop-zone.dragging {
  border-color: var(--accent);
  background: rgba(212,168,83,0.06);
}

/* typing dots */
.typing-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typing 1.3s infinite ease-in-out;
}
.typing-dot:nth-child(2) { animation-delay: 0.15s; }
.typing-dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}
