/* ============================================================
   Kirkland Homeschool Academy - Custom Stylesheet
   ============================================================ */

/* ----------------------------------------------------------
   Tailwind Directives (for build-time compilation if used)
   ---------------------------------------------------------- */
/* @tailwind base;
   @tailwind components;
   @tailwind utilities; */

/* Note: This project uses Tailwind via CDN, so directives are
   commented out. If migrating to a build step, uncomment above
   and remove the CDN script tag from base.html. */


/* ----------------------------------------------------------
   Smooth Scroll Behavior
   ---------------------------------------------------------- */

html {
  scroll-behavior: smooth;
}


/* ----------------------------------------------------------
   Base Resets
   ---------------------------------------------------------- */

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

body {
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
               "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}


/* ----------------------------------------------------------
   Page Fade-In Animation
   ---------------------------------------------------------- */

.page-enter {
  animation: pageFadeIn 0.35s ease-out both;
}

@keyframes pageFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}


/* ----------------------------------------------------------
   Glassmorphism Card
   ---------------------------------------------------------- */

.glass-card {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 1.25rem;
  box-shadow:
    0 8px 32px rgba(15, 23, 42, 0.08),
    0 2px 8px rgba(15, 23, 42, 0.04);
}

.glass-card-strong {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 1.25rem;
  box-shadow:
    0 12px 40px rgba(15, 23, 42, 0.1),
    0 4px 12px rgba(15, 23, 42, 0.05);
}


/* ----------------------------------------------------------
   Button Components
   ---------------------------------------------------------- */

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.625rem 1.25rem;
  background-color: #0F172A;
  color: white;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 0.75rem;
  border: none;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.2), 0 1px 2px rgba(15, 23, 42, 0.1);
}

.btn-primary:hover {
  background-color: #1E293B;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.25), 0 2px 4px rgba(15, 23, 42, 0.15);
}

.btn-primary:active {
  transform: scale(0.98);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.15);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-accent {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.625rem 1.25rem;
  background-color: #064E3B;
  color: white;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 0.75rem;
  border: none;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
  box-shadow: 0 1px 3px rgba(6, 78, 59, 0.3), 0 1px 2px rgba(6, 78, 59, 0.15);
}

.btn-accent:hover {
  background-color: #065F46;
  box-shadow: 0 4px 12px rgba(6, 78, 59, 0.3), 0 2px 4px rgba(6, 78, 59, 0.2);
}

.btn-accent:active {
  transform: scale(0.98);
  box-shadow: 0 1px 2px rgba(6, 78, 59, 0.2);
}

.btn-accent:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.625rem 1.25rem;
  background-color: transparent;
  color: #0F172A;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 0.75rem;
  border: 1.5px solid #E2E8F0;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-outline:hover {
  border-color: #064E3B;
  color: #064E3B;
  background-color: rgba(6, 78, 59, 0.04);
}

.btn-outline:active {
  transform: scale(0.98);
}


/* ----------------------------------------------------------
   Card Component
   ---------------------------------------------------------- */

.card {
  background-color: white;
  border-radius: 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
  border: 1px solid #F1F5F9;
  overflow: hidden;
}


/* ----------------------------------------------------------
   Navigation Item (Sidebar)
   ---------------------------------------------------------- */

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  transition: all 0.2s ease;
  position: relative;
}

.nav-item:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: white;
  transform: translateX(2px);
}

.nav-item.active {
  background-color: rgba(6, 78, 59, 0.5);
  color: white;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background-color: #10B981;
  border-radius: 0 2px 2px 0;
}

/* Sidebar section label */
.nav-section-label {
  padding: 0.5rem 0.75rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.35);
  margin-top: 0.75rem;
}


/* ----------------------------------------------------------
   Custom Scrollbar (Sidebar)
   ---------------------------------------------------------- */

.sidebar-scroll::-webkit-scrollbar {
  width: 4px;
}

.sidebar-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-scroll::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

.sidebar-scroll::-webkit-scrollbar-thumb:hover {
  background-color: rgba(255, 255, 255, 0.25);
}

/* Firefox scrollbar */
.sidebar-scroll {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}


/* ----------------------------------------------------------
   Progress Ring
   ---------------------------------------------------------- */

