/* ═══════════════════════════════════════════════════
   OER Search Engine — Option C Premium Design
   Navy & Gold Academic Portal — Light & Airy
   ═══════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,600;0,700;1,400&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --primary: #1b3a5c;
  --primary-dark: #0f2440;
  --primary-light: #2c5282;
  --accent: #b8860b;
  --accent-light: #d4a017;
  --accent-subtle: rgba(184, 134, 11, 0.08);
  --accent-glow: rgba(184, 134, 11, 0.15);
  --bg: #f8f7f4;
  --card: #ffffff;
  --card-hover: #f7f6f2;
  --border: #e8e4de;
  --border-light: #f0efe8;
  --text: #1e1e1e;
  --text2: #5a5a5a;
  --text3: #999;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.06), 0 4px 10px rgba(0,0,0,0.04);
  --radius: 6px;
  --radius-lg: 10px;
  --radius-xl: 14px;
  --sans: 'Inter', -apple-system, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  --serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --ease: 0.2s ease;
  --navy: #0f2440;
  --navy-mid: #1a3a5f;
  --gold: #b8860b;
  --gold-light: #d4a017;
  --loading-overlay-bg: rgba(248,247,244,0.9);
}

[data-theme="dark"] {
  --primary: #7eb8da;
  --primary-dark: #a8d8f0;
  --primary-light: #5a9fc4;
  --accent: #d4a017;
  --accent-light: #e8b830;
  --accent-subtle: rgba(212, 160, 23, 0.12);
  --accent-glow: rgba(212, 160, 23, 0.2);
  --bg: #121212;
  --card: #1e1e1e;
  --card-hover: #252525;
  --border: #333;
  --border-light: #2a2a2a;
  --text: #e8e6e3;
  --text2: #a8a6a3;
  --text3: #666;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.4), 0 4px 10px rgba(0,0,0,0.3);
  --navy: #a8d8f0;
  --navy-mid: #7eb8da;
  --gold: #d4a017;
  --gold-light: #e8b830;
  --loading-overlay-bg: rgba(18,18,18,0.92);
}

/* ═══ HEADER ═══ */
.header {
  background: rgba(15, 36, 64, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 2px solid #b8860b;
  padding: 0 3rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 20px rgba(0,0,0,0.15);
}

.brand {
  font-family: var(--serif);
  font-size: 1.35rem;
  color: #fff;
  text-decoration: none;
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.brand i { color: #b8860b; font-size: 1.1rem; }
.brand em { font-style: italic; font-weight: 400; color: #d4a017; }

.nav { display: flex; align-items: center; gap: 0.1rem; }
.nav a { color: rgba(255,255,255,0.7); text-decoration: none; padding: 0.4rem 0.9rem; font-size: 0.82rem; font-weight: 500; border-radius: 6px; transition: var(--ease); white-space: nowrap; }
.nav a:hover { background: rgba(255,255,255,0.1); color: #fff; }
.nav a.active { background: #b8860b; color: #fff; }
.nav a.active:hover { background: #d4a017; }

.nav .btn-primary {
  background: #b8860b;
  color: #fff;
  padding: 0.4rem 1.2rem;
  border-radius: 6px;
  font-weight: 500;
  transition: var(--ease);
}

.nav .btn-primary:hover { background: #d4a017; }

.nav .btn-ghost {
  border: 1px solid rgba(255,255,255,0.25);
  color: rgba(255,255,255,0.8);
  padding: 0.4rem 1.2rem;
  border-radius: 6px;
  font-weight: 500;
  transition: var(--ease);
}

.nav .btn-ghost:hover { border-color: #b8860b; color: #fff; background: rgba(255,255,255,0.05); }

.nav-user {
  color: rgba(255,255,255,0.5);
  font-size: 0.78rem;
  padding: 0 0.4rem;
  white-space: nowrap;
}

.dark-toggle {
  background: none;
  border: none;
  color: rgba(255,255,255,0.5);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  transition: var(--ease);
}

.dark-toggle:hover { color: #fff; background: rgba(255,255,255,0.1); }

/* ═══ HERO WRAP ═══ */
.hero-wrap {
  background: linear-gradient(165deg, #f8f7f4 0%, #fff 40%, #fefcf7 100%);
  padding: 3.5rem 3rem 2.5rem;
  position: relative;
  overflow: hidden;
}

.hero-wrap::before {
  content: '';
  position: absolute;
  top: -200px;
  right: -150px;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(184,134,11,0.06) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.hero-wrap::after {
  content: '';
  position: absolute;
  bottom: -100px;
  left: -100px;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(15,36,64,0.03) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.hero-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 3.5rem;
  position: relative;
  z-index: 1;
}

.hero-text { flex: 1; min-width: 0; }

.hero-text .overline {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #b8860b;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.hero-text h1 {
  font-family: var(--serif);
  font-size: 3rem;
  color: #0f2440;
  line-height: 1.12;
  font-weight: 700;
  margin-bottom: 0.4rem;
  letter-spacing: -0.5px;
}

.hero-text .sub {
  font-size: 1.05rem;
  color: #888;
  font-weight: 300;
  margin-bottom: 1.8rem;
}

/* ═══ SEARCH SECTION ═══ */
.search-section {
  background: #fff;
  border: 1px solid #e8e4de;
  border-radius: 14px;
  padding: 1.4rem;
  box-shadow: 0 4px 24px rgba(0,0,0,0.04);
}

.search-row {
  display: flex;
  background: #f8f7f4;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #e8e4de;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-row:focus-within {
  border-color: #b8860b;
  box-shadow: 0 0 0 3px rgba(184,134,11,0.1);
}

.search-row input {
  flex: 1;
  padding: 0.9rem 1.2rem;
  border: none;
  background: transparent;
  font-size: 0.95rem;
  outline: none;
  color: #333;
  font-family: var(--sans);
}

.search-row input::placeholder { color: #bbb; }

.search-row button {
  background: #0a1628;
  color: #fff;
  border: none;
  padding: 0 1.8rem;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.88rem;
  transition: background 0.2s;
  letter-spacing: 0.3px;
  font-family: var(--sans);
}

.search-row button:hover { background: #0f2440; }
.search-row button i { margin-right: 0.4rem; }

.search-extras {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.7rem;
  padding: 0 0.2rem;
}

.search-extras a {
  color: #0f2440;
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s;
}

.search-extras a:hover { color: #b8860b; }
.search-extras a i { margin-right: 0.3rem; }

.search-extras .nlp-tag {
  color: #aaa;
  font-size: 0.73rem;
}

.search-extras .nlp-tag i { color: #b8860b; margin-right: 0.2rem; }

/* ═══ ADVANCED SEARCH PANEL (inline slide-down) ═══ */
.advanced-panel {
  display: none;
  margin-top: 1rem;
  padding: 1.2rem;
  background: #faf9f7;
  border: 1px solid #e8e4de;
  border-radius: 10px;
}

.advanced-panel.open {
  display: block;
  animation: slideDown 0.25s ease;
}

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

.adv-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
}

.adv-grid .full { grid-column: 1 / -1; }

.adv-grid label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: #666;
  margin-bottom: 0.2rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.adv-grid input,
.adv-grid select {
  width: 100%;
  padding: 0.5rem 0.8rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.85rem;
  background: #fff;
  font-family: var(--sans);
  transition: border-color 0.2s;
}

.adv-grid input:focus,
.adv-grid select:focus {
  border-color: #b8860b;
  outline: none;
  box-shadow: 0 0 0 2px rgba(184,134,11,0.1);
}

.adv-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.8rem;
}

.adv-actions button {
  padding: 0.5rem 1.2rem;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--sans);
  transition: var(--ease);
}

.adv-actions .adv-btn {
  background: #0a1628;
  color: #fff;
  border: none;
}

.adv-actions .adv-btn:hover { background: #0f2440; }

.adv-actions .adv-cancel {
  background: #e8e4de;
  color: #555;
  border: none;
}

.adv-actions .adv-cancel:hover { background: #ddd8d0; }

/* ═══ HERO STATS ═══ */
.hero-stats {
  display: flex;
  gap: 2rem;
  margin-top: 1.2rem;
}

.hero-stats strong {
  display: block;
  font-size: 1.4rem;
  color: #0f2440;
  font-weight: 700;
  line-height: 1.2;
}

.hero-stats .stat-label {
  font-size: 0.72rem;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.hero-stats .stat-divider {
  width: 1px;
  background: #e0dbd2;
}

/* ═══ HERO VISUAL CARD ═══ */
.hero-visual {
  flex: 0 0 240px;
  background: linear-gradient(150deg, #0f2440 0%, #1a3a5f 60%, #b8860b 250%);
  border-radius: 16px;
  padding: 2rem 1.5rem;
  color: #fff;
  text-align: center;
  box-shadow: 0 8px 32px rgba(15,36,64,0.15);
}

.hero-visual .big {
  font-family: var(--serif);
  font-size: 2.6rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 0.3rem;
}

.hero-visual .big em { font-style: italic; color: #f0d080; }

.hero-visual .v-sub {
  font-size: 0.8rem;
  opacity: 0.75;
}

.hero-visual .v-divider {
  width: 40px;
  height: 2px;
  background: rgba(255,255,255,0.2);
  margin: 0.8rem auto;
  border-radius: 2px;
}

.hero-visual .v-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.3rem;
}

.hero-visual .v-tags span {
  background: rgba(255,255,255,0.1);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.65rem;
}

/* ═══ TWO-COLUMN CONTENT ═══ */
.content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2.5rem 3rem;
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 2.5rem;
}

/* ═══ SIDEBAR ═══ */
.sidebar-card {
  background: #fefcf9;
  border-radius: 12px;
  padding: 1.5rem;
  border: 1px solid #e8e0d4;
  box-shadow: 0 2px 12px rgba(0,0,0,0.03);
}

.sidebar h3 {
  font-family: var(--serif);
  font-size: 1rem;
  color: #0f2440;
  margin-bottom: 0.8rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #b8860b;
  display: inline-block;
}

.quick-links { list-style: none; }
.quick-links li { margin-bottom: 0.15rem; }

.quick-links a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: #555;
  text-decoration: none;
  font-size: 0.82rem;
  padding: 0.45rem 0.7rem;
  border-radius: 8px;
  transition: all 0.15s;
}

.quick-links a:hover { background: #f5f2ed; color: #0f2440; }

.quick-links i {
  width: 1.1rem;
  color: #b8860b;
  font-size: 0.8rem;
}

.subj-section { margin-top: 1.5rem; }

.subj-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.subj-tags a {
  background: #f5f2ed;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0.25rem 0.65rem;
  font-size: 0.74rem;
  color: #555;
  text-decoration: none;
  transition: all 0.15s;
}

.subj-tags a:hover {
  border-color: #b8860b;
  background: #fcf9f2;
  color: #0f2440;
}

/* ═══ MAIN RIGHT ═══ */
.main-right h2 {
  font-family: var(--serif);
  font-size: 1.15rem;
  color: #0f2440;
  margin-bottom: 0.8rem;
  font-weight: 600;
}

.type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(105px, 1fr));
  gap: 0.7rem;
  margin-bottom: 2rem;
}

.type-item {
  background: #fff;
  border: 1px solid #eeeae4;
  border-radius: 10px;
  padding: 0.9rem 0.5rem;
  text-align: center;
  text-decoration: none;
  color: #555;
  font-size: 0.76rem;
  transition: all 0.2s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.02);
}

.type-item:hover {
  border-color: #b8860b;
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(184,134,11,0.08);
}

.type-item i {
  font-size: 1.3rem;
  color: #0f2440;
  display: block;
  margin-bottom: 0.3rem;
}

.trending {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 2rem;
}

.trending a {
  background: #fff;
  border: 1px solid #eeeae4;
  border-radius: 20px;
  padding: 0.3rem 0.85rem;
  font-size: 0.76rem;
  color: #555;
  text-decoration: none;
  transition: all 0.15s;
}

.trending a:hover {
  border-color: #b8860b;
  color: #0f2440;
  box-shadow: 0 2px 8px rgba(184,134,11,0.06);
}

.about-box {
  background: #fff;
  border: 1px solid #eeeae4;
  border-radius: 12px;
  padding: 1.2rem 1.5rem;
  box-shadow: 0 2px 12px rgba(0,0,0,0.02);
}

.about-box p {
  font-size: 0.82rem;
  color: #777;
  line-height: 1.7;
}

/* ═══ FOOTER ═══ */
.footer {
  text-align: center;
  padding: 2rem;
  color: rgba(255,255,255,0.5);
  font-size: 0.76rem;
  background: #0f2440;
  border-top: 2px solid #b8860b;
  margin-top: 2rem;
}

.footer strong { color: rgba(255,255,255,0.7); }

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

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

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

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 14px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.35s ease;
}

@media (max-width: 800px) {
  .content { grid-template-columns: 1fr; padding: 1.5rem; }
  .hero-inner { flex-direction: column; }
  .hero-visual { flex: auto; width: 100%; }
  .adv-grid { grid-template-columns: 1fr; }
  .header { padding: 0 1rem; }
  .hero-wrap { padding: 2rem 1.5rem; }
  .hero-text h1 { font-size: 2rem; }
}

/* ═══ Top Bar ═══ */
.top-bar {
  background: var(--primary);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 3px solid var(--accent);
}

.top-bar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 54px;
}

.brand {
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  letter-spacing: -0.3px;
}

.brand i { color: #7bc47f; font-size: 1.1rem; }

.top-nav { display: flex; gap: 0.1rem; }

.top-nav a {
  color: rgba(255,255,255,0.65);
  padding: 0.35rem 0.8rem;
  border-radius: 4px;
  font-size: 0.82rem;
  font-weight: 500;
  transition: var(--ease);
  text-decoration: none;
}

.top-nav a:hover { color: #fff; background: rgba(255,255,255,0.08); }
.top-nav a.active { color: #fff; background: var(--accent); }

/* ═══ Main ═══ */
.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
  flex: 1;
  width: 100%;
}

/* ═══ Flash ═══ */
.flash-container { margin-bottom: 1rem; }
.alert { padding: 0.6rem 1rem; border-radius: 4px; margin-bottom: 0.4rem; font-size: 0.84rem; border: 1px solid transparent; }
.alert-success { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.alert-error { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.alert-warning { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.alert-info { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }

/* ═══════════════════════════════════════════════════
   HERO — Primo NDE-inspired
   ═══════════════════════════════════════════════════ */

.hero {
  text-align: center;
  padding: 4rem 1.5rem 3rem;
  background: var(--hero-gradient);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(255,255,255,0.06) 0%, transparent 60%);
  pointer-events: none;
}

.hero > * { position: relative; }

.hero h1 {
  font-size: 2.4rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 0.3rem;
  letter-spacing: -0.5px;
}

.hero p {
  font-size: 1rem;
  color: rgba(255,255,255,0.75);
  margin-bottom: 2rem;
  font-weight: 400;
}

.search-wrap {
  max-width: 680px;
  margin: 0 auto 1.2rem;
}

.hero .search-box {
  display: flex;
  background: rgba(255,255,255,0.12);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  overflow: hidden;
  transition: 0.25s ease;
}

.hero .search-box:focus-within {
  border-color: rgba(255,255,255,0.4);
  box-shadow: 0 0 0 3px rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.18);
}

.hero .search-box input {
  flex: 1;
  padding: 1rem 1.3rem;
  border: none;
  background: transparent;
  font-size: 1rem;
  font-family: var(--sans);
  color: #fff;
  outline: none;
}

.hero .search-box input::placeholder { color: rgba(255,255,255,0.5); }

.hero .search-box button {
  padding: 0 1.8rem;
  background: var(--accent);
  color: #fff;
  border: none;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--sans);
}

.hero .search-box button:hover { background: var(--accent-light); }

.hero-extras {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  margin-top: 0.7rem;
  flex-wrap: wrap;
}

.hero-extras a {
  color: rgba(255,255,255,0.6);
  font-size: 0.8rem;
  font-weight: 500;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: 0.2s ease;
}

.hero-extras a:hover { color: #fff; }

.nlp-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.7rem;
  background: rgba(107, 207, 127, 0.15);
  border: 1px solid rgba(107, 207, 127, 0.25);
  border-radius: 20px;
  font-size: 0.72rem;
  color: #7bc47f;
  font-weight: 500;
}

.nlp-tag i { font-size: 0.6rem; }

/* Hero Stats Bar */
.hero .hero-stats {
  display: inline-flex;
  align-items: center;
  gap: 1.8rem;
  padding: 0.7rem 1.8rem;
  margin-top: 1.8rem;
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
}

.hero .hero-stat {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: rgba(255,255,255,0.85);
  font-size: 0.78rem;
}

.hero .hero-stat strong, .hero .stat-number {
  font-size: 1rem;
  color: #fff;
  font-weight: 700;
}

.hero .hero-stat i { color: #7bc47f; font-size: 0.65rem; }

/* ═══ Quick Browse — Primo NDE ═══ */
.quick-browse {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 2rem;
}

.browse-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.2rem;
}

.browse-card h3 {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.browse-card h3 i { color: var(--accent); font-size: 0.7rem; }

.type-browse-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 0.5rem;
}

.type-browse-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 0.7rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  text-decoration: none;
  color: var(--text2);
  font-size: 0.68rem;
  font-weight: 500;
  transition: var(--ease);
  background: var(--card-hover);
}

.type-browse-item:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.type-browse-item i {
  font-size: 1.1rem;
  color: var(--primary);
}

.type-browse-item:hover i { color: var(--accent); }

/* ═══ Subject Tags ═══ */
.subj-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.subj-tag {
  display: inline-flex;
  padding: 0.25rem 0.7rem;
  background: var(--card-hover);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--text2);
  text-decoration: none;
  transition: var(--ease);
}

.subj-tag:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

/* ═══ Home Section Headers ═══ */
.section-header {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.8rem;
  padding-bottom: 0.3rem;
  border-bottom: 2px solid var(--accent);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.section-header i { color: var(--accent); font-size: 0.8rem; }

.home-section { margin-bottom: 2rem; }

/* ═══ Source Grid ═══ */
.source-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.source-card {
  padding: 0.8rem 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: var(--ease);
}

.source-card:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); }

.source-card h3 {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 0.15rem;
}

.source-card p {
  font-size: 0.7rem;
  color: var(--text2);
  line-height: 1.4;
}

/* ═══ Recent Searches ═══ */
.recent-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 1rem;
}

.recent-item {
  display: flex;
  justify-content: space-between;
  padding: 0.6rem 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.85rem;
  transition: var(--ease);
  text-decoration: none;
}

.recent-item:hover { border-color: var(--accent); color: var(--text); }
.recent-item i { color: var(--text3); font-size: 0.7rem; margin-right: 0.4rem; }
.recent-count { font-size: 0.7rem; color: var(--text3); }

/* ═══ About ═══ */
.about-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}

.about-card p { font-size: 0.84rem; color: var(--text2); line-height: 1.7; margin-bottom: 0.3rem; }

/* ═══════════════════════════════════════════════════
   RESULTS
   ═══════════════════════════════════════════════════ */

.results-header { margin-bottom: 1rem; }

.results-search-form { margin-bottom: 0.6rem; }

.search-box-sm { max-width: 600px; }

.search-box-sm input { padding: 0.65rem 1rem; font-size: 0.88rem; }

.search-box-sm button { padding: 0 1.2rem; font-size: 0.85rem; }

.results-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1rem;
  font-size: 0.82rem;
  color: var(--text2);
  align-items: center;
  margin-top: 0.3rem;
}

.result-total { font-weight: 600; color: var(--text); }
.meta-divider { color: var(--border); }

.source-count {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.76rem;
  font-weight: 500;
}

.source-count .count-num { font-weight: 700; font-size: 0.72rem; }

.results-layout {
  display: grid;
  grid-template-columns: 210px 1fr;
  gap: 1.25rem;
}

/* ═══ Facets ═══ */
.facet-sidebar {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  position: sticky;
  top: 4.5rem;
  max-height: calc(100vh - 6rem);
  overflow-y: auto;
}

.facet-sidebar h3 {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text3);
  margin-bottom: 0.4rem;
  margin-top: 1rem;
}

.facet-sidebar h3:first-child { margin-top: 0; }

.facet-group { margin-bottom: 0.8rem; }

.facet-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0;
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--text);
  transition: var(--ease);
}

.facet-item:hover { color: var(--accent); }
.facet-item input { accent-color: var(--accent); }

/* ═══ Result Cards ═══ */
.results-main { min-height: 50vh; }

.result-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.25rem;
  margin-bottom: 0.65rem;
  transition: var(--ease);
}

.result-card:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.result-type {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 0.15rem;
}

.result-title {
  font-size: 0.97rem;
  font-weight: 600;
  margin-bottom: 0.15rem;
  line-height: 1.4;
}

.result-title a { color: var(--primary); }
.result-title a:hover { color: var(--accent); }

.result-meta {
  font-size: 0.78rem;
  color: var(--text2);
  margin-bottom: 0.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
}

.result-authors { color: var(--text); }

.result-source {
  display: inline-block;
  padding: 0.08rem 0.45rem;
  border-radius: 3px;
  font-size: 0.64rem;
  font-weight: 600;
  white-space: nowrap;
}

.source-crossref { background: #e8f0fe; color: #1a56db; }
.source-doaj { background: #e6f7e6; color: #15803d; }
.source-openalex { background: #f3e8ff; color: #7c3aed; }
.source-oapen { background: #fff3e0; color: #b45309; }
.source-doab { background: #fce7f3; color: #be185d; }
.source-open_library, .source-open-library { background: #e0f2fe; color: #0369a1; }
.source-internet_archive, .source-internet-archive { background: #f5f5f0; color: #5a5a4a; }
.source-manual { background: #f5f5f0; color: #5a5a4a; }
.source-arxiv { background: #f0f4ff; color: #1a3a8a; }
.source-openstax { background: #fff7ed; color: #c2410c; }
.source-open_textbook_library, .source-open-textbook-library { background: #f0fdf4; color: #166534; }
.source-OAPEN { background: #fff3e0; color: #b45309; }
.source-springer-oa, .source-springer { background: #e8f5e9; color: #2e7d32; }
.source-pubmed-central, .source-pubmed_central { background: #e3f2fd; color: #1565c0; }

.source-count.source-crossref .count-num { color: #1a56db; }
.source-count.source-doaj .count-num { color: #15803d; }
.source-count.source-openalex .count-num { color: #7c3aed; }
.source-count.source-oapen .count-num { color: #b45309; }
.source-count.source-doab .count-num { color: #be185d; }
.source-count.source-open_library .count-num { color: #0369a1; }
.source-count.source-internet_archive .count-num { color: #5a5a4a; }
.source-count.source-arxiv .count-num { color: #1a3a8a; }
.source-count.source-openstax .count-num { color: #c2410c; }
.source-count.source-open_textbook_library .count-num { color: #166534; }
.source-count.source-oapen .count-num { color: #b45309; }
.source-count.source-springer-oa .count-num { color: #2e7d32; }
.source-count.source-pubmed-central .count-num { color: #1565c0; }

.result-journal { font-style: italic; font-size: 0.78rem; color: var(--text3); margin-bottom: 0.15rem; }

.result-abstract {
  font-size: 0.78rem;
  color: var(--text2);
  line-height: 1.6;
  margin-bottom: 0.3rem;
}

.result-subjects { margin-bottom: 0.15rem; }

.subject-tag {
  display: inline-block;
  padding: 0.04rem 0.45rem;
  background: #f0efe8;
  border-radius: 3px;
  font-size: 0.64rem;
  color: var(--text2);
  margin: 0.03rem 0.1rem;
}

.result-doi { font-size: 0.68rem; color: var(--text3); font-family: 'SF Mono', monospace; }

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.6rem;
  padding: 1.5rem 0;
}

.page-link {
  padding: 0.4rem 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 500;
  transition: var(--ease);
  text-decoration: none;
}

.page-link:hover { border-color: var(--accent); color: var(--accent); }

.page-info { font-size: 0.82rem; color: var(--text3); }

.no-results { text-align: center; padding: 3rem 1rem; color: var(--text2); }
.no-results p { margin-bottom: 0.4rem; }

/* ═══════════════════════════════════════════════════
   DETAIL
   ═══════════════════════════════════════════════════ */

.breadcrumb { font-size: 0.78rem; color: var(--text3); margin-bottom: 0.8rem; }
.breadcrumb i { font-size: 0.55rem; margin: 0 0.25rem; color: var(--text3); }

.detail-layout {
  max-width: 960px;
  margin: 0 auto;
}

.detail-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.detail-type {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 0.3rem;
}

.detail-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.8rem;
  line-height: 1.3;
}

.detail-meta { margin-bottom: 1rem; }

.meta-row {
  display: flex;
  padding: 0.4rem 0;
  border-bottom: 1px solid #f0efe8;
  font-size: 0.83rem;
}

.meta-label {
  width: 140px;
  flex-shrink: 0;
  font-weight: 600;
  color: var(--text2);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.meta-label i { color: var(--text3); font-size: 0.68rem; width: 14px; }

.source-badge {
  display: inline-block;
  padding: 0.08rem 0.45rem;
  border-radius: 3px;
  font-size: 0.72rem;
  font-weight: 600;
}

.detail-abstract h3, .detail-subjects h3 {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.3rem;
  margin-top: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.detail-abstract p { font-size: 0.85rem; color: var(--text2); line-height: 1.8; }

.detail-actions { margin-top: 0.8rem; }

/* ═══ Sidebar ═══ */
.sidebar-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.1rem;
  margin-bottom: 0.8rem;
}

.sidebar-card h3 {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.sidebar-card h3 i { color: var(--accent); font-size: 0.65rem; }

.citation-text {
  font-size: 0.76rem;
  line-height: 1.7;
  color: var(--text);
  padding: 0.5rem 0.6rem;
  background: #fafaf8;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
}

.craap-score-overview { text-align: center; margin-bottom: 0.6rem; }

.craap-circle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.25rem;
}

.craap-value { font-size: 1.3rem; font-weight: 700; line-height: 1; }
.craap-label { font-size: 0.55rem; font-weight: 600; opacity: 0.7; }
.craap-rating { font-size: 0.85rem; font-weight: 600; }

.craap-bars { margin-bottom: 0.5rem; }

.craap-bar-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.3rem;
  font-size: 0.74rem;
}

.craap-bar-label { width: 55px; flex-shrink: 0; color: var(--text2); }

.craap-bar-track {
  flex: 1;
  height: 4px;
  background: #e8e7e0;
  border-radius: 4px;
  overflow: hidden;
}

.craap-bar-fill { height: 100%; border-radius: 4px; transition: width 0.4s ease; }
.craap-bar-score { width: 24px; text-align: right; color: var(--text3); font-size: 0.68rem; }

/* ═══════════════════════════════════════════════════
   APA, CRAAP, SAVED, BUTTONS, FORMS
   ═══════════════════════════════════════════════════ */

.tool-header { margin-bottom: 1.25rem; }
.tool-header h1 { font-size: 1.4rem; font-weight: 700; color: var(--primary); }
.tool-header p { font-size: 0.85rem; color: var(--text2); margin-top: 0.15rem; }
.header-actions { margin-top: 0.4rem; }

.tool-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.tool-form-card, .tool-result-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}

.tool-result-card h2 { font-size: 0.85rem; font-weight: 700; color: var(--primary); margin-bottom: 0.5rem; }

.citation-result {
  font-size: 0.85rem;
  line-height: 1.8;
  padding: 0.7rem;
  background: #fafaf8;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
}

.citation-actions { margin-bottom: 0.8rem; }

.citation-preview h3 { font-size: 0.78rem; font-weight: 600; color: var(--text2); margin-bottom: 0.25rem; }

.ref-entry {
  font-size: 0.82rem;
  line-height: 1.7;
  padding: 0.5rem 0.7rem;
  background: #fafaf8;
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.form-group { margin-bottom: 0.7rem; }

.form-group label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 0.15rem;
}

.form-group input, .form-group textarea, .form-group select {
  width: 100%;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-family: var(--sans);
  color: var(--text);
  background: #fff;
  transition: var(--ease);
}

.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-subtle);
}

.form-row { display: flex; gap: 0.7rem; }
.half { flex: 1; width: 50%; }
.third { flex: 1; width: 33.33%; }
textarea { resize: vertical; min-height: 50px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.85rem;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 500;
  font-family: var(--sans);
  text-decoration: none;
  transition: var(--ease);
}

.btn:hover { background: #f5f4f0; border-color: #ccc; }

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

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

.btn-danger { background: #dc2626; color: #fff; border-color: #dc2626; }
.btn-danger:hover { background: #b91c1c; color: #fff; }

.btn-sm { padding: 0.25rem 0.65rem; font-size: 0.74rem; }
.btn-lg { padding: 0.6rem 1.2rem; font-size: 0.85rem; }

.craap-criterion { margin-bottom: 1rem; padding-bottom: 0.8rem; border-bottom: 1px solid #eee; }
.craap-criterion h3 { font-size: 0.9rem; font-weight: 600; color: var(--primary); margin-bottom: 0.15rem; }
.craap-weight { font-size: 0.72rem; color: var(--text3); font-weight: 400; }
.craap-desc { font-size: 0.77rem; color: var(--text2); margin-bottom: 0.3rem; }
.scale-group label { display: flex; align-items: center; gap: 0.5rem; font-size: 0.82rem; }
.scale-group input[type="range"] { flex: 1; accent-color: var(--accent); }
.craap-criterion textarea { width: 100%; padding: 0.45rem; border: 1px solid var(--border); border-radius: var(--radius); font-size: 0.78rem; font-family: var(--sans); margin-top: 0.25rem; }

.craap-result-circle { text-align: center; padding: 1rem; border-radius: var(--radius); margin-bottom: 0.8rem; }
.craap-result-value { font-size: 2.2rem; font-weight: 700; line-height: 1; }
.craap-result-label { font-size: 0.75rem; color: var(--text3); }
.craap-result-rating { font-size: 0.95rem; font-weight: 600; margin-top: 0.15rem; }
.craap-result-detail table { width: 100%; }
.craap-result-detail th { text-align: left; padding: 0.35rem 0.4rem; font-size: 0.68rem; text-transform: uppercase; color: var(--text3); border-bottom: 2px solid #eee; }
.craap-result-detail td { padding: 0.35rem 0.4rem; font-size: 0.82rem; border-bottom: 1px solid #f0efe8; }
.craap-note { color: var(--text2); font-size: 0.76rem; }
.mini-bar { width: 55px; height: 4px; background: #eee; border-radius: 4px; overflow: hidden; }
.mini-fill { height: 100%; border-radius: 4px; }

.saved-list { display: flex; flex-direction: column; gap: 0.65rem; }

.saved-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.1rem;
  transition: var(--ease);
}

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

.saved-type { font-size: 0.6rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); margin-bottom: 0.1rem; }
.saved-title { font-size: 0.97rem; font-weight: 600; color: var(--primary); margin-bottom: 0.2rem; }
.saved-meta { font-size: 0.78rem; color: var(--text2); margin-bottom: 0.3rem; display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; }
.saved-date { color: var(--text3); font-size: 0.72rem; }
.saved-citation { font-size: 0.78rem; color: var(--text); padding: 0.45rem; background: #fafaf8; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 0.5rem; }
.saved-actions { display: flex; gap: 0.35rem; }

.saved-notes { margin-top: 0.5rem; }
.notes-form { display: flex; gap: 0.4rem; align-items: flex-start; }
.notes-textarea { flex: 1; padding: 0.4rem 0.6rem; border: 1px solid var(--border); border-radius: 4px; font-size: 0.78rem; font-family: var(--sans); background: var(--card); color: var(--text); resize: vertical; min-height: 40px; }
.notes-textarea:focus { outline: none; border-color: var(--accent); }
.btn-xs { padding: 0.25rem 0.6rem; font-size: 0.72rem; border-radius: 4px; border: 1px solid var(--border); background: var(--card); color: var(--text2); cursor: pointer; transition: var(--ease); }
.btn-xs:hover { border-color: var(--accent); color: var(--text); }

.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text2); }
.empty-state p { margin-bottom: 0.4rem; }

.footer {
  text-align: center;
  padding: 1.25rem;
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}

.footer p { font-size: 0.7rem; color: var(--text3); }

/* ═══ Result Badges ═══ */
.result-badges { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.3rem; }
.badge { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.08rem 0.45rem; border-radius: 3px; font-size: 0.62rem; font-weight: 600; white-space: nowrap; }
.badge-license { background: #f0fdf4; color: #166534; }
.badge-doi { background: #f5f5f0; color: #6b7280; font-family: 'SF Mono', monospace; }
.badge-retracted { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.badge-retracted i { font-size: 0.55rem; }

/* ═══ Search Tips ═══ */
.search-tips { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.5rem; padding: 0.5rem 0.8rem; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 0.8rem; font-size: 0.74rem; color: var(--text2); }
.search-tips i { color: var(--accent); }
.search-tips code { background: var(--accent-subtle); padding: 0.1rem 0.35rem; border-radius: 3px; font-size: 0.7rem; color: var(--accent); }
.search-tips .tip-desc { font-size: 0.68rem; color: var(--text3); }

/* ═══ Trust Signals ═══ */
.trust-signals { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.8rem; }
.trust-badge { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.2rem 0.6rem; border-radius: 4px; font-size: 0.7rem; font-weight: 600; }
.license-badge { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.oa-badge { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.peer-badge { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.preprint-badge { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
.retracted-badge { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.retracted-badge i { color: #dc2626; }
.recs-loading { padding: 2rem; text-align: center; color: var(--text3); font-size: 0.9rem; }

/* ═══ Related Items (shared across detail tabs) ═══ */
.related-list { display: flex; flex-direction: column; gap: 0.3rem; }
.related-item { font-size: 0.82rem; padding: 0.4rem 0; border-bottom: 1px solid #f0efe8; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.3rem; }
.related-item:last-child { border-bottom: none; }
.related-type { display: inline-block; padding: 0.05rem 0.4rem; background: var(--accent-subtle); border-radius: 3px; font-size: 0.6rem; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; }
.related-item a { color: var(--primary); font-weight: 500; flex: 1; }
.related-item a:hover { color: var(--accent); }
.related-year { font-size: 0.7rem; color: var(--text3); white-space: nowrap; }
.source-badge-type { background: #f0f0f0; color: #555; border: 1px solid #ddd; }

/* ═══ Tabs ═══ */
.detail-tabs { margin-top: 1rem; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.tab-nav { display: flex; border-bottom: 2px solid var(--border); background: #fafaf8; overflow-x: auto; }
.tab-btn { padding: 0.65rem 1.2rem; border: none; background: none; font-size: 0.78rem; font-weight: 600; color: var(--text2); cursor: pointer; transition: var(--ease); white-space: nowrap; font-family: var(--sans); position: relative; }
.tab-btn:hover { color: var(--text); background: rgba(0,0,0,0.02); }
.tab-btn.active { color: var(--accent); background: var(--card); }
.tab-btn.active::after { content: ''; position: absolute; bottom: -2px; left: 0; right: 0; height: 2px; background: var(--accent); }
.tab-panel { display: none; padding: 1.25rem; }
.tab-panel.active { display: block; }

/* ═══ Citation Tab ═══ */
.citation-format-selector { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.6rem; flex-wrap: wrap; }
.citation-format-selector label { font-size: 0.78rem; font-weight: 600; color: var(--text2); }
.citation-format-selector select { padding: 0.3rem 0.6rem; border: 1px solid var(--border); border-radius: 4px; font-size: 0.78rem; font-family: var(--sans); color: var(--text); }
.citation-text { font-size: 0.82rem; line-height: 1.7; color: var(--text); padding: 0.7rem 0.9rem; background: #fafaf8; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 0.5rem; }
.save-cite-form { margin-top: 0.5rem; }

/* ═══ CRAAP Tab ═══ */
.craap-header { display: flex; gap: 1rem; align-items: center; margin-bottom: 0.8rem; flex-wrap: wrap; }
.craap-guide { flex: 1; font-size: 0.8rem; color: var(--text2); line-height: 1.6; }
.craap-guide i { color: var(--accent); }

/* ═══ SIFT + ACRL Tab ═══ */
.sift-intro { margin-bottom: 0.8rem; }
.sift-intro p { font-size: 0.82rem; color: var(--text2); line-height: 1.7; }
.sift-intro i { color: var(--accent); }
.acrl-overview { margin-top: 0.5rem; padding: 0.6rem; background: #f0f4ff; border-radius: var(--radius); }
.acrl-overview h4 { font-size: 0.78rem; font-weight: 700; color: var(--primary); margin-bottom: 0.2rem; display: flex; align-items: center; gap: 0.3rem; }
.acrl-overview h4 i { color: #3b82f6; }
.acrl-overview p { font-size: 0.72rem; color: var(--text2); line-height: 1.5; }
.sift-steps { margin-top: 0.5rem; }
.sift-category { margin-bottom: 0.8rem; padding-bottom: 0.6rem; border-bottom: 1px solid #f0efe8; }
.sift-category:last-child { border-bottom: none; }
.sift-acrl { font-size: 0.8rem; font-weight: 700; color: var(--primary); margin-bottom: 0.1rem; display: flex; align-items: center; gap: 0.3rem; }
.sift-acrl i { color: var(--accent); }
.sift-acrl-desc { font-size: 0.72rem; color: var(--text3); margin-bottom: 0.4rem; line-height: 1.5; }
.sift-prompt { padding: 0.5rem 0.6rem; margin-bottom: 0.4rem; background: #fafaf8; border-radius: var(--radius); border-left: 3px solid var(--accent); }
.sift-step-label { font-size: 0.78rem; display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.2rem; }
.sift-step-badge { display: inline-block; padding: 0.1rem 0.5rem; background: var(--accent); color: #fff; border-radius: 3px; font-size: 0.6rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.sift-prompt p { font-size: 0.74rem; color: var(--text2); margin: 0.15rem 0; line-height: 1.5; }
.sift-actions { list-style: none; padding: 0; margin: 0.1rem 0 0; }
.sift-actions li { font-size: 0.7rem; color: var(--text2); display: flex; align-items: center; gap: 0.25rem; padding: 0.08rem 0; }
.sift-actions li i { font-size: 0.6rem; color: var(--accent); }
.sift-signals { margin-top: 0.8rem; padding: 0.6rem; background: #fafaf8; border-radius: var(--radius); }
.sift-signals h4 { font-size: 0.78rem; font-weight: 700; color: var(--primary); margin-bottom: 0.4rem; display: flex; align-items: center; gap: 0.3rem; }
.sift-signals h4 i { color: var(--accent); }
.signals-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0.35rem; }
.signal-item { display: flex; justify-content: space-between; padding: 0.2rem 0.4rem; background: var(--card); border-radius: 3px; font-size: 0.72rem; }
.signal-label { font-weight: 600; color: var(--text2); }
.signal-value { color: var(--text); }

/* ═══ Related Works Tab ═══ */
.related-intro { font-size: 0.8rem; color: var(--text2); line-height: 1.6; margin-bottom: 0.6rem; }
.related-intro i { color: var(--accent); }
.source-badge-type { background: #f0f0f0; color: #555; border: 1px solid #ddd; }

/* ═══ Readability Badge ═══ */
.readability-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.08rem 0.45rem;
  border-radius: 3px;
  font-size: 0.62rem;
  font-weight: 600;
  white-space: nowrap;
  color: var(--rcolor, var(--text2));
  background: color-mix(in srgb, var(--rcolor, var(--text2)) 10%, transparent);
  margin-left: 0.3rem;
}
.readability-badge i { font-size: 0.55rem; }
.skeleton-wrapper { padding: 0.5rem 0; }
.skeleton-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.25rem;
  margin-bottom: 0.65rem;
}
.skeleton-line {
  height: 12px;
  background: linear-gradient(90deg, #f0efe8 25%, #e8e7e0 37%, #f0efe8 63%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease infinite;
  border-radius: 4px;
  margin-bottom: 8px;
}
.skeleton-line.sm { width: 30%; height: 10px; }
.skeleton-line.md { width: 65%; }
.skeleton-line.lg { width: 90%; height: 14px; }

/* ═══ Loading Overlay ═══ */
.loading-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--loading-overlay-bg);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}
.loading-spinner {
  width: 44px; height: 44px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 1rem;
}
.loading-text { font-size: 0.95rem; color: var(--text2); font-weight: 500; }
.loading-sub { font-size: 0.8rem; color: var(--text3); margin-top: 0.3rem; }

/* ═══ Advanced Search Modal ═══ */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.modal-content {
  background: var(--card);
  border-radius: var(--radius-xl);
  box-shadow: 0 25px 50px rgba(0,0,0,0.15);
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.5rem;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.2rem;
}

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.modal-header h3 i { color: var(--accent); }

.modal-close {
  background: none;
  border: none;
  font-size: 1.6rem;
  cursor: pointer;
  color: var(--text3);
  line-height: 1;
  padding: 0 0.3rem;
}

.modal-close:hover { color: var(--text); }

.advanced-form .hint {
  font-weight: 400;
  color: var(--text3);
  font-size: 0.7rem;
}

/* ═══ NLP Detection Notice ═══ */
.nlp-notice {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.8rem;
  background: var(--nlp-notice-bg);
  border: 1px solid var(--nlp-notice-border);
  border-radius: var(--radius);
  margin-bottom: 0.8rem;
  font-size: 0.78rem;
  color: var(--nlp-notice-text);
}

.nlp-notice i { color: #6366f1; font-size: 0.85rem; }
.nlp-type { color: var(--text2); }
.nlp-filter-link { color: var(--accent); font-weight: 600; text-decoration: underline; }
.nlp-filter-link:hover { color: var(--accent-light); }
.nlp-original { color: var(--text3); font-size: 0.72rem; }

/* ═══ Auth Forms ═══ */
.auth-form { max-width: 400px; margin: 2rem auto; background: var(--card); padding: 2rem; border: 1px solid var(--border); border-radius: var(--radius-lg); }
.auth-form h1 { font-size: 1.3rem; color: var(--primary); margin-bottom: 1.2rem; display: flex; align-items: center; gap: 0.4rem; }
.auth-form h1 i { color: var(--accent); }
.auth-form .form-group { margin-bottom: 0.8rem; }
.auth-form label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--text2); margin-bottom: 0.2rem; }
.auth-form input { width: 100%; padding: 0.55rem 0.7rem; border: 1px solid var(--border); border-radius: var(--radius); font-size: 0.85rem; background: var(--bg); color: var(--text); font-family: var(--sans); }
.auth-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-subtle); }
.auth-form .btn { width: 100%; margin-top: 0.3rem; }
.auth-alt { text-align: center; margin-top: 1rem; font-size: 0.82rem; color: var(--text2); }
.auth-alt a { color: var(--accent); font-weight: 600; }

/* ═══ Page Header ═══ */
.page-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.page-header h1 { font-size: 1.2rem; color: var(--primary); font-weight: 700; display: flex; align-items: center; gap: 0.4rem; }
.page-header h1 i { color: var(--accent); }
.header-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }

/* ═══ Saved Resources ═══ */
.saved-card { position: relative; }
.saved-actions { margin-top: 0.5rem; display: flex; gap: 0.4rem; }
.btn-danger { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.btn-danger:hover { background: #fee2e2; }

/* ═══ Results Header Actions ═══ */
.results-actions {
  display: flex;
  gap: 0.35rem;
  flex-shrink: 0;
}

.results-search-form {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
  flex-wrap: wrap;
}

/* ═══ Responsive ═══ */
@media (max-width: 960px) {
  .results-layout { grid-template-columns: 1fr; }
  .facet-sidebar { position: static; max-height: none; }
  .detail-layout { grid-template-columns: 1fr; }
  .tool-layout { grid-template-columns: 1fr; }
  .form-row { flex-direction: column; gap: 0; }
  .half, .third { width: 100%; }
}

@media (max-width: 768px) {
  .quick-browse { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.6rem; }
  .hero { padding: 2.5rem 1rem 2rem; }
  .hero .hero-stats { flex-wrap: wrap; gap: 0.8rem; justify-content: center; }
  .top-bar-inner { height: auto; padding: 0.5rem 1rem; }
}

@media (max-width: 480px) {
  .type-browse-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ═══ Dark Mode Specific Overrides ═══ */
[data-theme="dark"] .subject-tag { background: #2a2a2a; color: var(--text2); }
[data-theme="dark"] .citation-text { background: #252525; }
[data-theme="dark"] .ref-entry { background: #252525; }
[data-theme="dark"] .saved-citation { background: #252525; border-color: var(--border); }
[data-theme="dark"] .sift-signals { background: #252525; }
[data-theme="dark"] .acrl-overview { background: #1a2744; }
[data-theme="dark"] .craap-criterion { border-bottom-color: var(--border); }
[data-theme="dark"] .meta-row { border-bottom-color: var(--border); }
[data-theme="dark"] .source-card[style*="background"] { background: var(--card) !important; }
[data-theme="dark"] .search-box { background: var(--card); }
[data-theme="dark"] .tab-nav { background: var(--card-hover); }
[data-theme="dark"] .search-tips { background: var(--card); }
[data-theme="dark"] .craap-guide a { color: var(--accent); }
[data-theme="dark"] .recent-item { background: var(--card); }
[data-theme="dark"] .skeleton-line { background: linear-gradient(90deg, #2a2a2a 25%, #333 37%, #2a2a2a 63%); }
[data-theme="dark"] .result-card { background: var(--card); }
[data-theme="dark"] .page-link { background: var(--card); }
[data-theme="dark"] .about-card { background: var(--card); }
[data-theme="dark"] .trending-pill { background: var(--card); }
[data-theme="dark"] .modal-content { background: var(--card); }
[data-theme="dark"] .facet-sidebar { background: var(--card); }
[data-theme="dark"] .source-card { background: var(--card); }
[data-theme="dark"] .browse-card { background: var(--card); }
[data-theme="dark"] .type-browse-item { background: var(--card-hover); }
[data-theme="dark"] .type-browse-item i { color: var(--primary); }
[data-theme="dark"] .subj-tag { background: var(--card-hover); }
[data-theme="dark"] .subj-tag:hover { border-color: var(--accent); color: var(--accent); }
[data-theme="dark"] .brand i { color: var(--accent); }

/* ═══ Dark Mode Toggle ═══ */
.nav-status {
  display: inline-flex;
  align-items: center;
  color: rgba(255,255,255,0.5);
  font-size: 0.85rem;
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
  text-decoration: none;
  transition: var(--ease);
}
.nav-status:hover { color: #fff; background: rgba(255,255,255,0.08); }

.dark-toggle {
  background: none;
  border: none;
  color: rgba(255,255,255,0.6);
  font-size: 1rem;
  cursor: pointer;
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
  transition: var(--ease);
  display: flex;
  align-items: center;
}
.dark-toggle:hover { color: #fff; background: rgba(255,255,255,0.08); }

/* ═══ Stat Counter Animations ═══ */
.stat-number {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
}
.stat-number .stat-plus { font-size: 0.8rem; color: var(--accent); }

/* ═══ Trending Bar ═══ */
.trending-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 2rem;
}
.trending-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.8rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 0.78rem;
  color: var(--text2);
  text-decoration: none;
  transition: var(--ease);
}
.trending-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 2px 8px rgba(43,111,60,0.1);
  transform: translateY(-1px);
}
.trending-pill i { font-size: 0.6rem; color: var(--accent); }

/* ═══ Quick Links (My Account on index) ═══ */
.quick-links { margin-bottom: 1.5rem; }
.quick-links .browse-card h3 { font-size: 0.95rem; }

/* ═══ Reading List Cards ═══ */
.lists-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.list-card {
  display: block;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.2rem;
  text-decoration: none;
  color: var(--text);
  transition: var(--ease);
}
.list-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.list-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.list-card-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0;
  color: var(--text);
}
.list-card-desc {
  font-size: 0.82rem;
  color: var(--text2);
  margin: 0 0 0.6rem;
  line-height: 1.4;
}
.list-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  font-size: 0.75rem;
  color: var(--text3);
}
.list-card-meta i { margin-right: 0.2rem; }
.list-badge {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  white-space: nowrap;
}
.public-badge {
  background: rgba(43,111,60,0.1);
  color: var(--accent);
}
.private-badge {
  background: rgba(150,150,150,0.1);
  color: var(--text3);
}
.list-section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text2);
  margin: 0 0 0.8rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--border-light);
}

/* ═══ List Detail Page ═══ */
.list-desc {
  color: var(--text2);
  margin: 0.3rem 0;
  font-size: 0.9rem;
}
.list-meta-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--text3);
  margin-top: 0.3rem;
}
.list-meta-item i { margin-right: 0.25rem; }
.list-item-card {
  border-left: 3px solid var(--accent);
}
.item-notes {
  margin-top: 0.3rem;
  font-size: 0.8rem;
  color: var(--text2);
  background: var(--accent-subtle);
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius);
}
.item-notes i { margin-right: 0.3rem; }

/* ═══ Add to List Dropdown ═══ */
.add-to-list-wrapper {
  position: relative;
  display: inline-block;
}
.add-to-list-dropdown {
  position: absolute;
  z-index: 100;
  top: 100%;
  left: 0;
  margin-top: 0.3rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem;
  min-width: 220px;
  box-shadow: var(--shadow-lg);
}
.add-to-list-dropdown .list-options {
  max-height: 200px;
  overflow-y: auto;
}

/* ═══ List Form ═══ */
.list-form { max-width: 600px; }
.list-form .form-hint {
  font-size: 0.75rem;
  color: var(--text3);
  font-weight: normal;
}
.list-form .checkbox-group label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  cursor: pointer;
}

/* ═══ Syllabus Upload Form ═══ */
.syllabus-form { max-width: 700px; }
.syllabus-form .form-hint {
  font-size: 0.75rem;
  color: var(--text3);
  display: block;
  margin-top: 0.2rem;
}
.syllabus-form .form-divider {
  text-align: center;
  margin: 1rem 0;
  border-top: 1px solid var(--border);
  position: relative;
}
.syllabus-form .form-divider span {
  background: var(--bg);
  padding: 0 0.6rem;
  position: relative;
  top: -0.7rem;
  color: var(--text3);
  font-size: 0.8rem;
}
.syllabus-form textarea {
  font-family: var(--sans);
  line-height: 1.5;
}
.syllabus-form input[type="file"] {
  border: 1px dashed var(--border);
  padding: 0.6rem;
  border-radius: var(--radius);
  background: var(--card);
  width: 100%;
  box-sizing: border-box;
  cursor: pointer;
}

/* ═══ Admin Panel ═══ */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.admin-table th {
  background: var(--primary);
  color: #fff;
  text-align: left;
  padding: 0.6rem 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.admin-table td {
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.9rem;
}
.admin-table tr:last-child td { border-bottom: none; }
.role-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  text-transform: uppercase;
}
.role-student { background: rgba(100,100,100,0.1); color: var(--text3); }
.role-instructor { background: rgba(43,111,60,0.1); color: var(--accent); }
.role-admin { background: rgba(220,38,38,0.1); color: #dc2626; }
.role-form select {
  font-size: 0.8rem;
  padding: 0.2rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
}
