:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-alt: #f1f5f9;
  --text: #0f172a;
  --text-muted: #475569;
  --border: #e2e8f0;
  --primary: #1e3a8a;
  --primary-hover: #1d4ed8;
  --accent: #d97706;
  --accent-soft: #fef3c7;
  --success: #059669;
  --danger: #dc2626;
  --shadow: 0 4px 20px rgba(15, 23, 42, 0.07);
  --radius: 12px;
}

[data-theme="dark"] {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-alt: #334155;
  --text: #f1f5f9;
  --text-muted: #cbd5e1;
  --border: #334155;
  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --accent: #f59e0b;
  --accent-soft: #451a03;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Noto Sans Devanagari', 'Nirmala UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background 0.2s, color 0.2s;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; }

.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }

/* Top Banner */
.top-notice {
  background: linear-gradient(90deg, #7c2d12, #b45309);
  color: #fff;
  text-align: center;
  padding: 6px 12px;
  font-size: 0.85rem;
  font-weight: 600;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 10px rgba(0,0,0,0.04);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 64px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo {
  width: 40px; height: 40px; border-radius: 10px;
  background: linear-gradient(135deg, #1e3a8a, #d97706);
  color: #fff; font-weight: 800; font-size: 1rem;
  display: grid; place-items: center;
}
.brand-text h1 { font-size: 1rem; line-height: 1.2; font-weight: 800; color: var(--primary); }
.brand-text span { font-size: 0.72rem; color: var(--text-muted); display: block; }

.nav-links { display: none; gap: 18px; align-items: center; font-weight: 600; font-size: 0.92rem; }
.nav-links a:hover { color: var(--primary); }
.header-actions { display: flex; gap: 8px; align-items: center; }

@media (min-width: 860px) {
  .nav-links { display: flex; }
  .mobile-menu-btn { display: none; }
}

.mobile-nav {
  display: none;
  flex-direction: column;
  gap: 8px;
  padding: 12px 16px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.mobile-nav.open { display: flex; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 8px; border: 1px solid transparent;
  font-weight: 600; font-size: 0.9rem; cursor: pointer; transition: 0.15s ease;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { filter: brightness(1.08); }
.btn-outline { background: transparent; border-color: var(--border); color: var(--text); }
.btn-outline:hover { background: var(--surface-alt); }
.btn-sm { padding: 6px 12px; font-size: 0.82rem; }
.btn-success { background: var(--success); color: #fff; }

/* Hero */
.hero {
  background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 55%, #0f172a 100%);
  color: #fff;
  padding: 48px 0;
}
.hero-grid { display: grid; gap: 28px; align-items: center; }
@media (min-width: 860px) { .hero-grid { grid-template-columns: 1.3fr 1fr; } }
.hero-badge {
  display: inline-block; background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.28);
  padding: 4px 12px; border-radius: 999px; font-size: 0.8rem; margin-bottom: 14px;
}
.hero h2 { font-size: 1.85rem; line-height: 1.3; margin-bottom: 12px; font-weight: 800; }
@media (min-width: 768px) { .hero h2 { font-size: 2.35rem; } }
.hero p { color: #e2e8f0; margin-bottom: 20px; font-size: 1rem; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; }
.hero-stats {
  background: rgba(255,255,255,0.09); border: 1px solid rgba(255,255,255,0.18);
  border-radius: var(--radius); padding: 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
}
.stat-card strong { display: block; font-size: 1.5rem; color: #fbbf24; }
.stat-card span { font-size: 0.82rem; color: #cbd5e1; }

/* Sections */
.section { padding: 42px 0; }
.section-alt { background: var(--surface-alt); }
.section-head { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 12px; margin-bottom: 24px; }
.section-head h2 { font-size: 1.5rem; font-weight: 800; color: var(--primary); }
.section-head p { color: var(--text-muted); font-size: 0.92rem; }

/* Categories */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.cat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); cursor: pointer; transition: transform 0.15s;
}
.cat-card:hover { transform: translateY(-3px); border-color: var(--primary); }
.cat-card h3 { font-size: 1.1rem; margin-bottom: 4px; color: var(--primary); }
.cat-card p { font-size: 0.85rem; color: var(--text-muted); }

/* Filters Bar */
.filter-bar {
  display: grid; gap: 12px; margin-bottom: 24px;
  background: var(--surface); padding: 14px; border-radius: var(--radius); border: 1px solid var(--border);
}
@media (min-width: 768px) { .filter-bar { grid-template-columns: 2fr 1fr 1fr; } }
.input, .select {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg); color: var(--text); font-size: 0.92rem;
}

/* Book Cards */
.books-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 20px; }
.book-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column;
  transition: transform 0.18s;
}
.book-card:hover { transform: translateY(-4px); }

.book-cover {
  padding: 18px 16px; color: #fff; min-height: 150px;
  display: flex; flex-direction: column; justify-content: space-between;
}
.theme-amber { background: linear-gradient(135deg, #92400e, #d97706); }
.theme-emerald { background: linear-gradient(135deg, #065f46, #10b981); }
.theme-indigo { background: linear-gradient(135deg, #312e81, #4f46e5); }
.theme-navy { background: linear-gradient(135deg, #1e3a8a, #2563eb); }
.theme-cyan { background: linear-gradient(135deg, #155e75, #0891b2); }
.theme-purple { background: linear-gradient(135deg, #581c87, #9333ea); }
.theme-teal { background: linear-gradient(135deg, #115e59, #0d9488); }
.theme-crimson { background: linear-gradient(135deg, #7f1d1d, #dc2626); }
.theme-orange { background: linear-gradient(135deg, #9a3412, #ea580c); }

.cover-badge {
  align-self: flex-start; background: rgba(255,255,255,0.2); padding: 2px 9px;
  border-radius: 999px; font-size: 0.72rem; font-weight: 700;
}
.cover-title { font-size: 1.18rem; font-weight: 800; margin-top: 8px; }
.cover-sub { font-size: 0.78rem; opacity: 0.9; }

.book-body { padding: 16px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.book-meta { display: flex; flex-wrap: wrap; gap: 6px; font-size: 0.76rem; color: var(--text-muted); }
.pill { background: var(--surface-alt); padding: 3px 8px; border-radius: 6px; font-weight: 600; }
.book-desc { font-size: 0.86rem; color: var(--text-muted); flex: 1; }
.book-price-row { display: flex; align-items: baseline; gap: 8px; }
.price-now { font-size: 1.25rem; font-weight: 800; color: var(--success); }
.price-mrp { font-size: 0.85rem; text-decoration: line-through; color: var(--text-muted); }
.book-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 4px; }

/* Steps & Author */
.steps-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; }
.step-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.step-num {
  width: 30px; height: 30px; border-radius: 50%; background: var(--primary); color: #fff;
  display: grid; place-items: center; font-weight: 800; margin-bottom: 10px;
}

.author-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow); display: grid; gap: 16px;
}
@media (min-width: 768px) { .author-card { grid-template-columns: 1.4fr 1fr; } }

/* Book Details View */
.details-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow); display: grid; gap: 24px;
}
@media (min-width: 820px) { .details-card { grid-template-columns: 320px 1fr; } }
.feature-list { list-style: none; display: grid; gap: 6px; margin: 12px 0; }
.feature-list li::before { content: "✓ "; color: var(--success); font-weight: 800; }

/* Modal & Auth */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.65);
  display: none; align-items: center; justify-content: center; z-index: 100; padding: 16px;
}
.modal-backdrop.open { display: flex; }
.modal-box {
  background: var(--surface); border-radius: var(--radius); max-width: 440px; width: 100%;
  padding: 22px; box-shadow: 0 20px 50px rgba(0,0,0,0.3); border: 1px solid var(--border);
}

/* Tables for Dashboard / Admin */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
table.data-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
table.data-table th, table.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; }
table.data-table th { background: var(--surface-alt); font-weight: 700; }

/* Footer */
.site-footer {
  background: #0f172a; color: #cbd5e1; padding: 36px 0 20px; margin-top: 40px;
}
.footer-grid { display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.footer-grid h4 { color: #fff; margin-bottom: 10px; font-size: 1rem; }
.footer-links { list-style: none; display: grid; gap: 6px; font-size: 0.86rem; }
.footer-links a:hover { color: #fbbf24; }
.footer-bottom {
  border-top: 1px solid #334155; margin-top: 24px; padding-top: 14px;
  text-align: center; font-size: 0.82rem; color: #94a3b8;
}

.hidden { display: none !important; }
.alert { padding: 10px 14px; border-radius: 8px; font-size: 0.88rem; margin: 10px 0; }
.alert-info { background: #dbeafe; color: #1e3a8a; }
.alert-err { background: #fee2e2; color: #991b1b; }
.alert-ok { background: #d1fae5; color: #065f46; }
