/* GURUKUL — Premium Institute Management */
/* Font: Playfair Display + DM Sans */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;500;600;700&family=DM+Sans:wght@300;400;500;600&display=swap');

:root {
  /* NEW COLOR SCHEME - White/Lavender/Purple/Orange */
  --cream:       #FFFFFF;
  --cream-dark:  #F5F3FF;
  --parchment:   #E9E5F5;
  --gold:        #F97316;        /* Orange - primary accent */
  --gold-light:  #FF9F4A;        /* Light orange */
  --gold-pale:   #FFF4E6;        /* Pale orange background */
  --ink:         #111111;        /* Pure black for primary text */
  --ink-mid:     #333333;        /* Dark grey for body text */
  --ink-light:   #666666;        /* Medium grey */
  --ink-faint:   #999999;        /* Light grey */
  --sage:        #8B5CF6;        /* Purple - secondary accent */
  --sage-light:  #F0EBFF;        /* Light purple background */
  --rose:        #F97316;        /* Orange for alerts */
  --rose-light:  #FFF4E6;        /* Light orange background */
  --sky:         #A855F7;        /* Lavender-purple */
  --sky-light:   #F5F0FF;        /* Light lavender background */
  --white:       #FFFFFF;
  --shadow-xs:   0 1px 3px rgba(0,0,0,0.05);
  --shadow-sm:   0 2px 8px rgba(0,0,0,0.06);
  --shadow-md:   0 4px 20px rgba(0,0,0,0.08);
  --shadow-lg:   0 8px 40px rgba(0,0,0,0.10);
  --radius-sm:   6px;
  --radius-md:   12px;
  --radius-lg:   20px;
  --radius-xl:   28px;
  --sidebar-w:   260px;
  --header-h:    64px;
  --transition:  0.2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: 'DM Sans', sans-serif;
  background: #F8F9FC;
  color: var(--ink-mid);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ── LAYOUT ── */
.layout { display: flex; min-height: 100vh; }

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--white);
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform var(--transition);
  border-right: 1px solid var(--parchment);
  box-shadow: var(--shadow-xs);
}

.sidebar-logo {
  padding: 28px 20px 20px;
  border-bottom: 1px solid var(--parchment);
}

.sidebar-logo .logo-mark {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--gold) 0%, var(--sage) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: 0.5px;
  display: block;
}

.sidebar-logo .logo-sub {
  font-size: 10px;
  color: var(--ink-faint);
  letter-spacing: 2px;
  text-transform: uppercase;
  display: block;
  margin-top: 4px;
}

.sidebar-inst-name {
  padding: 14px 20px;
  font-size: 12px;
  color: var(--ink-light);
  font-weight: 500;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--parchment);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: var(--cream-dark);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 16px 0;
  scrollbar-width: thin;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: var(--parchment); }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--gold-light); border-radius: 4px; }

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: 12px 20px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: var(--ink-light);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
  border-radius: 0;
  position: relative;
}

.nav-item:hover {
  color: var(--gold);
  background: var(--gold-pale);
}

.nav-item.active {
  color: var(--gold);
  background: var(--gold-pale);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--gold);
  border-radius: 0 3px 3px 0;
}

.nav-icon {
  width: 18px;
  height: 18px;
  opacity: 0.7;
  flex-shrink: 0;
}

.nav-item.active .nav-icon,
.nav-item:hover .nav-icon { opacity: 1; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--parchment);
  background: var(--cream-dark);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-user-avatar {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--gold) 0%, var(--sage) 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--white);
  flex-shrink: 0;
}

.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}
.sidebar-user-role {
  font-size: 10px;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
  display: block;
}

.sidebar-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: transparent;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: background var(--transition);
  flex-shrink: 0;
}
.sidebar-logout:hover { background: var(--rose-light); }
.sidebar-logout svg { width: 16px; height: 16px; color: var(--ink-light); }
.sidebar-logout:hover svg { color: var(--rose); }

/* ── MAIN CONTENT ── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── TOPBAR ── */
.topbar {
  height: var(--header-h);
  background: var(--white);
  border-bottom: 1px solid var(--parchment);
  display: flex;
  align-items: center;
  padding: 0 32px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-xs);
}

.topbar-title {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
  flex: 1;
}

.topbar-actions { display: flex; align-items: center; gap: 12px; }

.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--ink-mid);
  border-radius: var(--radius-sm);
}
.menu-toggle:hover { background: var(--cream-dark); }

/* ── CONTENT ── */
.content {
  flex: 1;
  padding: 32px;
  background: #F8F9FC;
}

