/* ================================================
   Jnananidhi Student Portal — Main CSS
   Mobile-first, clean, warm design
================================================ */
:root {
  --navy:   #1a3c5e;
  --gold:   #c8832a;
  --green:  #2e7d32;
  --red:    #c62828;
  --amber:  #e65100;
  --cream:  #faf7f2;
  --warm:   #f3ede3;
  --border: #e0d8cc;
  --text:   #2c2c2c;
  --muted:  #6b6b6b;
  --white:  #ffffff;
  --radius: 10px;
  --shadow: 0 2px 16px rgba(26,60,94,.10);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'DM Sans', sans-serif;
  color: var(--text);
  background: var(--cream);
  min-height: 100vh;
  line-height: 1.6;
}
img { max-width: 100%; display: block; }
a { color: var(--gold); text-decoration: none; }

/* ── TOP NAV ── */
.portal-nav {
  background: var(--navy);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  position: sticky; top: 0; z-index: 100;
}
.portal-nav .brand {
  display: flex; align-items: center; gap: 10px;
}
.portal-nav .brand img { height: 36px; }
.portal-nav .brand span {
  color: #fff; font-size: .95rem; font-weight: 600;
  line-height: 1.2;
}
.portal-nav .brand small { display: block; font-size: .7rem; opacity: .7; font-weight: 400; }
.nav-actions { display: flex; align-items: center; gap: 12px; }
.nav-actions a {
  color: rgba(255,255,255,.8); font-size: .85rem;
  display: flex; align-items: center; gap: 6px;
}
.nav-actions a:hover { color: #fff; }
.nav-child-name {
  background: rgba(255,255,255,.1);
  color: #fff; font-size: .82rem; font-weight: 600;
  padding: 5px 12px; border-radius: 20px;
  display: flex; align-items: center; gap: 6px;
}

/* ── MAIN CONTAINER ── */
.portal-wrap { max-width: 900px; margin: 0 auto; padding: 24px 16px 60px; }

/* ── STUDENT PROFILE CARD ── */
.student-card {
  background: linear-gradient(135deg, var(--navy) 0%, #0e2840 100%);
  border-radius: 16px; padding: 24px;
  display: flex; gap: 20px; align-items: center;
  margin-bottom: 24px; position: relative; overflow: hidden;
}
.student-card::before {
  content: ''; position: absolute;
  width: 200px; height: 200px; border-radius: 50%;
  background: rgba(255,255,255,.04);
  top: -60px; right: -40px;
}
.student-avatar {
  width: 72px; height: 72px; border-radius: 50%;
  background: rgba(255,255,255,.15);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; font-weight: 700; color: var(--gold);
  flex-shrink: 0; overflow: hidden; border: 3px solid rgba(255,255,255,.2);
}
.student-avatar img { width: 100%; height: 100%; object-fit: cover; }
.student-info { flex: 1; }
.student-info h2 {
  color: #fff; font-size: 1.25rem; font-weight: 600;
  line-height: 1.2; margin-bottom: 4px;
}
.student-info .meta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.student-badge {
  background: rgba(255,255,255,.12);
  color: rgba(255,255,255,.9);
  font-size: .75rem; font-weight: 600;
  padding: 3px 10px; border-radius: 20px;
  display: flex; align-items: center; gap: 4px;
}

/* ── STAT CARDS ── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px; margin-bottom: 24px;
}
.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  text-align: center;
}
.stat-card .num {
  font-size: 2rem; font-weight: 700;
  line-height: 1; margin-bottom: 4px;
}
.stat-card .lbl { font-size: .75rem; color: var(--muted); font-weight: 500; }
.stat-card.present .num { color: var(--green); }
.stat-card.absent  .num { color: var(--red); }
.stat-card.late    .num { color: var(--amber); }
.stat-card.pct     .num { color: var(--navy); }

/* ── SECTION ── */
.section-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 20px; overflow: hidden;
}
.section-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.section-head h3 {
  font-size: 1rem; font-weight: 600; color: var(--navy);
  display: flex; align-items: center; gap: 8px;
}
.section-head h3 svg { width: 18px; height: 18px; stroke: var(--gold); fill: none; stroke-width: 2; }
.section-body { padding: 20px; }

/* ── ATTENDANCE CALENDAR ── */
.att-cal { }
.att-cal-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 14px;
}
.att-cal-head h4 { font-size: .95rem; font-weight: 600; color: var(--navy); }
.month-nav { display: flex; gap: 8px; align-items: center; }
.month-nav a {
  width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--border); display: flex;
  align-items: center; justify-content: center;
  font-size: 1rem; color: var(--navy);
  transition: background .2s;
}
.month-nav a:hover { background: var(--warm); }
.cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-day-name {
  text-align: center; font-size: .7rem; font-weight: 600;
  color: var(--muted); padding: 6px 0;
  text-transform: uppercase; letter-spacing: .05em;
}
.cal-day {
  aspect-ratio: 1; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 500; position: relative;
}
.cal-day.empty { }
.cal-day.present { background: #e8f5e9; color: #2e7d32; }
.cal-day.absent  { background: #ffebee; color: #c62828; }
.cal-day.late    { background: #fff3e0; color: #e65100; }
.cal-day.holiday { background: var(--warm); color: var(--muted); }
.cal-day.today   { outline: 2px solid var(--gold); outline-offset: -2px; }
.cal-day.no-data { color: var(--border); }

.att-legend { display: flex; gap: 14px; margin-top: 14px; flex-wrap: wrap; }
.att-legend span {
  font-size: .78rem; display: flex; align-items: center; gap: 5px;
}
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.p { background: #2e7d32; }
.dot.a { background: #c62828; }
.dot.l { background: #e65100; }
.dot.h { background: #e0d8cc; }

/* ── MARKS TABLE ── */
.exam-selector {
  display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px;
}
.exam-btn {
  padding: 7px 16px; border-radius: 20px;
  border: 1.5px solid var(--border);
  font-size: .85rem; font-weight: 500;
  cursor: pointer; background: transparent;
  color: var(--text); transition: all .2s;
  text-decoration: none; display: inline-block;
}
.exam-btn.active, .exam-btn:hover {
  background: var(--navy); color: #fff; border-color: var(--navy);
}

.marks-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.marks-table th {
  text-align: left; padding: 10px 14px;
  background: var(--cream); color: var(--navy);
  font-weight: 600; font-size: .8rem; letter-spacing: .04em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}
.marks-table td {
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.marks-table tr:last-child td { border-bottom: none; }
.marks-table .subject { font-weight: 600; }
.grade-badge {
  display: inline-block; padding: 3px 10px;
  border-radius: 20px; font-size: .75rem; font-weight: 700;
  color: #fff;
}
.progress-bar {
  height: 6px; border-radius: 3px;
  background: var(--border); overflow: hidden; width: 80px;
}
.progress-bar .fill { height: 100%; border-radius: 3px; transition: width .4s; }
.marks-total {
  background: var(--warm); border-radius: 8px;
  padding: 14px 16px; margin-top: 14px;
  display: flex; justify-content: space-between; align-items: center;
}
.marks-total .label { font-size: .9rem; font-weight: 600; color: var(--navy); }
.marks-total .val   { font-size: 1.1rem; font-weight: 700; color: var(--navy); }

/* ── ANNOUNCEMENTS ── */
.announce-list { display: flex; flex-direction: column; gap: 12px; }
.announce-item {
  display: flex; gap: 14px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 8px; background: var(--white);
}
.announce-icon {
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--warm); display: flex;
  align-items: center; justify-content: center; flex-shrink: 0;
}
.announce-icon svg { width: 16px; height: 16px; stroke: var(--gold); fill: none; stroke-width: 2; }
.announce-item h4 { font-size: .9rem; font-weight: 600; margin-bottom: 3px; }
.announce-item p  { font-size: .83rem; color: var(--muted); }
.announce-date    { font-size: .75rem; color: var(--muted); margin-top: 4px; }

/* ── LOGIN PAGE ── */
.login-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--navy) 0%, #0e2840 100%);
  padding: 20px;
}
.login-box {
  background: var(--white); border-radius: 16px;
  padding: 40px 36px; width: 100%; max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo img { height: 60px; margin: 0 auto 10px; }
.login-logo h1 { font-size: 1.1rem; color: var(--navy); font-weight: 600; }
.login-logo p  { font-size: .82rem; color: var(--muted); }

.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: .85rem; font-weight: 600; color: var(--navy); margin-bottom: 6px; }
.form-group input {
  width: 100%; padding: 11px 14px;
  border: 1.5px solid var(--border); border-radius: 8px;
  font-size: .95rem; font-family: 'DM Sans', sans-serif;
  outline: none; transition: border-color .2s; color: var(--text);
}
.form-group input:focus { border-color: var(--gold); }

.btn-login {
  width: 100%; padding: 13px;
  background: var(--navy); color: #fff;
  border: none; border-radius: 8px; font-size: 1rem;
  font-weight: 600; cursor: pointer; transition: background .2s;
  font-family: 'DM Sans', sans-serif;
}
.btn-login:hover { background: var(--gold); }

.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: .9rem; }
.alert-error   { background: #ffebee; color: var(--red); border-left: 4px solid var(--red); }
.alert-success { background: #e8f5e9; color: var(--green); border-left: 4px solid var(--green); }

/* ── CHILD SELECTOR ── */
.child-selector {
  min-height: 100vh; background: var(--cream);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; padding: 20px; gap: 20px;
}
.child-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: 14px; padding: 20px 24px;
  display: flex; align-items: center; gap: 16px;
  width: 100%; max-width: 420px; cursor: pointer;
  transition: all .2s; text-decoration: none; color: var(--text);
}
.child-card:hover {
  box-shadow: var(--shadow); border-color: var(--gold);
  transform: translateY(-2px);
}
.child-card .avatar {
  width: 54px; height: 54px; border-radius: 50%;
  background: var(--warm); display: flex;
  align-items: center; justify-content: center;
  font-size: 1.4rem; font-weight: 700; color: var(--gold);
  flex-shrink: 0; overflow: hidden;
}
.child-card .avatar img { width: 100%; height: 100%; object-fit: cover; }
.child-card h3 { font-size: 1rem; font-weight: 600; margin-bottom: 4px; }
.child-card p  { font-size: .82rem; color: var(--muted); }
.child-card .arrow { margin-left: auto; color: var(--muted); font-size: 1.2rem; }

/* ── TABS ── */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab {
  padding: 12px 20px; font-size: .88rem; font-weight: 500;
  color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -1px; text-decoration: none; display: block;
}
.tab.active { color: var(--navy); border-bottom-color: var(--gold); }
.tab:hover  { color: var(--navy); }

/* ── EMPTY STATE ── */
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty svg { width: 48px; height: 48px; stroke: var(--border); fill: none; stroke-width: 1.5; margin: 0 auto 12px; }
.empty p { font-size: .9rem; }

/* ── RESPONSIVE ── */
@media (max-width: 640px) {
  .stats-row { grid-template-columns: 1fr 1fr; }
  .student-card { flex-direction: column; text-align: center; }
  .student-info .meta { justify-content: center; }
  .portal-wrap { padding: 16px 12px 50px; }
  .marks-table { font-size: .82rem; }
  .marks-table th, .marks-table td { padding: 9px 10px; }
  .progress-bar { width: 50px; }
  .section-body { padding: 16px; }
  .login-box { padding: 30px 20px; }
  .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tab { white-space: nowrap; }
}

@media (max-width: 380px) {
  .stats-row { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-card .num { font-size: 1.6rem; }
}