.progress-ring {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.progress-ring svg circle {
  transition: stroke-dashoffset 0.7s ease-out;
}


/* ----------------------------------------------------------
   Toast Notifications
   ---------------------------------------------------------- */

.toast {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  max-width: 24rem;
  cursor: pointer;
  animation: toastSlideIn 0.3s ease-out;
}

.toast-success {
  background-color: #ECFDF5;
  color: #065F46;
  border: 1px solid #A7F3D0;
}

.toast-error {
  background-color: #FEF2F2;
  color: #991B1B;
  border: 1px solid #FECACA;
}

.toast-info {
  background-color: #EFF6FF;
  color: #1E40AF;
  border: 1px solid #BFDBFE;
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateX(1rem);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}


/* ----------------------------------------------------------
   Quiz Option Styles
   ---------------------------------------------------------- */

.quiz-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  text-align: left;
  padding: 1rem;
  border-radius: 0.75rem;
  border: 2px solid #E2E8F0;
  background-color: white;
  font-size: 0.875rem;
  font-weight: 500;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
}

.quiz-option:hover:not(.disabled) {
  border-color: #064E3B;
  background-color: #F0FDF4;
}

.quiz-option.selected {
  border-color: #064E3B;
  background-color: #ECFDF5;
  box-shadow: 0 0 0 2px rgba(6, 78, 59, 0.15);
}

.quiz-option.correct {
  border-color: #16A34A;
  background-color: #F0FDF4;
}

.quiz-option.correct .option-text {
  color: #15803D;
  font-weight: 600;
}

.quiz-option.incorrect {
  border-color: #DC2626;
  background-color: #FEF2F2;
}

.quiz-option.incorrect .option-text {
  color: #B91C1C;
}

.quiz-option.disabled {
  cursor: default;
  opacity: 0.8;
  pointer-events: none;
}


/* ----------------------------------------------------------
   Grade Table (Report Card)
   ---------------------------------------------------------- */

.grade-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.grade-table th {
  text-align: left;
  padding: 0.875rem 1rem;
  font-size: 0.6875rem;
  font-weight: 700;
  color: #64748B;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 2px solid #E2E8F0;
  background-color: #F8FAFC;
  position: sticky;
  top: 0;
  z-index: 1;
}

.grade-table th:first-child {
  border-radius: 0.5rem 0 0 0;
}

.grade-table th:last-child {
  border-radius: 0 0.5rem 0 0;
}

.grade-table td {
  padding: 0.875rem 1rem;
  font-size: 0.875rem;
  border-bottom: 1px solid #F1F5F9;
  transition: background-color 0.15s ease;
}

.grade-table tbody tr:hover {
  background-color: #F0FDF9;
}

.grade-table tbody tr:hover td {
  color: #0F172A;
}

.grade-table tfoot td {
  padding: 0.875rem 1rem;
  font-weight: 700;
  border-top: 2px solid #E2E8F0;
  background-color: #F8FAFC;
}

