/* ==========================================================================
   SPM Form 4 Mathematics KSSM Interactive Portal & Worksheet Styles
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
  --primary: #1e3a8a;
  --primary-light: #3b82f6;
  --primary-dark: #0f172a;
  --accent-amber: #f59e0b;
  --accent-emerald: #10b981;
  --accent-rose: #f43f5e;
  --accent-indigo: #6366f1;
  --accent-cyan: #06b6d4;
  --bg-slate: #f8fafc;
  --card-border: #e2e8f0;
}

* {
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-slate);
  color: #0f172a;
  -webkit-font-smoothing: antialiased;
}

.mono {
  font-family: 'JetBrains Mono', monospace;
}

/* Glassmorphism & Cards */
.glass-panel {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(226, 232, 240, 0.8);
}

.dark-glass {
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

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

.card-hover:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px -6px rgba(15, 23, 42, 0.12), 0 4px 10px -2px rgba(15, 23, 42, 0.06);
}

/* SPM Marking Scheme Badges */
.mark-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.025em;
}

.k-mark {
  background-color: #dbeafe;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.n-mark {
  background-color: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.p-mark {
  background-color: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}

/* Interactive Solution Box */
.solution-box {
  display: none;
  animation: slideDown 0.3s ease-out forwards;
}

.solution-box.open {
  display: block;
}

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

/* Print Dotted Lines for Student Working */
.print-working {
  display: none;
}

.print-line {
  border-bottom: 1.5px dotted #94a3b8;
  height: 28px;
  width: 100%;
}

/* Animations */
@keyframes pulseGlow {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

.animate-glow {
  animation: pulseGlow 3s infinite;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* KaTeX tweaks */
.katex-display {
  margin: 0.75em 0 !important;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.25rem 0;
}

/* PRINT MEDIA STYLESHEET */
@media print {
  @page {
    size: A4;
    margin: 1.5cm 1.2cm;
  }

  body {
    background: white !important;
    color: black !important;
    padding: 0 !important;
    margin: 0 !important;
    font-size: 11pt;
  }

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

  .print-only {
    display: block !important;
  }

  .print-working {
    display: block !important;
  }

  .worksheet-container {
    max-width: 100% !important;
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .solution-box {
    display: none !important;
  }

  /* Show solutions in print when explicitly toggled on */
  .solution-box.print-show {
    display: block !important;
    border: 1px dashed #475569 !important;
    background: #f8fafc !important;
    break-inside: avoid;
  }

  .page-break {
    page-break-before: always;
    break-before: page;
  }

  .avoid-break {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  header, .question-card {
    break-inside: avoid;
  }
}
