@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Poppins:wght@400;500;600;700;800;900&family=DM+Sans:wght@400;500;600;700&display=swap');

/* ==========================================================================
   Apex Institute Design System Tokens & Global Elements
   ========================================================================== */
:root {
  --primary: #ff9800;
  --primary-hover: #f57c00;
  --primary-dark: #ea580c;
  --primary-light: #fff7ed;
  --primary-glow: rgba(255, 152, 0, 0.35);

  --blue: #2563eb;
  --blue-hover: #1d4ed8;
  --blue-light: #eff6ff;

  --navy: #0f172a;
  --navy-surface: #1e293b;
  --navy-border: #334155;

  --emerald: #10b981;
  --emerald-light: #ecfdf5;
  --emerald-dark: #047857;

  --rose: #f43f5e;
  --rose-light: #fff1f2;
  --rose-dark: #be123c;

  --amber: #f59e0b;
  --amber-light: #fffbeb;

  --ink: #0f172a;
  --ink-secondary: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-subtle: #f1f5f9;
  --bg: #f8fafc;
  --card: #ffffff;

  --glass-bg: rgba(255, 255, 255, 0.88);
  --glass-border: rgba(255, 255, 255, 0.9);
  --glass-border-subtle: rgba(226, 232, 240, 0.85);

  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.08);
  --shadow-glow: 0 0 25px rgba(255, 152, 0, 0.25);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-full: 9999px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: radial-gradient(circle at 5% 5%, rgba(255, 152, 0, 0.08) 0%, transparent 45%),
              radial-gradient(circle at 95% 5%, rgba(37, 99, 235, 0.09) 0%, transparent 45%),
              radial-gradient(circle at 50% 50%, rgba(16, 185, 129, 0.05) 0%, transparent 45%),
              #f8fafc;
  background-attachment: fixed;
  color: var(--ink);
  font-family: 'Plus Jakarta Sans', 'Poppins', 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Custom Sleek Scrollbar */
::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}
::-webkit-scrollbar-track {
  background: rgba(241, 245, 249, 0.7);
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: #ff9800;
}

/* ==========================================================================
   Full-Width Fluid Containers & Layout Grids
   ========================================================================== */
.container {
  max-width: 1680px;
  width: 100%;
  margin: 32px auto 60px;
  padding: 0 clamp(16px, 3.5vw, 50px);
  min-height: calc(100vh - 170px);
}

.narrow {
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
}

/* Typography Headings */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Plus Jakarta Sans', 'Poppins', sans-serif;
  color: var(--ink);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-top: 0;
}

h1 { font-size: clamp(26px, 3.8vw, 38px); margin-bottom: 8px; line-height: 1.2; }
h2 { font-size: clamp(20px, 2.8vw, 28px); margin-bottom: 8px; }
h3 { font-size: clamp(17px, 2.2vw, 22px); margin-bottom: 6px; }

.muted {
  color: var(--muted);
}

.eyebrow {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 6px;
  display: inline-block;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 28px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
}

.page-head h1 {
  margin: 4px 0 6px;
}

.page-head p.muted {
  margin: 0;
  font-size: 14px;
}

/* ==========================================================================
   Glassmorphism Cards, Panels & Command Center
   ========================================================================== */
.panel, .glass-surface, .auth-card, .course-card, .stat-card, .dash-stat-box, .crud-command-card {
  background: var(--glass-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 14px 35px rgba(15, 23, 42, 0.05), 0 1px 3px rgba(0, 0, 0, 0.02);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.panel {
  padding: clamp(20px, 3vw, 32px);
  margin: 24px 0;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 10px;
}

.section-title h2 {
  margin: 0;
  font-size: 19px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ==========================================================================
   Modern Buttons & Action Triggers
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 10px;
  padding: 10px 20px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
  line-height: 1.4;
  white-space: nowrap;
}

.btn:active {
  transform: translateY(1px);
}

/* Primary Amber Orange */
.btn.primary, .btn-primary, .btn-apex-orange {
  background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(255, 152, 0, 0.35);
}

.btn.primary:hover, .btn-primary:hover, .btn-apex-orange:hover {
  background: linear-gradient(135deg, #ffa726 0%, #ea580c 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(255, 152, 0, 0.45);
}

/* Blue Action */
.btn-blue {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
}

.btn-blue:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.4);
}

/* Emerald Success */
.btn-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(16, 185, 129, 0.4);
}