.grade-green { color: #15803D; }
.grade-yellow { color: #A16207; }
.grade-red { color: #B91C1C; }


/* ----------------------------------------------------------
   Subject Color Utility Classes
   ---------------------------------------------------------- */

/* Math - Blue */
.math-blue { color: #2563EB; }
.bg-math-blue { background-color: #EFF6FF; }
.border-math-blue { border-color: #93C5FD; }
.badge-math-blue {
  background-color: #DBEAFE;
  color: #1E40AF;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* ELA - Purple */
.ela-purple { color: #7C3AED; }
.bg-ela-purple { background-color: #F5F3FF; }
.border-ela-purple { border-color: #C4B5FD; }
.badge-ela-purple {
  background-color: #EDE9FE;
  color: #5B21B6;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* Science - Teal */
.science-teal { color: #0D9488; }
.bg-science-teal { background-color: #F0FDFA; }
.border-science-teal { border-color: #5EEAD4; }
.badge-science-teal {
  background-color: #CCFBF1;
  color: #115E59;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* History - Amber */
.history-amber { color: #D97706; }
.bg-history-amber { background-color: #FFFBEB; }
.border-history-amber { border-color: #FCD34D; }
.badge-history-amber {
  background-color: #FEF3C7;
  color: #92400E;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}


/* ----------------------------------------------------------
   Worksheet Print Styles
   ---------------------------------------------------------- */

.worksheet-content {
  line-height: 1.8;
}

.worksheet-content h1,
.worksheet-content h2,
.worksheet-content h3 {
  color: #0F172A;
  margin-top: 1.25em;
  margin-bottom: 0.5em;
}

.worksheet-content ol {
  counter-reset: worksheet-counter;
  list-style: none;
  padding-left: 0;
}

.worksheet-content ol > li {
  counter-increment: worksheet-counter;
  padding-left: 2em;
  position: relative;
  margin-bottom: 1.5em;
}

.worksheet-content ol > li::before {
  content: counter(worksheet-counter) ".";
  position: absolute;
  left: 0;
  font-weight: 700;
  color: #0F172A;
}

/* Answer lines for worksheets */
.answer-space {
  border-bottom: 1px solid #CBD5E1;
  min-height: 2em;
  margin: 0.5em 0;
  display: block;
}

.answer-lines {
  margin-top: 0.5em;
}

.answer-lines .answer-line {
  border-bottom: 1px solid #CBD5E1;
  height: 2.5em;
  width: 100%;
  display: block;
}


/* ----------------------------------------------------------
   Sidebar Dropdown
   ---------------------------------------------------------- */

.dropdown-chevron {
  transition: transform 0.2s ease;
}

.dropdown-menu {
  animation: dropdownFade 0.15s ease-out;
}

@keyframes dropdownFade {
  from {
    opacity: 0;
    transform: translateY(-0.25rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}


/* ----------------------------------------------------------
   Loading Spinner
   ---------------------------------------------------------- */

@keyframes spin {
  to { transform: rotate(360deg); }
}

.animate-spin {
  animation: spin 1s linear infinite;
}


/* ----------------------------------------------------------
   Prose Overrides (for lesson content)
   ---------------------------------------------------------- */

.prose img {
  border-radius: 0.5rem;
  margin: 1.5rem 0;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
}

.prose th,
.prose td {
  border: 1px solid #E2E8F0;
  padding: 0.5rem 0.75rem;
}

.prose th {
  background-color: #F8FAFC;
  font-weight: 600;
  text-align: left;
}

.prose blockquote {
  border-left-color: #064E3B;
}


/* ----------------------------------------------------------
   Print Stylesheet
   ---------------------------------------------------------- */

@media print {
  /* Global print resets */
  body {
    background: white !important;
    color: black !important;
    font-size: 11pt !important;
    line-height: 1.5 !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* Hide non-printable elements */
  .no-print,
  nav,
  .sidebar,
  header,
  .flash-messages,
  #toast-container,
  button.no-print,
  a.no-print {
    display: none !important;
  }

  /* Reset layout */
  main {
    margin-left: 0 !important;
    padding: 0 !important;
    width: 100% !important;
  }

  /* Remove decorative styles */
  .card,
  .report-card {
    box-shadow: none !important;
    border: none !important;
    border-radius: 0 !important;
  }

  /* Worksheet specifics */
  .worksheet-content hr {
    border-top: 1px solid #999;
    margin: 1.5em 0;
  }

  .answer-space,
  .answer-line {
    border-bottom: 1px solid #999 !important;
  }

  /* Page settings */
  @page {
    margin: 1in;
    size: letter;
  }

  /* Avoid breaking inside these elements */
  .card,
  tr,
  .worksheet-content li {
    page-break-inside: avoid;
  }

  /* Links: show URL in print */
  a[href]::after {
    content: none; /* Don't show URLs in print for cleaner output */
  }

  /* Remove animations in print */
  .page-enter {
    animation: none !important;
  }
}


/* ----------------------------------------------------------
   Utility Classes
   ---------------------------------------------------------- */

.text-primary { color: #0F172A; }
.bg-primary { background-color: #0F172A; }
.text-accent { color: #064E3B; }
.bg-accent { background-color: #064E3B; }
.bg-cream { background-color: #F8FAFC; }

/* Smooth transitions */
.transition-all {
  transition-property: all;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 150ms;
}

/* Focus ring for accessibility */
.focus-ring:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(6, 78, 59, 0.3);
}

/* Focus visible outlines for accessibility (keyboard-only focus) */
:focus-visible {
  outline: 2px solid #064E3B;
  outline-offset: 2px;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(6, 78, 59, 0.2);
  border-color: #064E3B;
}

button:focus-visible {
  outline: 2px solid #064E3B;
  outline-offset: 2px;
}

/* Remove default focus outline when using mouse (preserve for keyboard) */
:focus:not(:focus-visible) {
  outline: none;
}


/* ----------------------------------------------------------
   Student Header Gradient
   ---------------------------------------------------------- */

.student-header {
  background: linear-gradient(135deg, #FFFFFF 0%, #F0FDF9 50%, #ECFDF5 100%);
  border-bottom: 1px solid rgba(6, 78, 59, 0.08);
}


/* ----------------------------------------------------------
   Login Page Decorative Pattern
   ---------------------------------------------------------- */

.login-pattern {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.login-pattern::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background-image:
    radial-gradient(circle at 25% 25%, rgba(6, 78, 59, 0.04) 0%, transparent 50%),
    radial-gradient(circle at 75% 75%, rgba(15, 23, 42, 0.04) 0%, transparent 50%),
    radial-gradient(circle at 50% 10%, rgba(6, 78, 59, 0.03) 0%, transparent 40%);
}

.login-pattern::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image:
    linear-gradient(30deg, transparent 49.5%, rgba(6, 78, 59, 0.015) 49.5%, rgba(6, 78, 59, 0.015) 50.5%, transparent 50.5%),
    linear-gradient(150deg, transparent 49.5%, rgba(15, 23, 42, 0.015) 49.5%, rgba(15, 23, 42, 0.015) 50.5%, transparent 50.5%),
    linear-gradient(90deg, transparent 49.5%, rgba(6, 78, 59, 0.01) 49.5%, rgba(6, 78, 59, 0.01) 50.5%, transparent 50.5%);
  background-size: 60px 60px, 60px 60px, 80px 80px;
}


/* ----------------------------------------------------------
   Login Tab Animation
   ---------------------------------------------------------- */

.login-tab {
  position: relative;
  transition: color 0.3s ease;
}

.login-tab::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 80%;
  height: 2px;
  background-color: #064E3B;
  border-radius: 1px;
  transition: transform 0.3s ease;
}

.login-tab.active::after {
  transform: translateX(-50%) scaleX(1);
}


/* ----------------------------------------------------------
   Sidebar Gradient Background
   ---------------------------------------------------------- */

.sidebar-gradient {
  background: linear-gradient(180deg, #0F172A 0%, #122035 40%, #0C1A2E 100%);
}


/* ----------------------------------------------------------
   Floating animation for decorative elements
   ---------------------------------------------------------- */

@keyframes float {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  33% { transform: translateY(-8px) rotate(1deg); }
  66% { transform: translateY(4px) rotate(-1deg); }
}

.animate-float {
  animation: float 6s ease-in-out infinite;
}

@keyframes floatSlow {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-12px); }
}

.animate-float-slow {
  animation: floatSlow 8s ease-in-out infinite;
}


/* ----------------------------------------------------------
   Accessibility: Skip to content
   ---------------------------------------------------------- */

.skip-to-content {
    position: absolute;
    top: -40px;
    left: 0;
    background: #064E3B;
    color: white;
    padding: 8px 16px;
    z-index: 100;
    font-size: 0.875rem;
    font-weight: 600;
    transition: top 0.2s;
}
.skip-to-content:focus {
    top: 0;
}


/* ----------------------------------------------------------
   Mobile Responsive
   ---------------------------------------------------------- */

/* ===== MOBILE BOTTOM NAV (Student) ===== */
.student-bottom-nav {
    display: none;
}

@media (max-width: 767px) {
    /* Student: hide top header, show bottom nav */
    .student-header {
        display: none !important;
    }
    .student-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 50;
        background: white;
        border-top: 1px solid #e5e7eb;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
        justify-content: space-around;
        align-items: center;
        padding: 6px 0 env(safe-area-inset-bottom, 8px);
        height: auto;
    }
    .student-bottom-nav a {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        padding: 8px 12px;
        min-width: 60px;
        min-height: 48px;
        color: #9ca3af;
        text-decoration: none;
        font-size: 10px;
        font-weight: 600;
        transition: color 0.2s;
        position: relative;
    }
    .student-bottom-nav a.active {
        color: #064E3B;
    }
    .student-bottom-nav a svg {
        width: 22px;
        height: 22px;
    }
    .student-bottom-nav .unread-dot {
        position: absolute;
        top: 4px;
        right: 8px;
        width: 8px;
        height: 8px;
        background: #ef4444;
        border-radius: 50%;
    }

    /* Adjust main content padding for bottom nav */
    body.student-view main {
        padding-bottom: 80px !important;
        padding-top: 0 !important;
    }

    /* Student mobile header (simplified top bar) */
    .student-mobile-header {
        display: flex;
        position: sticky;
        top: 0;
        z-index: 30;
        background: white;
        border-bottom: 1px solid #f3f4f6;
        padding: 12px 16px;
        align-items: center;
        justify-content: space-between;
    }
    .student-mobile-header .greeting {
        font-size: 16px;
        font-weight: 700;
        color: #0F172A;
    }
    .student-mobile-header .subtitle {
        font-size: 11px;
        color: #9ca3af;
        font-weight: 500;
    }
}

@media (min-width: 768px) {
    .student-mobile-header {
        display: none !important;
    }
    .student-bottom-nav {
        display: none !important;
    }
}

/* ===== PARENT SIDEBAR MOBILE IMPROVEMENTS ===== */
@media (max-width: 767px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        width: 280px;
        z-index: 50;
    }
    .sidebar.sidebar-open {
        transform: translateX(0);
    }
    .sidebar-overlay {
        position: fixed;
        inset: 0;
        z-index: 35;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(4px);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }
    .sidebar-overlay.active {
        opacity: 1;
        pointer-events: auto;
    }

    /* Larger touch targets for sidebar nav */
    .sidebar .nav-item {
        padding: 14px 12px;
        gap: 12px;
        font-size: 15px;
    }
    .sidebar .nav-item svg {
        width: 22px;
        height: 22px;
    }

    /* Parent main content: remove margin on mobile */
    main.ml-64 {
        margin-left: 0 !important;
    }

    /* Hamburger button */
    #sidebar-toggle {
        width: 44px;
        height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0;
    }

    /* Close button inside sidebar */
    .sidebar-close-btn {
        display: flex;
        position: absolute;
        top: 12px;
        right: 12px;
        width: 36px;
        height: 36px;
        align-items: center;
        justify-content: center;
        border-radius: 8px;
        background: rgba(255,255,255,0.1);
        color: white;
        z-index: 10;
        border: none;
        cursor: pointer;
    }
    .sidebar-close-btn:hover {
        background: rgba(255,255,255,0.2);
    }
}

@media (min-width: 768px) {
    .sidebar-close-btn {
        display: none;
    }
}

/* ===== GLOBAL MOBILE TYPOGRAPHY ===== */
@media (max-width: 767px) {
    /* Ensure body text is readable */
    body {
        font-size: 16px;
        -webkit-text-size-adjust: 100%;
    }

    /* Page containers: tighter padding on mobile */
    .max-w-3xl,
    .max-w-4xl,
    .max-w-5xl,
    .max-w-6xl,
    .max-w-7xl {
        padding-left: 16px !important;
        padding-right: 16px !important;
    }

    /* Cards need full width on mobile */
    .card, .bg-white.rounded-2xl {
        border-radius: 12px;
    }

    /* Tables must scroll horizontally */
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    thead, tbody, tr {
        display: table;
        width: 100%;
        table-layout: auto;
    }

    /* Make all form inputs mobile-friendly */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="date"],
    input[type="search"],
    select,
    textarea {
        font-size: 16px !important; /* Prevents iOS zoom on focus */
        min-height: 48px;
        padding: 12px !important;
    }

    /* Larger question dots */
    .question-dot {
        width: 40px;
        height: 40px;
        font-size: 14px;
    }

    /* Toast container at bottom on mobile */
    #toast-container {
        top: auto;
        bottom: 88px;
        left: 16px;
        right: 16px;
    }
}

/* ===== TABLET (768px - 1024px) ===== */
@media (min-width: 768px) and (max-width: 1024px) {
    .sidebar {
        width: 240px;
    }
    main.ml-64 {
        margin-left: 240px;
    }
}

/* ===== SAFE AREA for notched phones ===== */
@supports (padding: env(safe-area-inset-bottom)) {
    .student-bottom-nav {
        padding-bottom: env(safe-area-inset-bottom);
    }
}


/* ----------------------------------------------------------
   Achievement Card Styles
   ---------------------------------------------------------- */

.achievement-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.achievement-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.achievement-earned {
  border: 2px solid #f59e0b;
  animation: achievement-glow 2s ease-in-out infinite alternate;
}

@keyframes achievement-glow {
  from { box-shadow: 0 0 5px rgba(245, 158, 11, 0.2); }
  to { box-shadow: 0 0 20px rgba(245, 158, 11, 0.4); }
}

.achievement-locked {
  opacity: 0.5;
  filter: grayscale(100%);
}

.achievement-locked:hover {
  opacity: 0.65;
  filter: grayscale(80%);
}


/* ----------------------------------------------------------
   Analytics / Stat Card Styles
   ---------------------------------------------------------- */

.stat-card {
  transition: transform 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
}

/* Score color coding for analytics tables */
.score-excellent { color: #10b981; }
.score-good { color: #f59e0b; }
.score-poor { color: #ef4444; }


/* ----------------------------------------------------------
   Attendance Calendar Styles
   ---------------------------------------------------------- */

.attendance-calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.attendance-day {
  min-height: 80px;
  padding: 4px 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.attendance-day:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.attendance-day.today {
  border: 2px solid #10b981;
}

.status-present { background-color: rgba(16, 185, 129, 0.2); }
.status-absent { background-color: rgba(239, 68, 68, 0.2); }
.status-half_day { background-color: rgba(245, 158, 11, 0.2); }
.status-field_trip { background-color: rgba(59, 130, 246, 0.2); }
.status-sick { background-color: rgba(249, 115, 22, 0.2); }


/* ----------------------------------------------------------
   Curriculum Plan Styles
   ---------------------------------------------------------- */

.plan-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

@media (max-width: 768px) {
  .plan-grid {
    grid-template-columns: 1fr;
  }
}

.plan-item {
  border-radius: 8px;
  padding: 8px 12px;
  transition: transform 0.15s ease;
}

.plan-item:hover {
  transform: scale(1.02);
}

/* Subject color coding (left border) */
.subject-math { border-left: 4px solid #3b82f6; }
.subject-langarts { border-left: 4px solid #8b5cf6; }
.subject-science { border-left: 4px solid #10b981; }
.subject-history { border-left: 4px solid #f59e0b; }


/* ----------------------------------------------------------
   Quiz Results Styles
   ---------------------------------------------------------- */

.quiz-result-correct {
  border: 2px solid #10b981;
  background-color: rgba(16, 185, 129, 0.1);
}

.quiz-result-incorrect {
  border: 2px solid #ef4444;
  background-color: rgba(239, 68, 68, 0.1);
}

.score-ring {
  transition: stroke-dashoffset 1s ease-out;
}


/* ----------------------------------------------------------
   Report Card Print Styles
   ---------------------------------------------------------- */

@media print {
  .report-card {
    background: white !important;
    color: black !important;
  }

  .report-card table {
    border-collapse: collapse;
    width: 100%;
  }

  .report-card th,
  .report-card td {
    border: 1px solid #333;
    padding: 8px;
  }

  .report-card .no-print {
    display: none !important;
  }
}


/* ----------------------------------------------------------
   Modal Backdrop
   ---------------------------------------------------------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 50;
}


/* ----------------------------------------------------------
   Number Count-Up Animation
   ---------------------------------------------------------- */

@keyframes count-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-count-up {
  animation: count-up 0.5s ease-out forwards;
}


/* ----------------------------------------------------------
   Prerequisite Tree
   ---------------------------------------------------------- */

.prereq-tree-item {
  position: relative;
  padding-left: 24px;
}

.prereq-tree-item::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  width: 2px;
  background-color: #374151;
}

.prereq-completed { color: #10b981; }
.prereq-ready { color: #f59e0b; }
.prereq-locked { color: #6b7280; }


/* ----------------------------------------------------------
   Achievement Toast Animation
   ---------------------------------------------------------- */

@keyframes achievementPulse {
  0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); }
  70% { box-shadow: 0 0 0 10px rgba(245, 158, 11, 0); }
  100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

.achievement-toast-pulse {
  animation: achievementPulse 1.5s ease-out;
}


/* ----------------------------------------------------------
   Locked Achievement Tooltip
   ---------------------------------------------------------- */

.locked-tooltip {
  animation: fadeInUp 0.2s ease-out both;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
