/* ============================================================
   TSO — Unified Modern Design System  (v2.0)
   Indigo primary + Gold accent + Slate neutrals
   Loaded site-wide via inc/meta.php → applies to every page
   ============================================================ */

:root {
  /* Brand / actions */
  --primary: #4f46e5;          /* indigo — primary CTAs, links, active */
  --primary-dark: #4338ca;
  --primary-light: #eef2ff;
  --primary-color: #4f46e5;    /* legacy alias (older markup) */
  --primary-hover: #4338ca;

  /* Accent (brand gold) */
  --accent: #f5b942;
  --accent-soft: #fff7e6;
  --gold: #f5d773;

  --secondary-color: #ef4444;  /* danger/red legacy alias */
  --success: #16a34a;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #0ea5e9;

  /* Neutrals (slate) */
  --dark-color: #0f172a;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --light-color: #f8fafc;
  --bg: #f6f7fb;
  --white: #ffffff;

  --glass: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(226, 232, 240, 0.8);

  /* Elevation */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15,23,42,0.04);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 30px -8px rgba(15, 23, 42, 0.18);
  --shadow-primary: 0 8px 22px -6px rgba(79, 70, 229, 0.45);

  /* Radii */
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-pill: 50rem;

  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- Base ---------- */
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Poppins', 'Inter', sans-serif;
  font-weight: 700;
  color: var(--dark-color);
  letter-spacing: -0.02em;
}

a { color: var(--primary); transition: var(--transition); }
a:hover { color: var(--primary-dark); }

