/* =====================================================================
   style.css — main UI
   Sheraz Model School Management System
   Software by Digital Boosters IT Center
   ===================================================================== */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--sky); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; color: var(--text); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.muted { color: var(--muted); }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.icon { width: 20px; height: 20px; flex-shrink: 0; }

/* ---------------------------------------------------------------------
   App shell
   --------------------------------------------------------------------- */
.app { display: flex; min-height: 100vh; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; margin-left: var(--sidebar-w); }
.content { flex: 1; padding: 24px; width: 100%; max-width: 1440px; margin: 0 auto; }

/* Sidebar */
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 40;
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex; flex-direction: column;
  transition: transform .25s ease;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 16px;
  border-bottom: 1px solid color-mix(in srgb, var(--sidebar-text) 14%, transparent);
}
.sidebar-logo { width: 48px; height: 48px; object-fit: contain; border-radius: 50%; background: rgba(255,255,255,.06); }
.sidebar-brand-text { display: flex; flex-direction: column; min-width: 0; }
.sidebar-brand-text strong { font-size: 15px; font-weight: 800; letter-spacing: .2px; }
.sidebar-brand-text span { font-size: 12px; opacity: .72; }
.sidebar-close { display: none; margin-left: auto; color: inherit; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 10px 24px; scrollbar-width: thin; }
.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; margin: 2px 0;
  border-radius: var(--radius-sm);
  color: inherit; opacity: .86;
  font-weight: 600; font-size: 14px;
  cursor: pointer; list-style: none; user-select: none;
}
.nav-link::-webkit-details-marker { display: none; }
.nav-link:hover { opacity: 1; text-decoration: none; background: color-mix(in srgb, var(--sidebar-text) 9%, transparent); }
.nav-link.active, .nav-link.active-parent { opacity: 1; background: color-mix(in srgb, var(--sidebar-text) 13%, transparent); }
.nav-link.active { box-shadow: inset 3px 0 0 var(--gold); }
.nav-link .chevron { width: 16px; height: 16px; margin-left: auto; transition: transform .2s; opacity: .7; }
.nav-group[open] > summary .chevron { transform: rotate(90deg); }
.nav-sub { padding: 2px 0 6px 44px; }
.nav-sublink {
  display: block; padding: 7px 10px; border-radius: 6px;
  color: inherit; opacity: .75; font-size: 13.5px; font-weight: 500;
}
.nav-sublink:hover { opacity: 1; text-decoration: none; background: color-mix(in srgb, var(--sidebar-text) 8%, transparent); }
.nav-sublink.active { opacity: 1; color: var(--gold-soft); font-weight: 700; }

/* Topbar */
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 24px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar-title { font-size: 18px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.topbar-date { color: var(--muted); font-size: 13px; font-weight: 600; }
.menu-toggle { display: none; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 40px; height: 40px; padding: 0;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text-soft); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.sidebar .icon-btn { border-color: transparent; background: transparent; }

[data-theme="light"] .when-dark,
[data-theme="dark"] .when-light { display: none; }
.when-light, .when-dark { display: inline-grid; }

/* User menu */
.user-menu { position: relative; }
.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 10px 4px 4px;
  border: 1px solid var(--border); border-radius: 999px;
  cursor: pointer; list-style: none; background: var(--surface);
}
.user-chip::-webkit-details-marker { display: none; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--navy); color: var(--gold-soft);
  font-size: 12px; font-weight: 800;
}
.user-chip-text { display: flex; flex-direction: column; line-height: 1.15; }
.user-chip-text strong { font-size: 13px; }
.user-chip-text small { font-size: 11px; color: var(--muted); }
.user-dropdown {
  position: absolute; right: 0; top: calc(100% + 8px);
  min-width: 200px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow);
}
.user-dropdown a, .logout-btn {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; border-radius: 6px; border: 0;
  background: none; color: var(--text); font-size: 14px; font-weight: 600;
  cursor: pointer; text-align: left;
}
.user-dropdown a:hover, .logout-btn:hover { background: var(--surface-2); text-decoration: none; }
.logout-btn { color: var(--red); }
.user-dropdown form { margin: 0; }
.user-dropdown .icon { width: 18px; height: 18px; }

/* Footer */
.app-footer {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  color: var(--muted); font-size: 13px;
}
.app-footer .credit { font-weight: 700; color: var(--text-soft); }

/* ---------------------------------------------------------------------
   Components
   --------------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h3 { font-size: 16px; font-weight: 800; }
.link-more { font-size: 13px; font-weight: 700; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 16px;
  border: 1px solid transparent; border-radius: 10px;
  font-weight: 700; font-size: 14px; line-height: 1;
  cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: filter .15s, transform .05s;
}
.btn:hover { filter: brightness(1.06); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn .icon { width: 18px; height: 18px; }
.btn-primary { background: var(--primary); color: var(--primary-text); }
.btn-gold    { background: var(--gold); color: var(--navy); }
.btn-green   { background: var(--green); color: #fff; }
.btn-red     { background: var(--red); color: #fff; }
.btn-light   { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-block   { width: 100%; }
.btn-lg      { min-height: 48px; font-size: 15px; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field-label { font-size: 13px; font-weight: 700; color: var(--text-soft); }
input[type="text"], input[type="password"], input[type="number"], input[type="date"],
input[type="email"], input[type="tel"], select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--sky); box-shadow: 0 0 0 3px var(--focus); }

/* Alerts */
.alert {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 12px 14px; margin-bottom: 16px;
  border-radius: 10px; font-size: 14px; font-weight: 600;
}
.alert-success { background: var(--success-bg); color: var(--success-text); }
.alert-error   { background: var(--error-bg);   color: var(--error-text); }
.alert-warning { background: var(--warning-bg); color: var(--warning-text); }
.alert-info    { background: var(--info-bg);    color: var(--info-text); }
.alert-close { border: 0; background: none; color: inherit; font-size: 20px; line-height: 1; cursor: pointer; opacity: .7; }

