:root {
  --primary: #0D47A1;
  --primary-light: #1976D2;
  --accent: #FF8F00;
  --success: #2E7D32;
  --bg: #F4F7FA;
  --card: #FFFFFF;
  --text: #1E293B;
  --muted: #64748B;
  --border: #E2E8F0;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Noto Sans Devanagari', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.topbar {
  background: linear-gradient(135deg, #0A2E6E, var(--primary));
  color: #fff;
  padding: 14px 20px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.12);
}
.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.brand h1 { font-size: 1.4rem; font-weight: 800; }
.brand .session-pill {
  display: inline-block;
  background: var(--accent);
  color: #111;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 2px 10px;
  border-radius: 999px;
  margin-left: 8px;
  vertical-align: middle;
}
.nav-links { display: flex; gap: 12px; flex-wrap: wrap; }
.nav-links a {
  color: #E3F2FD;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 6px;
  transition: background 0.2s;
}
.nav-links a:hover { background: rgba(255,255,255,0.15); color: #fff; }

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

.hero {
  background: linear-gradient(135deg, #E3F2FD, #FFFFFF);
  border: 1px solid #BBDEFB;
  border-left: 6px solid var(--primary);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
}
.hero h2 { color: var(--primary); font-size: 1.5rem; margin-bottom: 8px; }
.search-box {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  max-width: 650px;
}
.search-box input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid #90CAF9;
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
}

.section-title {
  font-size: 1.3rem;
  color: var(--primary);
  margin: 26px 0 14px;
  padding-left: 10px;
  border-left: 4px solid var(--accent);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 16px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.card-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  background: #E3F2FD;
  color: var(--primary);
  margin-bottom: 8px;
}
.card-badge.verified { background: #E8F5E9; color: var(--success); }
.card h3 { font-size: 1.05rem; margin-bottom: 6px; color: #0F172A; }
.card p { font-size: 0.88rem; color: var(--muted); margin-bottom: 12px; }

.btn {
  display: inline-block;
  text-align: center;
  padding: 10px 16px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
  cursor: pointer;
  border: none;
  font-family: inherit;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-light); }
.btn-accent { background: var(--accent); color: #111; }
.btn-outline { background: #fff; color: var(--primary); border: 1.5px solid var(--primary); }

.footer {
  background: #0F172A;
  color: #CBD5E1;
  text-align: center;
  padding: 20px;
  margin-top: 40px;
  font-size: 0.85rem;
}

@media (max-width: 640px) {
  .topbar-inner { flex-direction: column; align-items: flex-start; }
  .hero { padding: 16px; }
  .grid, .library-grid { grid-template-columns: 1fr !important; }
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.card, .subject-row, code {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Course Dashboard Modal */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.72);
  z-index: 999;
  justify-content: center;
  align-items: center;
  padding: 16px;
  overflow-y: auto;
}
.modal-backdrop.open { display: flex; }
.modal-box {
  background: #fff;
  width: 100%;
  max-width: 880px;
  max-height: 90vh;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0,0,0,0.35);
}
.modal-header {
  background: var(--primary);
  color: #fff;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.modal-close {
  background: rgba(255,255,255,0.2);
  color: #fff;
  border: none;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  font-size: 1.2rem;
  cursor: pointer;
  flex-shrink: 0;
}
.modal-body {
  padding: 18px 20px;
  overflow-y: auto;
}
.period-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}
.period-tab {
  padding: 6px 14px;
  border: 1.5px solid var(--border);
  background: #F8FAFC;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  font-family: inherit;
}
.period-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.subject-row {
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary-light);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 10px;
  background: #FFFFFF;
}
.subject-row-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.res-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.res-pill {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 6px;
  text-decoration: none;
  background: #EFF6FF;
  color: #1D4ED8;
  border: 1px solid #BFDBFE;
}
.res-pill:hover { background: #DBEAFE; }
.res-pill.green { background: #ECFDF5; color: #047857; border-color: #A7F3D0; }
.res-pill.amber { background: #FFFBEB; color: #B45309; border-color: #FDE68A; }
.res-pill.muted { background: #F1F5F9; color: #64748B; border-color: #E2E8F0; }

