/* ============================================================
   SSC Genius — Main Stylesheet
   ============================================================ */

:root {
  --sg-primary: #0b3d91;
  --sg-primary-dark: #082d6e;
  --sg-accent: #f5b301;
  --sg-accent-dark: #d99e00;
  --sg-student: #1a7a4a;
  --sg-student-dark: #145e38;
  --sg-bg: #f0f4f8;
  --sg-card-bg: #ffffff;
  --sg-text: #1e293b;
  --sg-muted: #64748b;
  --sg-border: #e2e8f0;
  --sg-radius: 12px;
  --sg-shadow: 0 2px 12px rgba(0,0,0,.08);
  --sg-shadow-hover: 0 6px 24px rgba(0,0,0,.14);
}

*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--sg-bg);
  color: var(--sg-text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- Navbars ---- */
.sg-navbar-admin   { background: var(--sg-primary); min-height: 56px; }
.sg-navbar-public  { background: var(--sg-primary); min-height: 56px; }

/* ════ Student Top Bar ════ */
.sg-navbar-student {
  background: linear-gradient(135deg, #080f2e 0%, #0f2557 35%, #1a3a6b 70%, #1e4d8c 100%);
  min-height: 64px;
  padding: 0 1.5rem;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(8,15,46,.45);
}
/* subtle grid overlay */
.sg-navbar-student::before {
  content: '';
  position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 32px 32px;
}
/* gold shimmer bottom border */
.sg-navbar-student::after {
  content: '';
  position: absolute; bottom: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg,
    transparent 0%, var(--sg-accent) 25%,
    #ffe066 50%, var(--sg-accent) 75%, transparent 100%);
  background-size: 200% 100%;
  animation: sg-shimmer 3s linear infinite;
}
/* Brand */
.sg-navbar-student .navbar-brand {
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: .01em;
  color: #fff !important;
  display: flex;
  align-items: center;
  gap: .55rem;
  position: relative; z-index: 2;
  text-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.sg-navbar-student .navbar-brand .sg-brand-icon {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--sg-accent), #f0a800);
  display: flex; align-items: center; justify-content: center;
  color: #1a1100; font-size: 1.1rem;
  box-shadow: 0 4px 12px rgba(245,179,1,.4);
  flex-shrink: 0;
}
.sg-navbar-student .navbar-brand .sg-brand-name {
  line-height: 1.15;
}
.sg-navbar-student .navbar-brand .sg-brand-sub {
  display: block;
  font-size: .62rem;
  font-weight: 600;
  color: rgba(255,255,255,.55);
  letter-spacing: .08em;
  text-transform: uppercase;
}
/* User chip */
.sg-navbar-student .sg-user-chip {
  display: flex; align-items: center; gap: .5rem;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 30px;
  padding: .32rem .85rem .32rem .5rem;
  position: relative; z-index: 2;
}
.sg-navbar-student .sg-user-chip .sg-user-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--sg-accent), #f0a800);
  display: flex; align-items: center; justify-content: center;
  color: #1a1100; font-size: .75rem; font-weight: 800;
  flex-shrink: 0;
}
.sg-navbar-student .sg-user-chip .sg-user-name {
  font-size: .8rem; font-weight: 600;
  color: rgba(255,255,255,.85);
  max-width: 140px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* Logout button */
.sg-navbar-student .sg-logout-btn {
  position: relative; z-index: 2;
  padding: .38rem .95rem;
  border-radius: 22px;
  font-size: .78rem; font-weight: 700;
  color: rgba(255,255,255,.8);
  border: 1.5px solid rgba(255,255,255,.22);
  background: rgba(255,255,255,.07);
  text-decoration: none;
  display: inline-flex; align-items: center; gap: .35rem;
  transition: all .2s ease;
}
.sg-navbar-student .sg-logout-btn:hover {
  background: rgba(220,38,38,.25);
  border-color: rgba(220,38,38,.5);
  color: #fca5a5;
  box-shadow: 0 0 14px rgba(220,38,38,.2);
}

/* ════ Student Sub-Nav Tab Bar ════ */
.sg-student-nav {
  background: linear-gradient(90deg, #0a1d40 0%, #0f2557 50%, #0a1d40 100%);
  border-bottom: 1px solid rgba(255,255,255,.08);
  padding: 0 1.5rem;
  display: flex;
  gap: .25rem;
  align-items: stretch;
  min-height: 44px;
  box-shadow: 0 3px 12px rgba(8,15,46,.3);
}
.sg-student-nav a {
  color: rgba(255,255,255,.6);
  text-decoration: none;
  font-size: .82rem;
  font-weight: 600;
  padding: 0 .9rem;
  display: inline-flex; align-items: center; gap: .4rem;
  position: relative;
  letter-spacing: .01em;
  transition: color .18s;
  white-space: nowrap;
}
.sg-student-nav a::after {
  content: '';
  position: absolute; bottom: 0; left: 50%; right: 50%;
  height: 3px;
  background: linear-gradient(90deg, var(--sg-accent), #ffe066);
  border-radius: 3px 3px 0 0;
  transition: left .22s ease, right .22s ease;
  box-shadow: 0 0 8px rgba(245,179,1,.5);
}
.sg-student-nav a:hover {
  color: rgba(255,255,255,.9);
}
.sg-student-nav a:hover::after,
.sg-student-nav a.active::after {
  left: .5rem; right: .5rem;
}
.sg-student-nav a.active {
  color: #fff;
}
.sg-student-nav a i {
  font-size: .82rem;
  opacity: .85;
}

/* ---- Admin sidebar ---- */
.sg-sidebar {
  background: linear-gradient(175deg, #0c3282 0%, #082464 55%, #071d52 100%);
  min-height: calc(100vh - 56px);
  width: 245px;
  box-shadow: 4px 0 28px rgba(0,0,0,.28);
  position: relative;
  z-index: 10;
  padding-bottom: 2rem;
}

/* Animated gold shimmer top bar */
.sg-sidebar::before {
  content: '';
  display: block;
  height: 3px;
  background: linear-gradient(90deg,
    transparent 0%, var(--sg-accent) 30%,
    #ffe066 50%, var(--sg-accent) 70%, transparent 100%);
  background-size: 200% 100%;
  animation: sg-shimmer 2.8s linear infinite;
}
@keyframes sg-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Subtle glow at bottom */
.sg-sidebar::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 120px;
  background: linear-gradient(0deg, rgba(245,179,1,.06) 0%, transparent 100%);
  pointer-events: none;
}

/* Section labels */
.sg-sidebar .sg-nav-section {
  font-size: .6rem;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: rgba(255,255,255,.32);
  padding: 1.1rem 1.4rem .3rem;
  user-select: none;
}

/* Divider */
.sg-sidebar .sg-nav-divider {
  border: none;
  border-top: 1px solid rgba(255,255,255,.08);
  margin: .45rem 1rem .1rem;
}

/* Nav links */
.sg-sidebar .nav-link {
  color: rgba(255,255,255,.65);
  font-size: .865rem;
  font-weight: 500;
  padding: .52rem 1rem .52rem .9rem;
  margin: 2px .6rem 2px 0;
  border-radius: 0 50px 50px 0;
  display: flex;
  align-items: center;
  gap: .65rem;
  transition: color .18s, background .18s, transform .15s, box-shadow .18s;
  position: relative;
  overflow: hidden;
  text-decoration: none;
}

/* Icon chip */
.sg-sidebar .nav-link .sg-nav-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: rgba(255,255,255,.07);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .95rem;
  flex-shrink: 0;
  transition: background .18s, box-shadow .18s, color .18s;
}

/* Sub-caption (e.g. "Uploaded by Students") */
.sg-sidebar .nav-link .sg-nav-sub {
  display: block;
  font-size: .65rem;
  color: rgba(255,255,255,.38);
  font-weight: 400;
  line-height: 1.25;
  margin-top: 1px;
}

/* Hover */
.sg-sidebar .nav-link:hover {
  color: #fff;
  background: rgba(255,255,255,.09);
  transform: translateX(4px);
}
.sg-sidebar .nav-link:hover .sg-nav-icon {
  background: rgba(245,179,1,.22);
  box-shadow: 0 0 12px rgba(245,179,1,.18);
  color: #ffe066;
}

/* Active */
.sg-sidebar .nav-link.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(245,179,1,.2) 0%, rgba(245,179,1,.04) 100%);
  font-weight: 600;
  transform: translateX(2px);
  box-shadow: inset 0 0 0 1px rgba(245,179,1,.15);
}
.sg-sidebar .nav-link.active::before {
  content: '';
  position: absolute;
  left: 0; top: 12%; bottom: 12%;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: linear-gradient(180deg, #ffe066, var(--sg-accent));
  box-shadow: 0 0 10px rgba(245,179,1,.7);
}
.sg-sidebar .nav-link.active .sg-nav-icon {
  background: linear-gradient(135deg, var(--sg-accent), #f0a800);
  color: #1a1100;
  box-shadow: 0 4px 14px rgba(245,179,1,.45);
}


/* ---- Cards ---- */
.sg-card {
  background: var(--sg-card-bg);
  border-radius: var(--sg-radius);
  box-shadow: var(--sg-shadow);
  border: 1px solid var(--sg-border);
  transition: box-shadow .2s;
}
.sg-card:hover { box-shadow: var(--sg-shadow-hover); }
.sg-card-body  { padding: 1.5rem; }

/* ---- Stat cards ---- */
.sg-stat {
  background: var(--sg-card-bg);
  border-radius: var(--sg-radius);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--sg-shadow);
  border-left: 4px solid var(--sg-accent);
  display: flex;
  align-items: center;
  gap: 1rem;
}
.sg-stat .icon {
  font-size: 2.2rem;
  opacity: .8;
}
.sg-stat .value {
  font-size: 1.8rem;
  font-weight: 700;
  line-height: 1;
}
.sg-stat .label {
  font-size: .8rem;
  color: var(--sg-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* ---- Hero ---- */
.sg-hero {
  background: linear-gradient(135deg, var(--sg-primary) 0%, #1558c4 100%);
  color: #fff;
  border-radius: var(--sg-radius);
  padding: 2.5rem 2rem;
}

/* ---- Buttons ---- */
.btn-accent {
  background: var(--sg-accent);
  border-color: var(--sg-accent);
  color: #1a1a1a;
  font-weight: 600;
}
.btn-accent:hover {
  background: var(--sg-accent-dark);
  border-color: var(--sg-accent-dark);
  color: #1a1a1a;
}
.btn-student {
  background: var(--sg-student);
  border-color: var(--sg-student);
  color: #fff;
  font-weight: 600;
}
.btn-student:hover {
  background: var(--sg-student-dark);
  border-color: var(--sg-student-dark);
  color: #fff;
}

/* ---- Forms ---- */
.form-control:focus, .form-select:focus {
  border-color: var(--sg-primary);
  box-shadow: 0 0 0 .2rem rgba(11,61,145,.15);
}
.form-label { font-weight: 500; font-size: .9rem; }

/* ---- Tables ---- */
.table th {
  background: var(--sg-primary);
  color: #fff;
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
}
.table-hover tbody tr:hover { background: #f0f7ff; }

/* ---- Quiz ---- */
.sg-quiz-option {
  display: block;
  padding: .75rem 1rem;
  border: 2px solid var(--sg-border);
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: .5rem;
  transition: all .2s;
  background: #fff;
}
.sg-quiz-option:hover { border-color: var(--sg-primary); background: #f0f7ff; }
.sg-quiz-option input[type=radio] { margin-right: .5rem; }
.sg-quiz-option.sg-correct   { border-color: #28a745; background: #e6f4ea; }
.sg-quiz-option.sg-incorrect  { border-color: #dc3545; background: #fce8e8; }

/* ---- AI Feature Styles ---- */
/* Admin: AI Generate Button */
.ai-generate-btn {
  font-size: .78rem;
  padding: .25rem .65rem;
  border-radius: 20px;
  border: 1px solid #6f42c1;
  background: linear-gradient(135deg, #6f42c1, #8b5cf6);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  transition: all .2s;
  font-weight: 500;
}
.ai-generate-btn:hover {
  background: linear-gradient(135deg, #5a32a3, #7c3aed);
  box-shadow: 0 2px 8px rgba(111,66,193,.35);
  transform: translateY(-1px);
}
.ai-generate-btn:disabled {
  opacity: .65;
  cursor: not-allowed;
  transform: none;
}
.ai-generate-btn .spinner-border {
  width: .85rem;
  height: .85rem;
  border-width: .15em;
}

/* Student: AI Q&A Box */
.sg-ai-box {
  background: linear-gradient(135deg, #f0f4ff 0%, #faf0ff 100%);
  border: 2px solid #c4b5fd;
  border-radius: var(--sg-radius);
  padding: 1.5rem;
  margin-top: 1.5rem;
}
.sg-ai-box .ai-header {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: 1rem;
}
.sg-ai-box .ai-header .ai-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6f42c1, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.sg-ai-box .ai-header h6 {
  margin: 0;
  font-weight: 700;
  color: #4c1d95;
}
.sg-ai-box .ai-header small {
  display: block;
  color: #7c3aed;
  font-size: .78rem;
}
.sg-ai-answer {
  background: #fff;
  border: 1px solid #ddd6fe;
  border-radius: 8px;
  padding: 1rem 1.2rem;
  margin-top: 1rem;
  font-size: .93rem;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--sg-text);
  display: none;
}
.sg-ai-answer.show { display: block; }
.sg-ai-typing {
  display: none;
  align-items: center;
  gap: .5rem;
  color: #7c3aed;
  font-size: .85rem;
  margin-top: .75rem;
}
.sg-ai-typing.show { display: flex; }

/* ---- AI-filled field highlight ---- */
.ai-filled {
  border-color: #7c3aed !important;
  box-shadow: 0 0 0 .2rem rgba(124,58,237,.2) !important;
  transition: border-color .3s, box-shadow .3s;
  background: #faf5ff !important;
}
.ai-badge {
  display: none;
  align-items: center;
  gap: .25rem;
  font-size: .72rem;
  color: #7c3aed;
  font-weight: 600;
  background: #ede9fe;
  padding: .15rem .55rem;
  border-radius: 20px;
  border: 1px solid #c4b5fd;
}
.ai-badge i { font-size: .8rem; }

/* ---- Badge / Grade ---- */
.grade-A { color: #1a7a4a; font-weight: 700; }
.grade-B { color: #0b3d91; font-weight: 700; }
.grade-C { color: #d97706; font-weight: 700; }
.grade-D { color: #dc3545; font-weight: 700; }

/* ---- Footer ---- */
.sg-footer {
  background: linear-gradient(145deg, #0b2a6b 0%, #0d3380 45%, #0a2460 100%);
  margin-top: auto;
  position: relative;
  overflow: hidden;
}

/* Background dot pattern */
.sg-footer::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
}

/* Glowing orb top-right */
.sg-footer::after {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 260px; height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(245,179,1,.12) 0%, transparent 70%);
  pointer-events: none;
}

/* Wave divider */
.sg-footer-wave {
  line-height: 0;
  margin-bottom: -2px;
}
.sg-footer-wave svg {
  display: block;
  width: 100%;
  height: 54px;
}

/* Main content area */
.sg-footer-main {
  padding: 40px 0 36px;
  position: relative;
  z-index: 1;
}

/* Brand block (icon + school name) */
.sg-footer-brand-block {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 16px;
}
.sg-footer-brand-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--sg-accent), #f0a800);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  color: #1a1100;
  flex-shrink: 0;
  box-shadow: 0 6px 20px rgba(245,179,1,.35);
}
.sg-footer-school-name {
  font-size: 1.05rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.25;
  letter-spacing: .01em;
}
.sg-footer-tagline {
  font-size: .8rem;
  color: rgba(255,255,255,.6);
  margin-top: 3px;
  line-height: 1.4;
}

/* Gold accent divider under brand */
.sg-footer-brand-divider {
  width: 48px; height: 3px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--sg-accent), #ffe066);
  margin-bottom: 14px;
  box-shadow: 0 2px 8px rgba(245,179,1,.4);
}

.sg-footer-about-text {
  font-size: .82rem;
  color: rgba(255,255,255,.55);
  line-height: 1.7;
  margin: 0;
}

/* Vertical divider (desktop) */
.sg-footer-vdivider {
  width: 1px;
  height: 100%;
  min-height: 120px;
  background: linear-gradient(180deg, transparent, rgba(255,255,255,.15), transparent);
}

/* Section headings */
.sg-footer-col-title {
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--sg-accent);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Contact items */
.sg-footer-contacts {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.sg-footer-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 13.5px;
  color: rgba(255,255,255,.8);
  transition: color .2s;
}
.sg-footer-item:hover { color: #fff; }
.sg-footer-item-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.1);
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem;
  color: var(--sg-accent);
  flex-shrink: 0;
  transition: background .2s, box-shadow .2s;
}
.sg-footer-item:hover .sg-footer-item-icon {
  background: rgba(245,179,1,.18);
  box-shadow: 0 0 10px rgba(245,179,1,.2);
}
.sg-footer-item span { line-height: 1.55; padding-top: 5px; }

/* Copyright bar */
.sg-footer-copy {
  background: rgba(0,0,0,.28);
  border-top: 1px solid rgba(255,255,255,.08);
  padding: 13px 0;
  font-size: 12px;
  position: relative;
  z-index: 1;
}
.sg-footer-copy-left {
  color: rgba(255,255,255,.5);
}
.sg-footer-copy-center {
  color: rgba(255,255,255,.45);
}
.sg-footer-version {
  background: rgba(255,255,255,.1);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: .72rem;
  color: var(--sg-accent);
  font-weight: 700;
}
.sg-footer-copy-credit {
  color: rgba(255,255,255,.7);
  font-size: .78rem;
  letter-spacing: .01em;
}
.sg-footer-copy-credit strong {
  color: var(--sg-accent);
  font-weight: 800;
  letter-spacing: .02em;
}

@media (max-width: 767px) {
  .sg-footer-copy .d-flex { flex-direction: column; text-align: center; gap: .4rem !important; }
  .sg-footer-copy-credit { text-align: center; }
  .sg-footer-vdivider { display: none; }
}