::selection { background: var(--primary); color: #fff; }

/* Nice slim scrollbars */
* { scrollbar-width: thin; scrollbar-color: #cbd5e1 transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 20px; }
*::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ============================================================
   BUTTONS — one consistent scale everywhere
   ============================================================ */
.btn {
  font-family: 'Inter', sans-serif;
  font-weight: 600 !important;
  border-radius: var(--radius-sm) !important;
  padding: 0.65rem 1.4rem !important;
  font-size: 0.9rem !important;
  line-height: 1.4 !important;
  transition: var(--transition) !important;
  border: 1.5px solid transparent !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: none;
}
.btn:focus, .btn:active:focus { box-shadow: 0 0 0 3px rgba(79,70,229,0.25) !important; outline: none; }
.btn i, .btn svg { width: 16px; height: 16px; }

.btn-sm { padding: 0.4rem 0.9rem !important; font-size: 0.8rem !important; border-radius: 8px !important; }
.btn-lg { padding: 0.9rem 2rem !important; font-size: 1rem !important; border-radius: var(--radius-md) !important; }

.btn-primary, .btn-modern-primary {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  color: #fff !important;
}
.btn-primary:hover, .btn-modern-primary:hover {
  background: var(--primary-dark) !important;
  border-color: var(--primary-dark) !important;
  color: #fff !important;
  transform: translateY(-2px);
  box-shadow: var(--shadow-primary) !important;
}

.btn-accent {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  color: #3d2c00 !important;
}
.btn-accent:hover { filter: brightness(0.96); transform: translateY(-2px); box-shadow: 0 8px 22px -6px rgba(245,185,66,0.5) !important; }

.btn-outline-primary {
  background: transparent !important;
  border-color: var(--primary) !important;
  color: var(--primary) !important;
}
.btn-outline-primary:hover { background: var(--primary) !important; color: #fff !important; transform: translateY(-2px); }

.btn-outline-dark, .btn-outline-secondary {
  background: transparent !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
}
.btn-outline-dark:hover, .btn-outline-secondary:hover {
  background: var(--dark-color) !important;
  border-color: var(--dark-color) !important;
  color: #fff !important;
  transform: translateY(-2px);
}

.btn-success { background: var(--success) !important; border-color: var(--success) !important; color:#fff !important; }
.btn-danger  { background: var(--danger)  !important; border-color: var(--danger)  !important; color:#fff !important; }
.btn-secondary { background: #eef1f6 !important; border-color:#eef1f6 !important; color: var(--text) !important; }
.btn-secondary:hover { background:#e2e8f0 !important; color:var(--dark-color) !important; }
.btn-light, .btn-white { background:#fff !important; border-color: var(--border) !important; color: var(--text) !important; }
.btn-light:hover, .btn-white:hover { background: var(--light-color) !important; }

.btn-block { width:100%; }

/* Header auth buttons (logged-out) — compact, consistent size */
.btn-header-login, .btn-header-gallery {
  display: inline-flex !important; align-items: center; align-self: center; gap: 7px;
  height: 42px !important; padding: 0 18px !important;
  border-radius: var(--radius-pill) !important;
  font-weight: 700 !important; font-size: 0.88rem !important; line-height: 1 !important;
  text-transform: none !important; letter-spacing: 0 !important;
  text-decoration: none; white-space: nowrap;
  transition: var(--transition);
}
.btn-header-login i, .btn-header-gallery i { width: 16px; height: 16px; stroke-width: 2.4px; }

.btn-header-login {
  background: linear-gradient(135deg, var(--primary) 0%, #6366f1 100%);
  color: #fff !important;
  border: none;
  box-shadow: 0 6px 16px -6px rgba(79,70,229,0.5);
}
.btn-header-login:hover { transform: translateY(-2px); box-shadow: 0 10px 24px -6px rgba(79,70,229,0.6); color:#fff !important; }

.btn-header-gallery {
  background: #fff;
  color: var(--text) !important;
  border: 1.5px solid var(--border);
}
.btn-header-gallery:hover { border-color: var(--primary); color: var(--primary) !important; background: var(--primary-light); }

@media (max-width: 768px) {
  .btn-header-login, .btn-header-gallery { height: 38px; padding: 0 14px; font-size: 0.82rem; }
}

.btn-play-quiz {
  background: linear-gradient(135deg, var(--accent) 0%, #f59e0b 100%) !important;
  color: #3d2c00 !important;
  border: none !important;
  box-shadow: 0 4px 12px -4px rgba(245,158,11,0.5) !important;
  height: 40px !important;
  padding: 0 16px !important;
  font-size: 0.82rem !important;
  font-weight: 700 !important;
  border-radius: var(--radius-pill) !important;
}
.btn-play-quiz i { width: 15px !important; height: 15px !important; }
.btn-play-quiz:hover { transform: translateY(-2px); color:#3d2c00 !important; box-shadow: 0 6px 16px -5px rgba(245,158,11,0.6) !important; }
@media (max-width: 768px){ .btn-play-quiz { height: 36px !important; padding: 0 12px !important; } }

/* ============================================================
   HEADER
   ============================================================ */
.header {
  background: var(--glass) !important;
  backdrop-filter: blur(14px) !important;
  -webkit-backdrop-filter: blur(14px) !important;
  border-bottom: 1px solid var(--glass-border) !important;
  height: 72px !important;
  box-shadow: var(--shadow-sm) !important;
}
.header.sticky-top { position: sticky; top: 0; z-index: 1000; }
.header-logo .logo-img { max-height: 46px; width:auto; object-fit:contain; transition: var(--transition); }
.header-logo:hover .logo-img { transform: scale(1.05); }

.nav-link {
  color: var(--text) !important;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.5rem 0.9rem !important;
  border-radius: var(--radius-sm);
  display: flex; align-items: center;
}
.nav-link i { margin-right: 6px; width: 18px; stroke-width: 2.4px; }
.nav-link:hover { background: var(--primary-light); color: var(--primary) !important; }
.user-menu .dropdown-toggle::after { display: none; }
.user-img img { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; border: 2px solid var(--primary); }
.badge-pill { background: var(--danger) !important; font-size: 10px; padding: 3px 6px; border: 2px solid var(--white); }

.dropdown-menu { border: 1px solid var(--border) !important; box-shadow: var(--shadow-lg) !important; border-radius: var(--radius-md) !important; }
.dropdown-item { border-radius: 10px; font-weight: 500; }
.dropdown-item:hover, .hover-bg-light:hover { background: var(--primary-light) !important; color: var(--primary) !important; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  overflow: hidden;
}
.card:hover { box-shadow: var(--shadow-md); }
.card-body { padding: 1.4rem; }

.glass-card {
  background: var(--glass);
  backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

/* Category cards (home) — keep the 3D "icon pops out of card" look */
.tso-card {
  border-radius: var(--radius-lg) !important;
  border: none !important;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
  overflow: visible !important;   /* let the 3D icon overflow above the card */
}
.tso-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }
.tso-card h4 { word-break: keep-all; overflow-wrap: normal; hyphens: none; line-height: 1.2; }

/* Subject cards */
.subject-card {
  border-radius: var(--radius-md) !important;
  overflow:hidden; border:none !important;
  box-shadow: var(--shadow-md); transition: var(--transition);
}
.subject-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }

/* ============================================================
   FORMS
   ============================================================ */
.form-control, .form-select, .custom-select {
  border: 1.5px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
  padding: 0.7rem 1rem !important;
  font-size: 0.92rem !important;
  color: var(--text) !important;
  background: #fff !important;
  transition: var(--transition) !important;
  box-shadow: none !important;
  height: auto !important;
}
.form-control:focus, .form-select:focus, .custom-select:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(79,70,229,0.15) !important;
}
.form-control::placeholder { color: #94a3b8; }
/* icon-prefixed inputs: leave room for the icon */
.form-control.pl-5 { padding-left: 2.9rem !important; }
.position-relative > .input-icon { position:absolute; left:16px; top:50%; transform:translateY(-50%); z-index:5; width:18px; height:18px; color:#94a3b8; }
label, .form-label { font-weight: 600; color: var(--text); font-size: 0.85rem; margin-bottom: 0.4rem; }
.input-group-text { border:1.5px solid var(--border) !important; background: var(--light-color) !important; border-radius: var(--radius-sm) !important; color: var(--text-muted); }

/* ============================================================
   TABLES  (admin / teacher)
   ============================================================ */
.table { color: var(--text); }
.table thead th {
  background: var(--light-color);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border) !important;
  border-top: none !important;
  padding: 0.9rem 1rem;
}
.table td { padding: 0.85rem 1rem; vertical-align: middle; border-top: 1px solid var(--border) !important; }
.table tbody tr { transition: var(--transition); }
.table-hover tbody tr:hover { background: var(--primary-light); }
.table-avatar img, .avatar-img { border-radius: 50% !important; object-fit: cover; }

.card-table .card, .card { background: #fff; }

/* Badges */
.badge { font-weight: 600; padding: 0.4em 0.7em; border-radius: 8px; font-size: 0.72rem; }
.badge-primary, .bg-primary { background: var(--primary) !important; color:#fff !important; }
.bg-primary-light, .badge.bg-primary-light { background: var(--primary-light) !important; color: var(--primary) !important; }
.bg-success-light { background:#dcfce7 !important; color: var(--success) !important; }
.bg-danger-light  { background:#fee2e2 !important; color: var(--danger) !important; }
.bg-warning-light { background:#fef3c7 !important; color: #b45309 !important; }

/* Alerts */
.alert { border:none; border-radius: var(--radius-sm); font-size:0.9rem; padding: 0.85rem 1.1rem; }
.alert-danger { background:#fee2e2; color:#b91c1c; }
.alert-success { background:#dcfce7; color:#15803d; }

/* Text/utility helpers */
.text-primary { color: var(--primary) !important; }
.text-warning { color: var(--warning) !important; }
.text-muted { color: var(--text-muted) !important; }
.rounded-xl { border-radius: var(--radius-lg) !important; }
.rounded-lg { border-radius: var(--radius-md) !important; }
.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.shadow, .shadow-lg { box-shadow: var(--shadow-lg) !important; }
.bg-light { background: var(--light-color) !important; }

.section-title { position: relative; padding-bottom: 14px; margin-bottom: 28px; }
.section-title::after {
  content:''; position:absolute; left:0; bottom:0;
  width: 54px; height: 4px; background: var(--primary); border-radius: 2px;
}

/* ============================================================
   FOOTER
   ============================================================ */
.modern-footer { background: #0b1020; color:#cbd5e1; padding: 70px 0 26px; position:relative; overflow:hidden; }
.modern-footer::before { content:''; position:absolute; top:0; left:0; right:0; height:4px; background: linear-gradient(90deg, var(--primary), var(--accent)); }
.footer-widget h3 { color:#fff; font-size:1.15rem; margin-bottom:22px; position:relative; padding-bottom:10px; }
.footer-widget h3::after { content:''; position:absolute; left:0; bottom:0; width:30px; height:2px; background: var(--accent); }
.footer-links { list-style:none; padding:0; margin:0; }
.footer-links li { margin-bottom:11px; }
.footer-links a { color:#94a3b8; text-decoration:none; display:flex; align-items:center; }
.footer-links a i { font-size:0.8rem; margin-right:10px; color: var(--accent); }
.footer-links a:hover { color:#fff; padding-left:5px; }
.social-links a { display:inline-flex; align-items:center; justify-content:center; width:38px; height:38px; background:rgba(255,255,255,0.06); border-radius:50%; margin-right:10px; color:#fff; transition: var(--transition); }
.social-links a:hover { background: var(--primary); transform: translateY(-3px); }
.footer-bottom { border-top:1px solid rgba(255,255,255,0.08); margin-top:44px; padding-top:26px; font-size:0.85rem; color:#7c8aa5; }

/* ============================================================
   MOBILE BOTTOM NAV
   ============================================================ */
.mobile-bottom-nav {
  background: var(--glass) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
}
.mobile-bottom-nav .nav-item.active { color: var(--primary) !important; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .header { height: 62px !important; padding: 0 14px !important; }
  .logo-img { max-height: 34px !important; }
  h2, .h2 { font-size: 1.5rem !important; }
  h1, .h1 { font-size: 1.8rem !important; }
  .btn { padding: 0.6rem 1.15rem !important; font-size: 0.85rem !important; }
  .btn-lg { padding: 0.8rem 1.5rem !important; font-size: 0.92rem !important; }
  .card-body { padding: 1.1rem; }
  .tso-card h4 { font-size: 0.9rem !important; }
  .section-title h5 { font-size: 1.15rem !important; }
  /* keep content clear of bottom nav */
  .page-wrapper, body.has-bottom-nav { padding-bottom: 84px; }
  .table-responsive { -webkit-overflow-scrolling: touch; }
}

@media (max-width: 480px) {
  .container, .container-fluid { padding-left: 14px; padding-right: 14px; }
}