/* Tables */
.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; padding: 10px 12px;
  font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .4px;
  color: var(--muted); background: var(--surface-2);
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table th.num { text-align: right; }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.empty-row { margin: 0; padding: 22px 0; text-align: center; color: var(--muted); font-weight: 600; }

/* Empty state */
.empty-state { max-width: 560px; margin: 40px auto; text-align: center; padding: 40px 24px; }
.empty-state h2 { font-size: 20px; margin-bottom: 8px; }
.empty-state p { color: var(--muted); margin: 0 0 20px; }
.empty-icon { display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--error-bg); color: var(--red); margin-bottom: 16px; }
.empty-icon .icon { width: 30px; height: 30px; }

/* Pagination */
.pagination { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 16px; }
.pagination a { min-width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-weight: 700; }
.pagination a.active { background: var(--primary); color: var(--primary-text); border-color: transparent; }

/* ---------------------------------------------------------------------
   Dashboard
   --------------------------------------------------------------------- */
.welcome {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 22px 24px; margin-bottom: 20px;
  border-radius: var(--radius);
  background: linear-gradient(120deg, var(--navy) 0%, var(--navy-700) 100%);
  color: #fff;
  position: relative; overflow: hidden;
}
.welcome::after {
  content: ""; position: absolute; right: -60px; top: -60px;
  width: 220px; height: 220px; border-radius: 50%;
  border: 14px solid rgba(232, 200, 119, .18);
}
.welcome h2 { color: #fff; font-size: 22px; font-weight: 800; }
.welcome p { margin: 4px 0 0; opacity: .8; font-size: 14px; }
.quick-actions { display: flex; gap: 10px; flex-wrap: wrap; position: relative; z-index: 1; }
.welcome .btn-light { background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.25); }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 18px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  border-top: 3px solid var(--accent);
}
.stat-link:hover { text-decoration: none; box-shadow: var(--shadow); }
.accent-navy  { --accent: var(--sky); }
.accent-gold  { --accent: var(--gold); }
.accent-green { --accent: var(--green); }
.accent-red   { --accent: var(--red); }
.stat-icon {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent);
}
.stat-icon .icon { width: 22px; height: 22px; }
.stat-body { display: flex; flex-direction: column; min-width: 0; }
.stat-label { font-size: 13px; font-weight: 700; color: var(--muted); }
.stat-value { font-size: 26px; font-weight: 800; line-height: 1.2; margin: 2px 0; font-variant-numeric: tabular-nums; }
.stat-note { font-size: 12.5px; color: var(--muted); }

.dash-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; align-items: start; }
.dash-grid > .card:last-child:nth-child(odd) { grid-column: 1 / -1; }

.strength-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.strength-list li { display: grid; grid-template-columns: 88px 1fr 36px; align-items: center; gap: 10px; font-size: 13.5px; }
.strength-name { font-weight: 600; color: var(--text-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.strength-bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--border); }
.strength-bar span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--green), var(--gold)); }
.strength-num { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------------
   Login
   --------------------------------------------------------------------- */
.login-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 20%, rgba(232, 200, 119, .18) 0, transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(30, 158, 72, .14) 0, transparent 40%),
    linear-gradient(160deg, #0B1F4B 0%, #13306E 100%);
}
.login-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; }
.login-card {
  width: 100%; max-width: 420px;
  padding: 32px 28px 28px;
  background: var(--surface);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
  border-top: 4px solid var(--gold);
}
.login-logo { width: 116px; height: 116px; object-fit: contain; margin: 0 auto 14px; }
.login-title { text-align: center; font-size: 22px; font-weight: 800; color: var(--text); }
.login-sub { text-align: center; color: var(--muted); font-size: 13px; margin: 4px 0 22px; }
.login-form { margin-top: 4px; }
.role-switch { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; }
.role-option { position: relative; }
.role-option input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.role-option span { display: block; padding: 9px 4px; text-align: center; font-size: 13px; font-weight: 700; color: var(--muted); border-radius: 9px; transition: background .15s, color .15s; }
.role-option input:checked + span { background: var(--navy); color: #fff; }
[data-theme="dark"] .role-option input:checked + span { background: var(--gold); color: var(--navy); }
.role-option input:focus-visible + span { outline: 3px solid var(--focus); }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 70px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--sky); font-weight: 700; font-size: 13px; cursor: pointer; padding: 8px; }
.login-credit { color: rgba(255, 255, 255, .75); font-size: 13px; font-weight: 600; margin: 20px 0 0; }
