/* ===== COLLEGE ERP - MAIN STYLESHEET ===== */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700&family=DM+Sans:wght@300;400;500;600&display=swap');

:root {
  --primary: #1a3a5c;
  --primary-light: #2563a8;
  --accent: #e8a020;
  --accent-light: #f4c55a;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #d97706;
  --bg: #f0f4f8;
  --card: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #cbd5e1;
  --sidebar-w: 260px;
  --shadow: 0 4px 24px rgba(26,58,92,0.10);
  --radius: 12px;
}

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

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

/* ===== LAYOUT ===== */
.erp-wrapper { display: flex; min-height: 100vh; }

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, #0f2540 0%, #1a3a5c 40%, #1e4976 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
  transition: transform 0.3s;
}

.sidebar-logo {
  padding: 24px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex; align-items: center; gap: 12px;
}

.sidebar-logo .logo-icon {
  width: 46px; height: 46px;
  background: var(--accent);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Playfair Display', serif;
  font-size: 18px; font-weight: 700; color: #fff;
  flex-shrink: 0;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
.sidebar-logo {
  padding-right: 36px !important; /* space for edit button */
}
.sidebar-logo .logo-text h2 {
  font-family: 'Playfair Display', serif;
  font-size: 14px; font-weight: 700;
  line-height: 1.2;
}
.sidebar-logo .logo-text span { font-size: 11px; color: rgba(255,255,255,0.55); }

.sidebar-user {
  padding: 16px 20px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-user .avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
}
.sidebar-user .user-info span { display: block; }
.sidebar-user .user-info .name { font-size: 13px; font-weight: 600; }
.sidebar-user .user-info .role { font-size: 11px; color: rgba(255,255,255,0.5); }

.sidebar-nav { padding: 12px 0; flex: 1; }
.nav-section { padding: 10px 20px 4px; font-size: 10px; font-weight: 600; 
  letter-spacing: 1.5px; text-transform: uppercase; color: rgba(255,255,255,0.35); }

.sidebar-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px;
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  font-size: 13.5px;
  transition: all 0.2s;
  border-left: 3px solid transparent;
  position: relative;
}
.sidebar-nav a:hover, .sidebar-nav a.active {
  color: #fff;
  background: rgba(255,255,255,0.07);
  border-left-color: var(--accent);
}
.sidebar-nav a .icon { font-size: 16px; width: 20px; text-align: center; }
.sidebar-nav a .badge {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  font-size: 10px; font-weight: 700;
  padding: 1px 7px; border-radius: 20px;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.sidebar-footer a {
  display: flex; align-items: center; gap: 8px;
  color: rgba(255,255,255,0.6);
  text-decoration: none; font-size: 13px;
  padding: 8px 0;
  transition: color 0.2s;
}
.sidebar-footer a:hover { color: #fff; }

/* ===== MAIN CONTENT ===== */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex; flex-direction: column;
  min-height: 100vh;
}

/* ===== TOPBAR ===== */
.topbar {
  background: #fff;
  padding: 0 28px;
  height: 64px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-left h1 { font-family: 'Playfair Display', serif; font-size: 20px; font-weight: 700; color: var(--primary); }
.topbar-left .breadcrumb { font-size: 12px; color: var(--text-muted); }

.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-right .date-badge {
  background: var(--bg);
  padding: 6px 12px; border-radius: 8px;
  font-size: 12px; color: var(--text-muted);
}

/* ===== PAGE CONTENT ===== */
.page-content { padding: 28px; flex: 1; }

/* ===== CARDS ===== */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-header h3 {
  font-family: 'Playfair Display', serif;
  font-size: 18px; font-weight: 700;
  color: var(--primary);
  display: flex; align-items: center; gap: 8px;
}
.card-body { padding: 24px; }

/* ===== STATS GRID ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 16px;
  position: relative; overflow: hidden;
}
.stat-card::before {
  content: ''; position: absolute;
  top: 0; left: 0; right: 0; height: 3px;
}
.stat-card.blue::before { background: linear-gradient(90deg, #1a3a5c, #2563a8); }
.stat-card.gold::before { background: linear-gradient(90deg, #e8a020, #f4c55a); }
.stat-card.green::before { background: linear-gradient(90deg, #16a34a, #22c55e); }
.stat-card.red::before { background: linear-gradient(90deg, #dc2626, #ef4444); }

.stat-icon {
  width: 52px; height: 52px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
}
.stat-card.blue .stat-icon { background: #eff6ff; }
.stat-card.gold .stat-icon { background: #fffbeb; }
.stat-card.green .stat-icon { background: #f0fdf4; }
.stat-card.red .stat-icon { background: #fef2f2; }

.stat-info .stat-value { font-size: 26px; font-weight: 700; line-height: 1; }
.stat-info .stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ===== FORMS ===== */
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.form-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.form-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.col-span-2 { grid-column: span 2; }
.col-span-3 { grid-column: span 3; }
.col-span-4 { grid-column: span 4; }

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label {
  font-size: 12px; font-weight: 600;
  color: var(--primary);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.form-group label .req { color: var(--danger); margin-left: 2px; }

.form-group input,
.form-group select,
.form-group textarea {
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: 'DM Sans', sans-serif;
  color: var(--text);
  background: #fff;
  transition: all 0.2s;
  outline: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(37,99,168,0.1);
}
.form-group input.error, .form-group select.error { border-color: var(--danger); }
.form-group .hint { font-size: 11px; color: var(--text-muted); }

/* ===== SECTION HEADERS ===== */
.section-title {
  display: flex; align-items: center; gap: 10px;
  font-family: 'Playfair Display', serif;
  font-size: 16px; font-weight: 700;
  color: var(--primary);
  margin: 24px 0 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--accent);
}
.section-title::before {
  content: '';
  width: 4px; height: 20px;
  background: var(--accent);
  border-radius: 2px;
}

/* ===== EDUCATION TABLE ===== */
.edu-table { width: 100%; border-collapse: collapse; }
.edu-table th {
  background: var(--primary);
  color: #fff;
  padding: 10px 12px;
  font-size: 12px; font-weight: 600;
  text-align: left;
}
.edu-table td { padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.edu-table tr:last-child td { border-bottom: none; }
.edu-table input, .edu-table select {
  width: 100%; padding: 6px 8px;
  border: 1px solid var(--border); border-radius: 6px;
  font-size: 12px; font-family: 'DM Sans', sans-serif;
}
.edu-table input:focus, .edu-table select:focus {
  border-color: var(--primary-light); outline: none;
}
.edu-table .percentage-cell { background: #f0f9ff; font-weight: 700; color: var(--primary); }
.edu-table .grade-badge {
  display: inline-block; padding: 2px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 700;
}
.grade-A { background: #dcfce7; color: #16a34a; }
.grade-B { background: #dbeafe; color: #1d4ed8; }
.grade-C { background: #fef9c3; color: #ca8a04; }
.grade-D { background: #ffedd5; color: #c2410c; }
.grade-F { background: #fee2e2; color: #dc2626; }

/* ===== DOCUMENTS UPLOAD ===== */
.doc-upload-area {
  border: 2px dashed var(--border);
  border-radius: 10px; padding: 20px;
  background: #fafbfc;
  transition: all 0.2s;
}
.doc-upload-area:hover { border-color: var(--primary-light); background: #eff6ff; }

.doc-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto auto;
  gap: 12px; align-items: center;
  background: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-bottom: 10px;
}
.doc-row:last-child { margin-bottom: 0; }

.btn-add-doc, .btn-remove-doc {
  padding: 8px 16px; border-radius: 8px;
  border: none; cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px; font-weight: 600;
  transition: all 0.2s;
}
.btn-add-doc { background: var(--primary); color: #fff; }
.btn-add-doc:hover { background: var(--primary-light); }
.btn-remove-doc { background: #fee2e2; color: var(--danger); padding: 8px 10px; }
.btn-remove-doc:hover { background: var(--danger); color: #fff; }

/* ===== BUTTONS ===== */
.btn {
  padding: 11px 24px; border-radius: 8px;
  border: none; cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px; font-weight: 600;
  transition: all 0.25s;
  display: inline-flex; align-items: center; gap: 8px;
  text-decoration: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-light); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(26,58,92,0.3); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: #cf8e1a; transform: translateY(-1px); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-outline { background: transparent; border: 2px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-lg { padding: 14px 32px; font-size: 16px; border-radius: 10px; }

/* ===== ALERT / FLASH ===== */
.alert {
  padding: 12px 18px; border-radius: 8px;
  margin-bottom: 20px; font-size: 14px; font-weight: 500;
  display: flex; align-items: center; gap: 10px;
}
.alert-success { background: #dcfce7; color: #166534; border-left: 4px solid var(--success); }
.alert-danger { background: #fee2e2; color: #991b1b; border-left: 4px solid var(--danger); }
.alert-warning { background: #fffbeb; color: #92400e; border-left: 4px solid var(--warning); }
.alert-info { background: #eff6ff; color: #1e40af; border-left: 4px solid var(--primary-light); }

/* ===== TABLES ===== */
.data-table { width: 100%; border-collapse: collapse; }
.data-table thead th {
  background: var(--primary); color: #fff;
  padding: 12px 16px; font-size: 12px;
  font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.5px; white-space: nowrap;
}
.data-table tbody tr { transition: background 0.15s; }
.data-table tbody tr:hover { background: #f8fafc; }
.data-table tbody td { padding: 12px 16px; border-bottom: 1px solid #f1f5f9; font-size: 13px; }

.badge {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 700;
}
.badge-success { background: #dcfce7; color: #166534; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fffbeb; color: #92400e; }

/* ===== TOGGLE SWITCH ===== */
.toggle-wrap { display: flex; align-items: center; gap: 8px; }
.toggle {
  position: relative; width: 44px; height: 24px;
  display: inline-block; cursor: pointer;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: #cbd5e1; border-radius: 24px;
  transition: 0.3s;
}
.toggle-slider::before {
  content: ''; position: absolute;
  width: 18px; height: 18px; left: 3px; bottom: 3px;
  background: #fff; border-radius: 50%; transition: 0.3s;
}
.toggle input:checked + .toggle-slider { background: var(--success); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ===== LOGIN PAGE ===== */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #0f2540 0%, #1a3a5c 50%, #1e4976 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  position: relative; overflow: hidden;
}
.login-page::before {
  content: '';
  position: absolute; top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: radial-gradient(circle at 30% 70%, rgba(232,160,32,0.08) 0%, transparent 50%),
              radial-gradient(circle at 70% 30%, rgba(37,99,168,0.1) 0%, transparent 50%);
}
.login-card {
  background: #fff;
  border-radius: 20px;
  width: 100%; max-width: 440px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.3);
  position: relative; z-index: 1;
  overflow: hidden;
}
.login-card-header {
  background: linear-gradient(135deg, #1a3a5c, #2563a8);
  padding: 36px 40px 28px;
  text-align: center;
  color: #fff;
}
.login-card-header .college-icon {
  width: 70px; height: 70px; border-radius: 16px;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px;
  font-family: 'Playfair Display', serif;
  font-size: 28px; font-weight: 700;
}
.login-card-header h1 {
  font-family: 'Playfair Display', serif;
  font-size: 22px; font-weight: 700;
}
.login-card-header p { font-size: 13px; opacity: 0.7; margin-top: 4px; }
.login-card-body { padding: 32px 40px 36px; }

.captcha-box {
  display: flex; align-items: center; gap: 10px;
  background: var(--primary);
  padding: 10px 16px; border-radius: 8px;
  font-family: 'Courier New', monospace;
  font-size: 22px; font-weight: 700;
  letter-spacing: 8px; color: #fff;
  user-select: none;
  position: relative; overflow: hidden;
  cursor: pointer;
}
.captcha-box::after {
  content: '↻'; font-size: 16px; letter-spacing: 0;
  margin-left: auto; opacity: 0.7;
}
.captcha-line {
  position: absolute; width: 100%; height: 1px;
  background: rgba(255,255,255,0.3); top: 50%;
}

/* ===== ID CARD ===== */
.id-card-preview {
  width: 320px;
  background: linear-gradient(145deg, #1a3a5c, #2563a8);
  border-radius: 16px; padding: 20px;
  color: #fff; box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  position: relative; overflow: hidden;
  margin: 0 auto;
}
.id-card-preview::before {
  content: '';
  position: absolute; top: -30px; right: -30px;
  width: 120px; height: 120px;
  background: rgba(232,160,32,0.15);
  border-radius: 50%;
}
.id-card-college { font-family: 'Playfair Display', serif; font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.id-card-subtitle { font-size: 10px; opacity: 0.7; margin-bottom: 16px; }
.id-card-photo {
  width: 70px; height: 80px;
  background: rgba(255,255,255,0.15);
  border-radius: 8px; float: right;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; border: 2px solid rgba(255,255,255,0.3);
}
.id-card-info .field { margin-bottom: 6px; }
.id-card-info .field .key { font-size: 9px; opacity: 0.6; text-transform: uppercase; letter-spacing: 0.5px; }
.id-card-info .field .val { font-size: 13px; font-weight: 600; }
.id-card-id {
  margin-top: 16px; padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.2);
  display: flex; justify-content: space-between; align-items: center;
}
.id-card-id .sid { font-size: 16px; font-weight: 700; letter-spacing: 2px; }
.id-card-id .bar { font-size: 22px; letter-spacing: -2px; opacity: 0.6; }

/* ===== ADMISSION SLIP ===== */
.admission-slip {
  border: 3px solid var(--primary);
  border-radius: 12px; padding: 28px;
  position: relative; max-width: 700px; margin: 0 auto;
}
.slip-header {
  display: flex; align-items: center; gap: 20px;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 16px; margin-bottom: 20px;
}
.slip-logo {
  width: 70px; height: 70px;
  background: var(--primary); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Playfair Display', serif;
  font-size: 24px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.slip-header h2 { font-family: 'Playfair Display', serif; font-size: 22px; color: var(--primary); }
.slip-header p { font-size: 12px; color: var(--text-muted); }

.slip-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.slip-field { display: flex; gap: 8px; font-size: 13px; }
.slip-field .key { font-weight: 600; color: var(--primary); min-width: 120px; }
.slip-field .val { color: var(--text); }

.slip-watermark {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%) rotate(-30deg);
  font-family: 'Playfair Display', serif;
  font-size: 60px; font-weight: 700;
  color: rgba(26,58,92,0.04);
  white-space: nowrap;
  pointer-events: none;
}

/* ===== PRINT STYLES ===== */
@media print {
  .no-print { display: none !important; }
  .sidebar, .topbar { display: none !important; }
  .main-content { margin-left: 0; }
  .page-content { padding: 0; }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid-2 { grid-template-columns: 1fr; }
  .form-grid-4 { grid-template-columns: 1fr 1fr; }
  .col-span-2, .col-span-3, .col-span-4 { grid-column: span 1; }
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 20px;
  display: none;
}
.modal-overlay.show { display: flex; }
.modal {
  background: #fff; border-radius: 16px;
  width: 100%; max-width: 800px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0,0,0,0.2);
}
.modal-header {
  padding: 20px 24px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; background: #fff;
}
.modal-header h3 { font-family: 'Playfair Display', serif; font-size: 18px; color: var(--primary); }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-muted); }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ===== MISC ===== */
.text-center { text-align: center; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.flex { display: flex; }
.gap-3 { gap: 12px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }

.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px;
}
.page-header h2 {
  font-family: 'Playfair Display', serif;
  font-size: 24px; color: var(--primary);
}
.page-header .sub { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

.search-bar {
  display: flex; align-items: center; gap: 10px;
  background: #fff; border: 1.5px solid var(--border);
  border-radius: 8px; padding: 8px 14px;
  flex: 1; max-width: 380px;
}
.search-bar input { border: none; outline: none; flex: 1; font-size: 14px; font-family: 'DM Sans', sans-serif; }
.search-bar span { color: var(--text-muted); }

.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 20px; }
.pagination a {
  padding: 6px 12px; border-radius: 6px;
  border: 1px solid var(--border);
  text-decoration: none; color: var(--text);
  font-size: 13px; transition: all 0.2s;
}
.pagination a.active, .pagination a:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

.steps-bar {
  display: flex; gap: 0;
  margin-bottom: 28px;
  border-radius: 10px; overflow: hidden;
  border: 1px solid var(--border);
}
.step {
  flex: 1; padding: 12px 16px;
  display: flex; align-items: center; gap: 10px;
  background: #f8fafc; border-right: 1px solid var(--border);
  font-size: 13px; color: var(--text-muted);
}
.step:last-child { border-right: none; }
.step.active { background: var(--primary); color: #fff; }
.step.done { background: #dcfce7; color: var(--success); }
.step-num {
  width: 24px; height: 24px; border-radius: 50%;
  background: rgba(255,255,255,0.25);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.step.active .step-num { background: var(--accent); }
.step.done .step-num { background: var(--success); color: #fff; }
