/* ═══════════════════════════════════════════════════════════
   BHASHINI INTERNATIONAL SCHOOL — Full Logo Color Theme
   ● Orange  #E8722A  (left petal)
   ● Green   #4CAF2A  (right petal)
   ● Blue    #1878B0  (bottom petal)
   ● Red     #D42929  (top dot)
   ● Navy    #344171  (Bhashini wordmark)
   ● Gray    #636363  (INTERNATIONAL SCHOOL text)
   ═══════════════════════════════════════════════════════════ */

:root {
  --orange:       #E8722A;
  --orange-dark:  #C45A14;
  --orange-bg:    #FEF0E6;
  --green:        #4CAF2A;
  --green-dark:   #368A1A;
  --green-bg:     #EDFAE5;
  --blue:         #1878B0;
  --blue-dark:    #0D5A8A;
  --blue-bg:      #E1F0FA;
  --red:          #D42929;
  --red-dark:     #A81C1C;
  --red-bg:       #FAEAEA;
  --navy:         #344171;
  --navy-dark:    #232D55;
  --navy-mid:     #3D4D88;
  --navy-bg:      #EEF0F8;
  --gray:         #636363;

  --bg:           #F2F4F8;
  --surface:      #FFFFFF;
  --text:         #1A1E2A;
  --muted:        #6B7480;
  --border:       #DDE2EA;
  --radius:       10px;
  --radius-sm:    6px;
  --shadow:       0 2px 10px rgba(52,65,113,.10);
  --shadow-lg:    0 6px 28px rgba(52,65,113,.16);
  --sidebar-w:    235px;
  --topbar-h:     64px;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--sans); background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }
a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--orange); }
hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* ── App Shell ───────────────────────────────────────────── */
.app-shell { display: flex; min-height: 100vh; }

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--navy);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }

/* Four-color accent bar at very top */
.sidebar::before {
  content: '';
  display: block;
  height: 3px;
  background: linear-gradient(90deg, var(--orange) 25%, var(--green) 25% 50%, var(--blue) 50% 75%, var(--red) 75%);
  flex-shrink: 0;
}

/* Brand */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-bottom: 1px solid rgba(255,255,255,.12);
  background: #fff;
  text-decoration: none;
  height: 64px;
  box-sizing: border-box;
  flex-shrink: 0;
}
.brand-label  { display: flex; flex-direction: column; line-height: 1.2; }
.brand-bis    { font-size: 16px; font-weight: 900; color: var(--navy); letter-spacing: .5px; }
.brand-accounts { font-size: 10px; font-weight: 600; color: var(--gray); letter-spacing: 1px; text-transform: uppercase; }

/* Nav */
.sidebar-nav { flex: 1; padding: 8px 0; overflow-y: auto; }

.nav-section-label {
  font-size: 9.5px;
  font-weight: 700;
  color: rgba(255,255,255,.40) !important;
  text-transform: uppercase;
  letter-spacing: 1.8px;
  padding: 16px 18px 4px;
}