/* ── FLASH MESSAGE ── */
.flash {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  margin-bottom: 24px;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
}
.flash-success { background: var(--sage-light); color: var(--sage); border-left: 4px solid var(--sage); }
.flash-error   { background: var(--rose-light);  color: var(--rose);  border-left: 4px solid var(--rose); }
.flash-info    { background: var(--sky-light);   color: var(--sky);   border-left: 4px solid var(--sky); }

/* ── STATS GRID ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--parchment);
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: box-shadow var(--transition), transform var(--transition);
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--gold-pale);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon-gold  { background: var(--gold-pale); color: var(--gold); }
.stat-icon-sage  { background: var(--sage-light); color: var(--sage); }
.stat-icon-sky   { background: var(--sky-light);  color: var(--sky); }
.stat-icon-rose  { background: var(--rose-light);  color: var(--rose); }

.stat-icon svg { width: 22px; height: 22px; }

.stat-body { flex: 1; min-width: 0; }
.stat-value {
  font-family: 'Playfair Display', serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1;
}
.stat-label {
  font-size: 12px;
  color: var(--ink-light);
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
}

/* ── CARD ── */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--parchment);
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
  overflow: hidden;
}

.card-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--cream-dark);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  background: var(--white);
}

.card-title {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
}

.card-body { padding: 24px; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn svg { width: 15px; height: 15px; flex-shrink: 0; }

.btn-primary {
  background: var(--gold);
  color: var(--white);
}
.btn-primary:hover { background: #ea580c; transform: translateY(-1px); box-shadow: var(--shadow-sm); }

.btn-secondary {
  background: var(--cream-dark);
  color: var(--ink-mid);
  border: 1px solid var(--parchment);
}
.btn-secondary:hover { background: var(--parchment); }

.btn-danger {
  background: var(--rose-light);
  color: var(--rose);
  border: 1px solid rgba(249,115,22,0.2);
}
.btn-danger:hover { background: var(--rose); color: var(--white); }

.btn-success {
  background: var(--sage-light);
  color: var(--sage);
  border: 1px solid rgba(139,92,246,0.2);
}
.btn-success:hover { background: var(--sage); color: var(--white); }

.btn-whatsapp {
  background: #25D366;
  color: var(--white);
}
.btn-whatsapp:hover { background: #1da851; }

.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-sm svg { width: 13px; height: 13px; }

.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
}
.btn-icon svg { width: 15px; height: 15px; }

/* ── TABLE ── */
.table-wrapper { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

thead th {
  background: var(--cream-dark);
  padding: 14px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--ink-light);
  border-bottom: 1px solid var(--parchment);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--cream-dark);
  transition: background var(--transition);
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--cream-dark); }

td {
  padding: 14px 16px;
  color: var(--ink-mid);
  vertical-align: middle;
}

td strong { color: var(--ink); font-weight: 600; }

.td-actions { display: flex; align-items: center; gap: 8px; }

/* ── BADGES ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.badge-active    { background: var(--sage-light);  color: var(--sage); }
.badge-completed { background: var(--sky-light);   color: var(--sky); }
.badge-dropped   { background: var(--rose-light);   color: var(--rose); }
.badge-present   { background: var(--sage-light);  color: var(--sage); }
.badge-absent    { background: var(--rose-light);   color: var(--rose); }
.badge-leave     { background: var(--gold-pale);    color: var(--gold); }

/* ── FORMS ── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.col-span-2 { grid-column: span 2; }
.col-span-3 { grid-column: span 3; }

.form-group { display: flex; flex-direction: column; gap: 8px; }

label {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-light);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

input, select, textarea {
  padding: 12px 14px;
  border: 1px solid var(--parchment);
  border-radius: var(--radius-md);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: var(--white);
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
  outline: none;
  appearance: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(249,115,22,0.1);
}

textarea { resize: vertical; min-height: 90px; }

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666666' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-hint {
  font-size: 12px;
  color: var(--ink-faint);
  margin-top: 2px;
}

.form-error {
  font-size: 12px;
  color: var(--rose);
  margin-top: 2px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 16px;
  margin-top: 8px;
  border-top: 1px solid var(--cream-dark);
}

/* ── AVATAR ── */
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gold-pale);
  border: 2px solid var(--parchment);
  object-fit: cover;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--gold);
  flex-shrink: 0;
  text-decoration: none;
}

.avatar-lg {
  width: 80px;
  height: 80px;
  font-size: 28px;
  border-radius: 50%;
}

/* ── STUDENT CELL ── */
.student-cell { display: flex; align-items: center; gap: 12px; }
.student-info strong { display: block; font-size: 14px; color: var(--ink); font-weight: 600; }
.student-info span { font-size: 12px; color: var(--ink-faint); }

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--ink-faint);
}
.empty-state svg { width: 48px; height: 48px; margin-bottom: 16px; opacity: 0.3; }
.empty-state p { font-size: 15px; }

