/* =========================================================
   e-පසාල — Modern Neumorphism Stylesheet
   ========================================================= */
:root {
  --bg: #e6e9ef;
  --bg-elev: #e6e9ef;
  --text: #2f3542;
  --text-muted: #6b7280;
  --accent: #6c63ff;
  --accent-2: #17c3b2;
  --shadow-light: #ffffff;
  --shadow-dark: #c3c8d4;
  --radius: 20px;
  --radius-sm: 12px;
  --si: #ff8a65;
  --ta: #4fc3f7;
  --en: #81c784;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', 'Noto Sans Sinhala', 'Noto Sans Tamil', Roboto, Arial, sans-serif;
  scroll-behavior: smooth;
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 18px;
}

/* ---------- Neumorphic base ---------- */
.neu {
  background: var(--bg);
  border-radius: var(--radius);
  box-shadow: 8px 8px 16px var(--shadow-dark), -8px -8px 16px var(--shadow-light);
}
.neu-inset {
  background: var(--bg);
  border-radius: var(--radius-sm);
  box-shadow: inset 5px 5px 10px var(--shadow-dark), inset -5px -5px 10px var(--shadow-light);
}
.neu-card {
  background: var(--bg);
  border-radius: var(--radius);
  box-shadow: 8px 8px 18px var(--shadow-dark), -8px -8px 18px var(--shadow-light);
  padding: 22px;
  margin-bottom: 24px;
  transition: transform .25s ease, box-shadow .25s ease;
}
.neu-btn {
  border: none;
  cursor: pointer;
  background: var(--bg);
  border-radius: 14px;
  padding: 12px 22px;
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
  box-shadow: 6px 6px 12px var(--shadow-dark), -6px -6px 12px var(--shadow-light);
  transition: all .18s ease;
}
.neu-btn:hover { transform: translateY(-2px); }
.neu-btn:active,
.neu-btn.active {
  box-shadow: inset 4px 4px 8px var(--shadow-dark), inset -4px -4px 8px var(--shadow-light);
  transform: translateY(0);
}
.neu-btn.primary {
  background: linear-gradient(135deg, var(--accent), #8f88ff);
  color: #fff;
  box-shadow: 6px 6px 14px rgba(108,99,255,.35), -6px -6px 14px var(--shadow-light);
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  box-shadow: 0 4px 14px rgba(0,0,0,.06);
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  max-width: 1180px;
  margin: 0 auto;
  gap: 10px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 20px;
}
.brand img {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: 4px 4px 8px var(--shadow-dark), -4px -4px 8px var(--shadow-light);
}
.brand-sub { font-size: 11px; color: var(--text-muted); font-weight: 500; }

.lang-toggle {
  display: flex;
  gap: 6px;
  background: var(--bg);
  padding: 6px;
  border-radius: 16px;
  box-shadow: inset 4px 4px 8px var(--shadow-dark), inset -4px -4px 8px var(--shadow-light);
}
.lang-toggle button {
  border: none;
  background: transparent;
  padding: 8px 12px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-muted);
  transition: all .18s ease;
}
.lang-toggle button.active {
  background: var(--bg);
  color: var(--text);
  box-shadow: 3px 3px 6px var(--shadow-dark), -3px -3px 6px var(--shadow-light);
}
.lang-toggle button[data-lang="si"].active { color: var(--si); }
.lang-toggle button[data-lang="ta"].active { color: var(--ta); }
.lang-toggle button[data-lang="en"].active { color: #4258d6; }

/* ---------- Hero ---------- */
.hero {
  padding: 34px 0 10px;
  text-align: center;
}
.hero h1 {
  font-size: clamp(22px, 4vw, 34px);
  margin: 0 0 6px;
}
.hero p { color: var(--text-muted); margin: 0 0 22px; font-size: 15px; }

/* ---------- Search box ---------- */
.search-box {
  padding: 20px;
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 14px;
  margin: 0 0 30px;
}
@media (max-width: 720px) {
  .search-box { grid-template-columns: 1fr; }
}
.search-box select,
.search-box input {
  width: 100%;
  border: none;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 13px 16px;
  font-size: 15px;
  color: var(--text);
  box-shadow: inset 4px 4px 8px var(--shadow-dark), inset -4px -4px 8px var(--shadow-light);
  appearance: none;
}
.search-box button {
  white-space: nowrap;
}

/* ---------- Section headings ---------- */
.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 30px 0 16px;
  font-size: 19px;
  font-weight: 800;
}
.section-title .pill {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg);
  box-shadow: 3px 3px 6px var(--shadow-dark), -3px -3px 6px var(--shadow-light);
  color: var(--accent);
}