.nav-item,
.nav-group summary {
  display: flex;
  align-items: center;
  padding: 10px 14px 10px 11px;
  color: rgba(255,255,255,.82) !important;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: background .13s, color .13s;
  cursor: pointer;
  list-style: none;
  white-space: nowrap;
}
.nav-item:hover,
.nav-group summary:hover { background: rgba(255,255,255,.10); color: #fff !important; }

.nav-item.active, .nav-item.active:hover {
  background: var(--orange);
  color: #fff !important;
  border-left-color: var(--orange-dark);
  font-weight: 700;
}

.nav-group details[open] summary {
  color: #fff !important;
  background: rgba(255,255,255,.08);
  border-left-color: var(--orange);
}
.nav-group summary::-webkit-details-marker { display: none; }

.nav-icon {
  width: 38px;
  flex-shrink: 0;
  text-align: center;
  font-size: 14px;
  line-height: 1;
  opacity: .80;
}
.nav-group .chevron {
  margin-left: auto;
  font-size: 11px;
  opacity: .45;
  transition: transform .2s;
  padding-left: 8px;
}
.nav-group details[open] .chevron { transform: rotate(90deg); }

.nav-sub { padding: 2px 0 6px 51px; }
.nav-sub a {
  display: block;
  padding: 6px 12px 6px 0;
  color: rgba(255,255,255,.65) !important;
  font-size: 12.5px;
  text-decoration: none;
  transition: color .13s;
}
.nav-sub a:hover { color: #fff !important; }
.nav-sub hr { border-color: rgba(255,255,255,.10); margin: 4px 0; }

/* Sidebar footer */
.sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid rgba(255,255,255,.10);
  background: var(--navy-dark);
}
.user-chip { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--orange);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px; color: #fff; flex-shrink: 0;
}
.user-info { flex: 1; overflow: hidden; }
.user-name { font-size: 13px; font-weight: 600; color: #fff !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: rgba(255,255,255,.45); }
.logout-btn { color: rgba(255,255,255,.38); font-size: 16px; text-decoration: none; flex-shrink: 0; }
.logout-btn:hover { color: var(--red); }

/* ── Main Area ───────────────────────────────────────────── */
.main-area { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-height: 100vh; }

/* ── Topbar ──────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 3px solid var(--orange);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 8px rgba(52,65,113,.08);
}
.topbar-title { font-size: 16px; font-weight: 700; color: var(--navy); flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.school-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px;
  background: var(--navy-bg);
  border-radius: 20px;
  font-size: 12px; font-weight: 700; color: var(--navy);
}

/* School badge */
.school-badge { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 10px; font-size: 11px; font-weight: 700; background: var(--orange); color: #fff; margin-left: 6px; }
.school-badge-all { background: var(--green); }

/* ── Page Body ───────────────────────────────────────────── */
.page-body { flex: 1; padding: 24px 28px; }

.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; flex-wrap: wrap; gap: 10px; }
.page-head h1 { font-size: 21px; font-weight: 800; color: var(--navy); display: flex; align-items: center; gap: 10px; }

/* ── Cards ───────────────────────────────────────────────── */
.card, .card-form {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  margin-bottom: 20px;
}
.card h3 { font-size: 14px; font-weight: 700; color: var(--navy); margin-bottom: 12px; }

/* Stat Cards — cycling through all 4 logo colors */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  display: flex; flex-direction: column; gap: 6px;
  position: relative; overflow: hidden;
  transition: transform .15s, box-shadow .15s;
  border-top: 4px solid var(--border);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-card:nth-child(4n+1) { border-top-color: var(--orange); }
.stat-card:nth-child(4n+2) { border-top-color: var(--green);  }
.stat-card:nth-child(4n+3) { border-top-color: var(--blue);   }
.stat-card:nth-child(4n+4) { border-top-color: var(--red);    }
.stat-card:nth-child(4n+1) .stat-value { color: var(--orange); }
.stat-card:nth-child(4n+2) .stat-value { color: var(--green);  }
.stat-card:nth-child(4n+3) .stat-value { color: var(--blue);   }
.stat-card:nth-child(4n+4) .stat-value { color: var(--red);    }
.stat-value { font-size: 28px; font-weight: 800; font-family: var(--mono); }
.stat-label { font-size: 12px; color: var(--muted); font-weight: 500; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 600;
  cursor: pointer; border: none; text-decoration: none;
  transition: all .15s;
  white-space: nowrap;
  font-family: var(--sans);
}
.btn-primary  { background: var(--orange); color: #fff; }
.btn-primary:hover  { background: var(--orange-dark); color: #fff; box-shadow: 0 3px 10px rgba(232,114,42,.35); }
.btn-secondary{ background: var(--navy);  color: #fff; }
.btn-secondary:hover{ background: var(--navy-dark); color: #fff; }
.btn-ghost    { background: transparent; color: var(--navy); border: 1.5px solid var(--border); }
.btn-ghost:hover    { border-color: var(--navy); background: var(--navy-bg); }
.btn-green    { background: var(--green); color: #fff; }
.btn-green:hover    { background: var(--green-dark); color: #fff; }
.btn-blue     { background: var(--blue);  color: #fff; }
.btn-blue:hover     { background: var(--blue-dark);  color: #fff; }
.btn-danger   { background: var(--red);   color: #fff; }
.btn-danger:hover   { background: var(--red-dark);   color: #fff; }
.btn-lg       { padding: 10px 24px; font-size: 15px; }
.link-danger  { color: var(--red) !important; }

/* ── Badges ──────────────────────────────────────────────── */
.badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 11.5px; font-weight: 700; letter-spacing: .2px; }
.badge-active   { background: var(--green-bg);  color: var(--green-dark); }
.badge-promoted { background: var(--orange-bg); color: var(--orange-dark); }
.badge-inactive { background: var(--red-bg);    color: var(--red-dark); }
.badge-pending  { background: var(--blue-bg);   color: var(--blue-dark); }

/* ── Tables ──────────────────────────────────────────────── */
/* Cover both custom .data-table and Yii2 GridView .table */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

table thead,
table thead tr { background: var(--navy) !important; }

table thead th,
table thead td {
  background: var(--navy) !important;
  color: #fff !important;
  padding: 12px 14px;
  text-align: left;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .6px;
  text-transform: uppercase;
  white-space: nowrap;
  border: none !important;
}
/* Orange accent on first header cell */
table thead th:first-child { border-left: 3px solid var(--orange) !important; }

/* Sort links inside headers */
table thead th a,
table thead th a:hover { color: #fff !important; text-decoration: none; }
table thead th.asc  a::after { content: ' ↑'; font-size: 10px; }
table thead th.desc a::after { content: ' ↓'; font-size: 10px; }

/* Filter row — slightly lighter navy, inputs and selects legible */
table thead tr.filters th,
table thead tr.filters td {
  background: var(--navy-mid) !important;
  color: #fff !important;
  padding: 6px 8px !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
}
table thead tr.filters input[type=text],
table thead tr.filters input[type=number],
table thead tr.filters input[type=date] {
  background: #fff !important;
  color: var(--text) !important;
  border: 1px solid rgba(255,255,255,.4) !important;
  border-radius: 4px;
  padding: 4px 7px;
  font-size: 12px;
  width: 100%;
}
/* Dropdowns in filter row — white bg so options are readable */
table thead tr.filters select {
  background: #fff !important;
  color: var(--text) !important;
  border: 1px solid rgba(255,255,255,.4) !important;
  border-radius: 4px;
  padding: 4px 7px;
  font-size: 12px;
  width: 100%;
  cursor: pointer;
}
table thead tr.filters select option { color: var(--text); background: #fff; }

/* Body rows */
table tbody td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table tbody tr:last-child td { border-bottom: none; }
table tbody tr:hover { background: var(--navy-bg); }

/* Striped */
table.table-striped tbody tr:nth-child(even) { background: #f8f9fc; }
table.table-striped tbody tr:nth-child(even):hover { background: var(--navy-bg); }

.data-table { background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.data-table .amount { text-align: right; font-family: var(--mono); }
.data-table .actions { text-align: right; white-space: nowrap; }
.data-table .actions a { color: var(--blue); font-size: 13px; margin-left: 10px; }
.data-table .actions a:hover { color: var(--orange); }
.data-table .empty { text-align: center; padding: 32px; color: var(--muted); font-style: italic; }
.filters input, .filters select { font-size: 12px; padding: 4px 8px; border: 1px solid var(--border); border-radius: 4px; }
.grid-summary { font-size: 12px; color: var(--muted); padding: 8px 0; }

/* ── Forms ───────────────────────────────────────────────── */
.narrow { max-width: 560px; }
.form-grid { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
.form-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-grid .full { grid-column: 1 / -1; }

.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label, .control-label { font-size: 12.5px; font-weight: 700; color: var(--navy); }

input[type=text], input[type=number], input[type=date], input[type=email],
input[type=password], input[type=time], input[type=tel], select, textarea {
  width: 100%; padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13.5px; font-family: var(--sans);
  color: var(--text); background: var(--surface);
  transition: border-color .15s, box-shadow .15s; outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(24,120,176,.15);
}
input[type=checkbox] { width: auto; }
textarea { resize: vertical; min-height: 72px; }
.hint { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.help-block { font-size: 12px; color: var(--red); margin-top: 3px; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--red); }

.form-actions {
  display: flex; align-items: center; gap: 10px;
  padding-top: 20px; margin-top: 6px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

fieldset {
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px 18px;
  margin-bottom: 18px;
}
fieldset legend {
  font-size: 13px; font-weight: 700;
  color: var(--navy); padding: 0 8px;
}

/* ── Alerts ──────────────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 13.5px; }
.alert-success { background: var(--green-bg);  color: var(--green-dark); border: 1px solid #b5e89b; }
.alert-error, .alert-danger { background: var(--red-bg); color: var(--red-dark); border: 1px solid #f5b8b8; }
.alert-warning { background: var(--orange-bg); color: var(--orange-dark); border: 1px solid #f5c9a8; }
.alert-info    { background: var(--blue-bg);   color: var(--blue-dark);   border: 1px solid #a8d4f0; }

/* ── Login ───────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy) 45%, var(--blue-dark) 100%);
  padding: 24px;
  position: relative;
  overflow: hidden;
}
/* Decorative colored circles from logo */
.login-wrap::before {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(232,114,42,.25) 0%, transparent 70%);
  top: -100px; left: -100px;
}
.login-wrap::after {
  content: '';
  position: absolute;
  width: 300px; height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(76,175,42,.20) 0%, transparent 70%);
  bottom: -80px; right: -80px;
}
.login-wrap .card-form {
  width: 100%; max-width: 400px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  position: relative; z-index: 1;
}
.login-wrap h1 { font-size: 20px; font-weight: 800; color: var(--navy); margin-bottom: 20px; text-align: center; }

/* ── Profile grid ────────────────────────────────────────── */
.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.info-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; }
.info-card h3 {
  font-size: 13px; font-weight: 700; color: var(--navy);
  margin-bottom: 12px; padding-bottom: 8px;
  border-bottom: 2px solid var(--orange);
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-235px); transition: transform .25s; }
  .sidebar.open { transform: translateX(0); width: 235px; }
  .main-area { margin-left: 0; }
  .form-grid, .form-grid.cols-3 { grid-template-columns: 1fr; }
  .page-body { padding: 16px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
}

/* ── Pager (Student list pagination, 1 2 3 ... horizontal) ── */
.pager-horizontal {
  list-style: none;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 4px;
  margin: 16px 0 0;
  padding: 0;
}
.pager-horizontal li { display: inline-block; }
.pager-horizontal li a,
.pager-horizontal li span {
  display: inline-block;
  min-width: 36px;
  text-align: center;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
  text-decoration: none;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: background .13s, color .13s;
  cursor: pointer;
}
.pager-horizontal li a:hover {
  background: var(--navy-bg);
  color: var(--orange);
}
.pager-horizontal li.active a,
.pager-horizontal li.active span {
  background: var(--orange);
  color: #fff;
}
.pager-horizontal li.disabled a,
.pager-horizontal li.disabled span {
  color: var(--muted);
  cursor: not-allowed;
  opacity: .5;
  box-shadow: none;
}
.pager-horizontal li.first a,
.pager-horizontal li.last a,
.pager-horizontal li.prev a,
.pager-horizontal li.next a {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--blue);
}
.text-orange { color: var(--orange); }
.text-green  { color: var(--green);  }
.text-blue   { color: var(--blue);   }
.text-red    { color: var(--red);    }
.text-navy   { color: var(--navy);   }
.text-muted  { color: var(--muted);  }
.amount { text-align: right; font-family: var(--mono); }