/* ── TABS ── */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--parchment); margin-bottom: 24px; }
.tab {
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-light);
  cursor: pointer;
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all var(--transition);
  text-decoration: none;
  display: inline-block;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--gold); border-bottom-color: var(--gold); }

/* ── ATTENDANCE GRID ── */
.att-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 8px; }
.att-day {
  border-radius: var(--radius-sm);
  padding: 8px;
  text-align: center;
  font-size: 11px;
}
.att-day-date { font-weight: 600; font-size: 13px; display: block; }
.att-day-label { margin-top: 3px; display: block; }
.att-present { background: var(--sage-light); color: var(--sage); }
.att-absent  { background: var(--rose-light);  color: var(--rose); }
.att-leave   { background: var(--gold-pale);    color: var(--gold); }

/* ── PROFILE HEADER ── */
.profile-header {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 28px 28px 24px;
  background: var(--white);
  border-radius: var(--radius-xl);
  border: 1px solid var(--parchment);
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.profile-details h2 {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  font-weight: 600;
  color: var(--ink);
}

.profile-meta { display: flex; gap: 20px; margin-top: 8px; flex-wrap: wrap; }
.profile-meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--ink-light);
}
.profile-meta-item svg { width: 14px; height: 14px; }

/* ── PAGE HEADER ── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-header-text h1 {
  font-family: 'Playfair Display', serif;
  font-size: 26px;
  font-weight: 700;
  color: var(--ink);
}
.page-header-text p {
  font-size: 14px;
  color: var(--ink-light);
  margin-top: 6px;
}

/* ── SEARCH + FILTER ── */
.filter-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.filter-bar input,
.filter-bar select {
  max-width: 220px;
  min-width: 120px;
}

/* ── FOOTER ── */
.footer {
  text-align: center;
  padding: 20px 32px;
  font-size: 12px;
  color: var(--ink-faint);
  border-top: 1px solid var(--parchment);
  background: var(--white);
  margin-top: auto;
}

/* ── LOGIN PAGE ── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #F8F9FC 0%, #F5F3FF 100%);
  padding: 24px;
}

.login-card {
  background: var(--white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--parchment);
  width: 100%;
  max-width: 420px;
  padding: 48px 40px;
}

.login-logo {
  text-align: center;
  margin-bottom: 40px;
}

.login-logo-mark {
  font-family: 'Playfair Display', serif;
  font-size: 32px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--gold) 0%, var(--sage) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  display: block;
}

.login-logo-sub {
  font-size: 11px;
  color: var(--ink-faint);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-top: 6px;
  display: block;
}

.login-title {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 24px;
}

.login-card .form-group { margin-bottom: 20px; }
.login-card .btn-primary { width: 100%; justify-content: center; padding: 13px; font-size: 15px; }

/* ── INVOICE / CERT PRINT ── */
@media print {
  .sidebar, .topbar, .topbar-actions, .card-header .btn, .footer, .btn { display: none !important; }
  .main { margin-left: 0 !important; }
  .content { padding: 0; background: white; }
}

/* ── RESPONSIVE ── */
@media (max-width: 1024px) {
  :root { --sidebar-w: 240px; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  .main { margin-left: 0; }
  .menu-toggle { display: flex; }
  .content { padding: 20px 16px; }
  .topbar { padding: 0 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid-3 { grid-template-columns: 1fr; }
  .col-span-2, .col-span-3 { grid-column: span 1; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .profile-header { flex-direction: column; align-items: flex-start; }
  .login-card { padding: 32px 24px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .card-header { flex-direction: column; align-items: flex-start; }
  .page-header { flex-direction: column; }
}

/* ── OVERLAY ── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 99;
}
.sidebar-overlay.active { display: block; }

/* ── MINI PROGRESS ── */
.progress-bar {
  height: 6px;
  background: var(--parchment);
  border-radius: 20px;
  overflow: hidden;
  margin-top: 6px;
}
.progress-fill {
  height: 100%;
  border-radius: 20px;
  background: var(--gold);
  transition: width 0.4s ease;
}

/* ── MODAL-LIKE CONFIRM ── */
.inline-delete-confirm {
  display: inline;
}

/* ── PAYMENT STATUS ── */
.payment-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  background: var(--cream-dark);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 20px;
}
.payment-summary-item { text-align: center; }
.payment-summary-item .ps-value {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  font-weight: 600;
  display: block;
}
.payment-summary-item .ps-label {
  font-size: 11px;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-top: 4px;
}
.ps-green { color: var(--sage); }
.ps-red   { color: var(--rose); }
.ps-gold  { color: var(--gold); }