/* ---------- Grade grid ---------- */
.grade-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 16px;
  margin-bottom: 10px;
}
.grade-card {
  cursor: pointer;
  padding: 18px 10px;
  text-align: center;
  border-radius: var(--radius);
  background: var(--bg);
  box-shadow: 7px 7px 14px var(--shadow-dark), -7px -7px 14px var(--shadow-light);
  transition: transform .2s ease, box-shadow .2s ease;
  font-weight: 700;
}
.grade-card:hover { transform: translateY(-4px); }
.grade-card.selected {
  box-shadow: inset 4px 4px 8px var(--shadow-dark), inset -4px -4px 8px var(--shadow-light);
  color: var(--accent);
}
.grade-card .grade-num {
  font-size: 26px;
  display: block;
  margin-bottom: 4px;
}
.grade-card .grade-tag {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* ---------- Subject grid ---------- */
.subject-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px;
}
.subject-card {
  cursor: pointer;
  border-radius: var(--radius);
  background: var(--bg);
  box-shadow: 7px 7px 14px var(--shadow-dark), -7px -7px 14px var(--shadow-light);
  padding: 16px 12px;
  text-align: center;
  transition: transform .2s ease;
}
.subject-card:hover { transform: translateY(-4px); }
.subject-card .icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 10px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  background: var(--bg);
  box-shadow: inset 3px 3px 6px var(--shadow-dark), inset -3px -3px 6px var(--shadow-light);
  overflow: hidden;
}
.subject-card .icon img { width: 100%; height: 100%; object-fit: cover; }
.subject-card .name { font-size: 13px; font-weight: 700; line-height: 1.3; }
.subject-card .cat { font-size: 10px; color: var(--text-muted); margin-top: 4px; }

/* ---------- Content list ---------- */
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0;
}
.filter-row button {
  padding: 8px 16px;
  font-size: 13px;
  border-radius: 12px;
}

.content-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.content-item {
  padding: 16px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  box-shadow: 6px 6px 12px var(--shadow-dark), -6px -6px 12px var(--shadow-light);
}
.content-item h4 { margin: 0 0 6px; font-size: 15px; }
.content-item p { margin: 0 0 10px; font-size: 12.5px; color: var(--text-muted); }
.content-item .meta { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.tag {
  font-size: 10px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--bg);
  box-shadow: 2px 2px 4px var(--shadow-dark), -2px -2px 4px var(--shadow-light);
  font-weight: 700;
}
.tag.medium-sinhala { color: var(--si); }
.tag.medium-tamil { color: var(--ta); }
.tag.medium-english { color: #4258d6; }
.content-item a.open-btn {
  display: inline-block;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent-2), #35d0c0);
  color: #fff;
}
.empty-state { text-align: center; color: var(--text-muted); padding: 30px 10px; }

/* ---------- Footer ---------- */
footer {
  text-align: center;
  padding: 30px 12px 50px;
  color: var(--text-muted);
  font-size: 13px;
}
footer a { color: var(--accent); font-weight: 600; }

/* ---------- Breadcrumb ---------- */
.crumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.crumb span.current { color: var(--accent); font-weight: 700; }
.crumb .back-btn {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 10px;
}

/* ---------- Loader ---------- */
.loader {
  text-align: center;
  padding: 30px;
  color: var(--text-muted);
  font-size: 14px;
}

/* ---------- Utility ---------- */
.hidden { display: none !important; }
