/* ==========================================================================
   TARAGONJ HORENDRA NARAYAN HIGH SCHOOL & COLLEGE (THNUMB)
   Education Management CMS - Unified Portal Design System
   Color Scheme: Oxford Navy (#002147), Oxford Gold (#c5a059), Crimson (#900c3f)
   ========================================================================== */

:root {
  --primary: #002147;
  --primary-dark: #00142e;
  --primary-light: #003875;
  --gold: #c5a059;
  --gold-light: #e5c378;
  --gold-dark: #9d7b32;
  --crimson: #900c3f;
  --crimson-light: #b81450;
  
  --bg-page: #f4f6fa;
  --bg-card: #ffffff;
  --bg-sidebar: #001937;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #0284c7;

  --sidebar-width: 270px;
  --header-height: 70px;
  --radius: 10px;
  --shadow-sm: 0 2px 8px rgba(0, 33, 71, 0.06);
  --shadow-md: 0 6px 20px rgba(0, 33, 71, 0.1);
  --shadow-lg: 0 12px 30px rgba(0, 33, 71, 0.16);

  --font-heading: 'Merriweather', 'Cinzel', serif;
  --font-sans: 'Hind Siliguri', 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

[data-theme="dark"] {
  --bg-page: #0a111e;
  --bg-card: #121c2d;
  --bg-sidebar: #060c17;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --border: #24344d;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 30px rgba(0, 0, 0, 0.6);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
}

/* LAYOUT STRUCTURE */
.portal-layout {
  display: flex;
  min-height: 100vh;
}

.portal-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  color: #f8fafc;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: transform 0.3s ease;
  overflow-y: auto;
}

.portal-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-width: 0;
  transition: margin-left 0.3s ease;
}

/* SIDEBAR BRAND & NAVIGATION */
.sidebar-brand {
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.15);
}

.sidebar-logo {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  object-fit: cover;
}

.sidebar-brand-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--gold-light);
  line-height: 1.2;
}

.sidebar-brand-sub {
  font-size: 0.75rem;
  color: #94a3b8;
  letter-spacing: 0.5px;
}

.sidebar-nav {
  padding: 16px 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-section-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  color: #64748b;
  letter-spacing: 1px;
  padding: 12px 14px 6px;
  font-weight: 700;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius);
  color: #cbd5e1;
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
}

.nav-item i {
  font-size: 1.1rem;
  width: 20px;
  text-align: center;
  color: var(--gold);
}

.nav-item:hover {
  background: rgba(197, 160, 89, 0.15);
  color: #ffffff;
}

.nav-item.active {
  background: linear-gradient(135deg, var(--gold-dark), var(--gold));
  color: #001937;
  font-weight: 700;
}

.nav-item.active i {
  color: #001937;
}

/* TOP HEADER */
.portal-header {
  height: var(--header-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 90;
  box-shadow: var(--shadow-sm);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.3rem;
  color: var(--text-main);
  cursor: pointer;
}

.header-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
}
[data-theme="dark"] .header-title {
  color: var(--gold-light);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  background: var(--bg-page);
  border-radius: 30px;
  border: 1px solid var(--border);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
}

.user-meta {
  line-height: 1.2;
}

.user-name {
  font-size: 0.88rem;
  font-weight: 600;
}

.user-role-tag {
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--gold-dark);
  font-weight: 700;
}

/* CONTENT CONTAINER */
.portal-content {
  padding: 28px;
  flex: 1;
}

/* CARDS & STATS */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 18px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-icon {
  width: 54px;
  height: 54px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.stat-icon.blue { background: rgba(0, 33, 71, 0.1); color: var(--primary); }
.stat-icon.gold { background: rgba(197, 160, 89, 0.2); color: var(--gold-dark); }
.stat-icon.green { background: rgba(16, 185, 129, 0.12); color: var(--success); }
.stat-icon.crimson { background: rgba(144, 12, 63, 0.12); color: var(--crimson); }

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-number {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.1;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* SECTION CARDS & DATA TABLES */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
  overflow: hidden;
}

.card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 33, 71, 0.02);
}

.card-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 10px;
}
[data-theme="dark"] .card-title { color: var(--gold-light); }

.card-body {
  padding: 24px;
}

/* TABLE STYLING */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.data-table th {
  background: rgba(0, 33, 71, 0.04);
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
  padding: 12px 16px;
  border-bottom: 2px solid var(--border);
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-main);
  vertical-align: middle;
}

.data-table tbody tr:hover {
  background: rgba(0, 33, 71, 0.02);
}

/* BADGES & PILLS */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-success { background: rgba(16, 185, 129, 0.15); color: #047857; }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: #b45309; }
.badge-danger { background: rgba(239, 68, 68, 0.15); color: #b91c1c; }
.badge-info { background: rgba(2, 132, 199, 0.15); color: #0369a1; }
.badge-gold { background: rgba(197, 160, 89, 0.25); color: #785a1a; }

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
}
.btn-primary:hover {
  background: var(--primary-light);
}

.btn-gold {
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(197, 160, 89, 0.35);
}
.btn-gold:hover {
  filter: brightness(1.08);
}

.btn-danger {
  background: var(--crimson);
  color: #ffffff;
}
.btn-danger:hover {
  background: var(--crimson-light);
}

.btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--text-main);
}
.btn-outline:hover {
  background: rgba(0, 0, 0, 0.05);
}

/* FORMS */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-main);
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.92rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(197, 160, 89, 0.2);
}

/* MODAL DIALOGS */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 15, 35, 0.65);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-backdrop.active {
  display: flex;
}

.modal-window {
  background: var(--bg-card);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 650px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: modalPop 0.25s ease-out;
  border: 1px solid var(--border);
}

.modal-window.lg {
  max-width: 900px;
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-head {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 33, 71, 0.03);
}

.modal-head h3 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
}

.modal-foot {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: rgba(0, 33, 71, 0.02);
}

/* TOAST NOTIFICATION */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--bg-card);
  border-left: 4px solid var(--primary);
  box-shadow: var(--shadow-lg);
  padding: 14px 20px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 280px;
  font-size: 0.9rem;
  animation: slideIn 0.25s ease;
}

.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }
.toast.info { border-color: var(--info); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* PRINT STYLESHEET */
@media print {
  .portal-sidebar, .portal-header, .btn, .no-print {
    display: none !important;
  }
  .portal-main {
    margin-left: 0 !important;
  }
  .portal-content {
    padding: 0 !important;
  }
  .card {
    border: none !important;
    box-shadow: none !important;
  }
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }
}

/* RESPONSIVE BREAKPOINTS */
@media (max-width: 992px) {
  .portal-sidebar {
    transform: translateX(-100%);
  }
  .portal-sidebar.open {
    transform: translateX(0);
  }
  .portal-main {
    margin-left: 0;
  }
  .menu-toggle {
    display: block;
  }
}