/* Danger / Delete */
.btn-danger {
  background: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%);
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(244, 63, 94, 0.3);
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(244, 63, 94, 0.45);
}

/* Frosted Glass Button */
.btn-glass, .btn-apex-glass {
  background: rgba(255, 255, 255, 0.15);
  color: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.btn-glass:hover, .btn-apex-glass:hover {
  background: rgba(255, 255, 255, 0.35);
  border-color: rgba(255, 255, 255, 0.7);
  transform: translateY(-2px);
}

/* Outline Button */
.btn-outline {
  background: transparent;
  color: var(--navy);
  border: 1.5px solid #cbd5e1;
}

.btn-outline:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  transform: translateY(-2px);
}

/* Button Sizes */
.btn-sm {
  padding: 6px 12px;
  font-size: 11.5px;
  border-radius: 7px;
}

.btn-lg {
  padding: 13px 28px;
  font-size: 15px;
  border-radius: 12px;
}

.btn.full {
  width: 100%;
}

.link-button {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

/* ==========================================================================
   Modern Form Inputs & Controls
   ========================================================================== */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 6px 0;
}

.field span, label {
  font-size: 13px;
  font-weight: 700;
  color: #334155;
  letter-spacing: 0.01em;
}

.field.wide {
  grid-column: 1 / -1;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="number"],
input[type="tel"],
input[type="search"],
select,
textarea {
  width: 100%;
  padding: 11px 15px;
  border: 1.5px solid #cbd5e1;
  border-radius: 11px;
  background: #ffffff;
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

input:hover, select:hover, textarea:hover {
  border-color: #94a3b8;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #ff9800;
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(255, 152, 0, 0.16);
}

input::placeholder, textarea::placeholder {
  color: #94a3b8;
  font-size: 13.5px;
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 15px;
  padding-right: 42px;
}

textarea {
  resize: vertical;
  min-height: 95px;
}

input[type="checkbox"], input[type="radio"] {
  accent-color: #ff9800;
  width: 18px;
  height: 18px;
  cursor: pointer;
  vertical-align: middle;
}

/* Inline form bar (like search / filter bars) */
.inline-form {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.inline-form .field {
  flex: 1;
  min-width: 240px;
  margin: 0;
}

/* ==========================================================================
   Modern Data Tables & Records Layout
   ========================================================================== */
.table-wrap {
  overflow-x: auto;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.02);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  text-align: left;
}

thead th {
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  color: #475569;
  font-size: 11.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 13px 16px;
  border-bottom: 2px solid #e2e8f0;
  white-space: nowrap;
}

tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid #f1f5f9;
  color: #1e293b;
  vertical-align: middle;
}

tbody tr {
  transition: background-color 0.18s ease;
}

tbody tr:hover {
  background: rgba(255, 152, 0, 0.04) !important;
}

tbody tr:last-child td {
  border-bottom: none;
}

td.empty {
  text-align: center;
  color: #94a3b8;
  padding: 40px 20px;
  font-size: 14px;
  font-weight: 500;
}

/* ==========================================================================
   Status Badges, Role Pills & Labels
   ========================================================================== */
.badge, .role-pill, .course-tag, .status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1.2;
}

.role-pill, .badge-info {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.badge-success {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.badge-warning {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}

.badge-danger {
  background: #fff1f2;
  color: #be123c;
  border: 1px solid #fecdd3;
}

/* Pulsing Live Dot */
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  display: inline-block;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse-dot 1.8s infinite;
}

@keyframes pulse-dot {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* ==========================================================================
   Notice & Alert Banners
   ========================================================================== */
.notice, .alert {
  padding: 15px 20px;
  border-radius: 12px;
  margin: 18px 0;
  font-size: 13.5px;
  line-height: 1.55;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}

.notice.success {
  background: #ecfdf5;
  border: 1.5px solid #a7f3d0;
  border-left: 5px solid #10b981;
  color: #065f46;
}

.notice.danger, .alert {
  background: #fff1f2;
  border: 1.5px solid #fecdd3;
  border-left: 5px solid #f43f5e;
  color: #9f1239;
}

.notice.warning {
  background: #fffbeb;
  border: 1.5px solid #fde68a;
  border-left: 5px solid #f59e0b;
  color: #92400e;
}

/* ==========================================================================
   Stat Counters & Cards
   ========================================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin: 24px 0;
}

.stat-card {
  padding: 22px;
  position: relative;
  overflow: hidden;
}

.stat-card:hover {
  transform: translateY(-3px);
  border-color: #ff9800;
  box-shadow: 0 14px 30px rgba(255, 152, 0, 0.12);
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-card strong {
  display: block;
  font-size: clamp(28px, 3.2vw, 36px);
  font-weight: 900;
  color: var(--ink);
  margin-top: 8px;
  line-height: 1;
}

/* ==========================================================================
   Auth / Login Layout
   ========================================================================== */
.auth-wrap {
  display: grid;
  place-items: center;
  min-height: 72vh;
  padding: 24px 16px;
}

.auth-card {
  padding: 38px 34px;
  width: min(100%, 460px);
  text-align: center;
}

.brand-mark {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
  border-radius: 14px;
  color: white;
  display: grid;
  place-items: center;
  font: 900 24px 'Plus Jakarta Sans', sans-serif;
  box-shadow: 0 8px 20px rgba(255, 152, 0, 0.35);
  margin: 0 auto 12px;
}

.brand-mark.large {
  width: 60px;
  height: 60px;
  font-size: 32px;
  border-radius: 16px;
}

.auth-card form {
  text-align: left;
  margin: 22px 0 20px;
}

/* ==========================================================================
   Examination / Quiz Elements
   ========================================================================== */
.question {
  border: 1.5px solid #e2e8f0;
  border-radius: 14px;
  padding: 22px;
  margin: 18px 0;
  background: #ffffff;
  transition: all 0.2s ease;
}

.question:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
}

.question legend {
  font-size: 15px;
  font-weight: 800;
  color: #0f172a;
  padding: 0 8px;
  margin-bottom: 12px;
}

.option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  margin: 8px 0;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.18s ease;
  font-size: 14px;
}

.option:hover {
  background: #fff7ed;
  border-color: #fed7aa;
}

.option input[type="radio"]:checked + span,
.option:has(input[type="radio"]:checked) {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1e40af;
  font-weight: 700;
}

.exam-clock {
  position: sticky;
  top: 76px;
  z-index: 50;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border: 1.5px solid #ffedd5;
  border-radius: 12px;
  padding: 12px 18px;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 6px 20px rgba(255, 152, 0, 0.12);
  color: #9a3412;
  font-weight: 700;
}

/* ==========================================================================
   Print Styles (Certificates, Receipts, Slips)
   ========================================================================== */
@media print {
  .no-print, .apex-top-bar, .apex-header, .admin-sub-bar, footer, nav, .btn, .link-button, .notice.no-print {
    display: none !important;
  }
  body {
    background: #ffffff !important;
    color: #000000 !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  .container {
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    min-height: auto !important;
  }
  .certificate-wrap {
    background: none !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  .certificate-sheet, .admission-slip-card {
    box-shadow: none !important;
    margin: 0 auto !important;
    page-break-inside: avoid !important;
  }
  @page {
    size: auto;
    margin: 8mm;
  }
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .container {
    padding: 0 16px;
    margin: 20px auto 40px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .field.wide {
    grid-column: auto;
  }
  .inline-form {
    flex-direction: column;
    align-items: stretch;
  }
  .inline-form .btn {
    width: 100%;
  }
  .page-head {
    flex-direction: column;
    align-items: flex-start;
  }
}
