/* ========================================
   Goodwill Learning Centre - Main Styles
   ======================================== */

/* --- CSS Variables (Design System) --- */
:root {
  --primary: #2563EB;
  --primary-light: #3B82F6;
  --primary-dark: #1D4ED8;
  --primary-foreground: #FFFFFF;

  --success: #22C55E;
  --warning: #F59E0B;
  --danger: #EF4444;
  --danger-foreground: #FFFFFF;

  --background: #F8FAFC;
  --foreground: #1E293B;

  --card: #FFFFFF;
  --card-foreground: #1E293B;

  --muted: #F1F5F9;
  --muted-foreground: #64748B;

  --secondary: #F1F5F9;
  --secondary-foreground: #1E293B;

  --accent: #EF4444;
  --accent-foreground: #FFFFFF;

  --border: #E2E8F0;
  --input: #E2E8F0;
  --ring: #2563EB;

  --sidebar: #1E293B;
  --sidebar-foreground: #F1F5F9;
  --sidebar-primary: #60A5FA;
  --sidebar-accent: #334155;
  --sidebar-accent-foreground: #FFFFFF;
  --sidebar-border: #334155;

  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 12px;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  overflow-x: clip;
}

body {
  font-family: var(--font-sans);
  background-color: var(--background);
  color: var(--foreground);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: clip;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  height: auto;
}

ul, ol {
  list-style: none;
}

button {
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  color: var(--foreground);
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1rem; }

.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }

.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-extrabold { font-size: 2.25rem; font-weight: 800; }

.text-muted-foreground { color: var(--muted-foreground); }
.text-primary { color: var(--primary); }
.text-destructive { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.whitespace-pre-line {
  white-space: pre-line;
}

.uppercase { text-transform: uppercase; }
.tracking-wider { letter-spacing: 0.05em; }
.tracking-widest { letter-spacing: 0.1em; }
.leading-relaxed { line-height: 1.625; }

/* --- Layout --- */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.container-sm {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 1rem;
}

.container-md {
  max-width: 768px;
  margin: 0 auto;
  padding: 0 1rem;
}

.max-w-full { max-width: 100%; }
.max-w-prose { max-width: 65ch; }
.min-h-screen { min-height: 100vh; }

/* Flex */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-5 { gap: 1.25rem; }
.gap-6 { gap: 1.5rem; }
.gap-8 { gap: 2rem; }
.gap-10 { gap: 2.5rem; }

/* Grid */
.grid { display: grid; }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }

/* Spacing */
.p-0 { padding: 0; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-5 { padding: 1.25rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }
.p-10 { padding: 2.5rem; }

.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-6 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.py-10 { padding-top: 2.5rem; padding-bottom: 2.5rem; }
.py-12 { padding-top: 3rem; padding-bottom: 3rem; }
.py-14 { padding-top: 3.5rem; padding-bottom: 3.5rem; }
.py-16 { padding-top: 4rem; padding-bottom: 4rem; }

.pt-2 { padding-top: 0.5rem; }
.pt-4 { padding-top: 1rem; }
.pb-4 { padding-bottom: 1rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-5 { margin-top: 1.25rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }
.mt-10 { margin-top: 2.5rem; }
.mt-12 { margin-top: 3rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mr-1 { margin-right: 0.25rem; }
.mr-2 { margin-right: 0.5rem; }
.ml-2 { margin-left: 0.5rem; }
.mx-auto { margin-left: auto; margin-right: auto; }

/* --- Backgrounds --- */
.bg-background { background-color: var(--background); }
.bg-card { background-color: var(--card); }
.bg-primary { background-color: var(--primary); }
.bg-secondary { background-color: var(--secondary); }
.bg-muted { background-color: var(--muted); }
.bg-accent { background-color: var(--accent); }
.bg-destructive { background-color: var(--danger); }
.bg-primary\/10 { background-color: rgba(37, 99, 235, 0.1); }
.bg-accent\/10 { background-color: rgba(239, 68, 68, 0.1); }
.bg-accent\/15 { background-color: rgba(239, 68, 68, 0.15); }
.bg-accent\/20 { background-color: rgba(239, 68, 68, 0.2); }
.bg-background\/80 { background-color: rgba(248, 250, 252, 0.8); }
.bg-background\/95 { background-color: rgba(248, 250, 252, 0.95); }
.bg-gradient-to-b { background-image: linear-gradient(to bottom, var(--gradient-from), var(--gradient-to)); }
.bg-gradient-to-br { background-image: linear-gradient(to bottom right, var(--gradient-from), var(--gradient-to)); }
.from-secondary\/60 { --gradient-from: rgba(241, 245, 249, 0.6); }
.from-primary { --gradient-from: var(--primary); }
.from-primary\/90 { --gradient-from: rgba(37, 99, 235, 0.9); }
.to-background { --gradient-to: var(--background); }
.to-accent { --gradient-to: var(--accent); }
.to-accent\/80 { --gradient-to: rgba(239, 68, 68, 0.8); }
.bg-black { background-color: #000000; }

/* --- Borders --- */
.border { border: 1px solid var(--border); }
.border-b { border-bottom: 1px solid var(--border); }
.border-t { border-top: 1px solid var(--border); }
.border-r { border-right: 1px solid var(--border); }
.border-border { border-color: var(--border); }
.border-primary\/30 { border-color: rgba(37, 99, 235, 0.3); }
.border-input { border-color: var(--input); }
.border-border\/60 { border-color: rgba(226, 232, 240, 0.6); }

/* --- Border Radius --- */
.rounded { border-radius: var(--radius-sm); }
.rounded-md { border-radius: var(--radius); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: 12px; }
.rounded-2xl { border-radius: 16px; }
.rounded-full { border-radius: 9999px; }
.rounded-sm { border-radius: 4px; }

/* --- Cards --- */
.card {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-hover {
  cursor: pointer;
}

.card-hover:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

.card-content {
  padding: 1.5rem;
}

.card-content.p-0 {
  padding: 0;
}

.card-content.p-4 {
  padding: 1rem;
}

.card-content.p-5 {
  padding: 1.25rem;
}

.card-content.p-6 {
  padding: 1.5rem;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: all 0.15s ease;
  white-space: nowrap;
  cursor: pointer;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background-color: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--primary-dark);
}

.btn-secondary {
  background-color: var(--secondary);
  color: var(--secondary-foreground);
  border-color: transparent;
}

.btn-secondary:hover:not(:disabled) {
  background-color: var(--muted);
}

.btn-outline {
  background-color: transparent;
  color: var(--foreground);
  border-color: var(--border);
}

.btn-outline:hover:not(:disabled) {
  background-color: var(--secondary);
  border-color: var(--primary);
}

.btn-ghost {
  background-color: transparent;
  color: var(--foreground);
  border-color: transparent;
}

.btn-ghost:hover:not(:disabled) {
  background-color: var(--secondary);
}

.btn-destructive {
  background-color: var(--danger);
  color: var(--danger-foreground);
  border-color: var(--danger);
}

.btn-destructive:hover:not(:disabled) {
  background-color: #DC2626;
}

.btn-sm {
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
}

.btn-lg {
  padding: 0.875rem 2rem;
  font-size: 1.0625rem;
}

.btn-block {
  width: 100%;
}

.btn-icon {
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
}

/* --- Forms --- */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--foreground);
  margin-bottom: 0.375rem;
}

.form-input,
.form-select,
.form-textarea {
  display: block;
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--foreground);
  background-color: var(--card);
  border: 1px solid var(--input);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--muted-foreground);
}

.form-input:disabled {
  background-color: var(--muted);
  cursor: not-allowed;
}

.form-textarea {
  min-height: 80px;
  resize: vertical;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.5rem;
}

.form-error {
  font-size: 0.75rem;
  color: var(--danger);
  margin-top: 0.25rem;
}

/* --- Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 9999px;
  background-color: var(--secondary);
  color: var(--secondary-foreground);
}

.badge-primary {
  background-color: var(--primary);
  color: var(--primary-foreground);
}

.badge-success {
  background-color: var(--success);
  color: white;
}

.badge-warning {
  background-color: var(--warning);
  color: white;
}

.badge-destructive {
  background-color: var(--danger);
  color: white;
}

.badge-outline {
  background-color: transparent;
  border: 1px solid var(--border);
  color: var(--muted-foreground);
}

/* --- Tabs --- */
.tabs {
  width: 100%;
}

.tabs-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.25rem;
  background-color: var(--muted);
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.5rem;
}

.tabs-trigger {
  padding: 0.5rem 1rem;
  text-align: center;
  font-size: 0.875rem;
  font-weight: 500;
  background: transparent;
  border: none;
  border-radius: calc(var(--radius-sm) - 2px);
  color: var(--muted-foreground);
  cursor: pointer;
  transition: all 0.15s ease;
}

.tabs-trigger.active {
  background-color: var(--card);
  color: var(--foreground);
  box-shadow: var(--shadow-sm);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* --- Switches --- */
.switch {
  position: relative;
  display: inline-block;
  width: 2.25rem;
  height: 1.25rem;
  cursor: pointer;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-track {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--muted);
  border-radius: 9999px;
  transition: background-color 0.2s ease;
}

.switch-track::after {
  content: '';
  position: absolute;
  top: 0.125rem;
  left: 0.125rem;
  width: 1rem;
  height: 1rem;
  background-color: white;
  border-radius: 50%;
  transition: transform 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.switch input:checked + .switch-track {
  background-color: var(--primary);
}

.switch input:checked + .switch-track::after {
  transform: translateX(1rem);
}

/* --- Progress Bar --- */
.progress {
  width: 100%;
  height: 0.5rem;
  background-color: var(--muted);
  border-radius: 9999px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background-color: var(--primary);
  border-radius: 9999px;
  transition: width 0.3s ease;
}

/* --- Fieldset --- */
.fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.fieldset-legend {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--primary);
  padding: 0 0.5rem;
  display: inline-block;
}

/* --- Loading --- */
.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem;
}

.spinner {
  width: 2.5rem;
  height: 2.5rem;
  border: 3px solid var(--muted);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* --- Empty State --- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  text-align: center;
}

.empty-icon {
  width: 3rem;
  height: 3rem;
  color: var(--muted-foreground);
  margin-bottom: 1rem;
  opacity: 0.5;
}

/* --- Error State --- */
.error-state {
  padding: 2rem;
  text-align: center;
}

/* --- Separator --- */
.separator {
  width: 100%;
  height: 1px;
  background-color: var(--border);
  margin: 1rem 0;
}

/* --- Tooltip --- */
.tooltip {
  position: relative;
}

.tooltip-text {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  background-color: var(--foreground);
  color: var(--background);
  border-radius: var(--radius-sm);
  white-space: nowrap;
  transition: opacity 0.15s ease;
  z-index: 50;
}

.tooltip:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}

/* --- Alert --- */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.alert-info {
  background-color: rgba(37, 99, 235, 0.1);
  color: var(--primary);
  border: 1px solid rgba(37, 99, 235, 0.2);
}

.alert-success {
  background-color: rgba(34, 197, 94, 0.1);
  color: var(--success);
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.alert-warning {
  background-color: rgba(245, 158, 11, 0.1);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.alert-destructive {
  background-color: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* --- Misc --- */
.aspect-video {
  aspect-ratio: 16 / 9;
}

.aspect-square {
  aspect-ratio: 1 / 1;
}

.object-contain {
  object-fit: contain;
}

.overflow-hidden {
  overflow: hidden;
}

.shrink-0 {
  flex-shrink: 0;
}

.min-w-0 {
  min-width: 0;
}

.line-clamp-2 {
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.sticky {
  position: sticky;
}

.top-0 {
  top: 0;
}

.z-40 {
  z-index: 40;
}

.z-50 {
  z-index: 50;
}

.relative {
  position: relative;
}

.absolute {
  position: absolute;
}

.block {
  display: block;
}

.inline-block {
  display: inline-block;
}

.inline-flex {
  display: inline-flex;
}

.hidden {
  display: none;
}

/* --- Modal --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.15s ease;
}

.modal-content {
  background-color: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 500px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  animation: slideUp 0.2s ease;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 1.125rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--muted-foreground);
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.modal-close:hover {
  color: var(--foreground);
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { transform: translateY(10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Lock body scroll and strip parent transforms when modal is open */
body.modal-open {
  overflow: hidden !important;
}
body.modal-open .dashboard-main,
body.modal-open .dashboard-main *,
body.modal-open main,
body.modal-open main * {
  transform: none !important;
  animation: none !important;
  perspective: none !important;
  filter: none !important;
}

.form-as-modal {
  position: fixed !important;
  inset: 0 !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 9999 !important;
  display: flex !important;
  align-items: flex-start !important;
  justify-content: center !important;
  overflow-y: auto !important;
  padding: 24px !important;
  box-sizing: border-box !important;
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  transform: none !important;
  animation: none !important;
  margin: 0 !important;
}

.form-as-modal .card-content,
.form-as-modal.sm-form,
.form-as-modal > div:not(.form-as-modal-backdrop) {
  width: min(720px, 95vw) !important;
  margin: auto !important;
  display: flex !important;
  flex-direction: column !important;
  max-height: 85vh !important;
  background: #ffffff !important;
  border-radius: var(--radius-lg, 12px) !important;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.3) !important;
  border: 1px solid var(--border, #e2e8f0) !important;
  padding: 1.5rem !important;
  position: relative !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
}

.form-as-modal .card-content form,
.form-as-modal.sm-form form,
.form-as-modal > div:not(.form-as-modal-backdrop) form {
  display: flex !important;
  flex-direction: column !important;
  overflow-y: auto !important;
  flex: 1 !important;
  max-height: calc(85vh - 4rem) !important;
  padding-right: 4px;
}

.form-as-modal .card-content .font-semibold,
.form-as-modal .sm-form-header {
  flex-shrink: 0 !important;
  font-size: 1.125rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border, #e2e8f0);
  margin-bottom: 1rem;
}

.form-as-modal form > .flex.gap-2,
.form-as-modal .card-content form > .flex.gap-2 {
  flex-shrink: 0 !important;
  margin-top: 1.25rem !important;
  padding-top: 0.75rem !important;
}

/* Modal backdrop overlay for form-as-modal */
.form-as-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

/* --- Public Header (Redesigned) --- */
.public-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background-color: rgba(255, 255, 255, 0.88);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.7);
  transition: box-shadow 0.3s ease;
}

.public-header.scrolled {
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.public-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 5rem;
  padding: 0 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
}

.public-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--foreground);
  transition: opacity 0.2s ease;
}

.public-logo:hover {
  opacity: 0.8;
}

.public-logo img { width: auto; height: 90px; max-width: 220px; border-radius: 0; box-shadow: none; object-fit: contain; }

.public-nav {
  display: none;
}

@media (min-width: 768px) {
  .public-nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.875rem;
  }
}

.public-nav a {
  position: relative;
  padding: 0.625rem 1rem;
  color: var(--muted-foreground);
  border-radius: var(--radius-sm);
  transition: color 0.2s ease, background-color 0.2s ease;
  font-weight: 500;
  font-size: 0.9375rem;
}

.public-nav a::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: calc(100% - 1.75rem);
  height: 2px;
  background-color: var(--primary);
  border-radius: 1px;
  transition: transform 0.25s ease;
}

.public-nav a:hover {
  color: var(--foreground);
  background-color: rgba(37, 99, 235, 0.06);
}

.public-nav a:hover::after {
  transform: translateX(-50%) scaleX(1);
}

.public-nav a.active {
  color: var(--primary);
  background-color: transparent;
  font-weight: 600;
}

.public-nav a.active::after {
  transform: translateX(-50%) scaleX(1);
  background-color: var(--primary);
}

.public-header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* --- Hamburger Menu Button --- */
.hamburger-btn {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 2.5rem;
  height: 2.5rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  transition: background-color 0.2s ease;
  margin-left: 0.5rem;
}

.hamburger-btn:hover {
  background-color: var(--secondary);
}

.hamburger-btn span {
  display: block;
  width: 1.25rem;
  height: 2px;
  background-color: var(--foreground);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.2s ease;
}

.hamburger-btn span + span {
  margin-top: 4px;
}

.hamburger-btn.active span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.hamburger-btn.active span:nth-child(2) {
  opacity: 0;
}

.hamburger-btn.active span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

@media (min-width: 768px) {
  .hamburger-btn {
    display: none;
  }
}

/* --- Mobile Menu --- */
.mobile-menu-overlay {
  display: none;
  position: fixed;
  top: 4rem;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.25);
  z-index: 45;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.mobile-menu-overlay.open {
  display: block;
  opacity: 1;
}

.mobile-menu {
  display: none;
  position: fixed;
  top: 4rem;
  left: 0;
  right: 0;
  background-color: var(--card);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  z-index: 45;
  padding: 1rem;
  transform: translateY(-12px);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease;
}

.mobile-menu.open {
  display: block;
  transform: translateY(0);
  opacity: 1;
}

@media (min-width: 768px) {
  .mobile-menu,
  .mobile-menu-overlay {
    display: none !important;
  }
}

.mobile-menu-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.mobile-menu-nav a {
  display: block;
  padding: 0.75rem 1rem;
  color: var(--foreground);
  font-weight: 500;
  font-size: 0.9375rem;
  border-radius: var(--radius-sm);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.mobile-menu-nav a:hover {
  background-color: var(--secondary);
}

.mobile-menu-nav a.active {
  color: var(--primary);
  background-color: rgba(37, 99, 235, 0.08);
  font-weight: 600;
}

.mobile-menu-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.mobile-menu-actions .btn {
  width: 100%;
  justify-content: center;
  padding: 0.75rem;
  font-size: 0.9375rem;
}

/* --- Public Footer --- */
.public-footer {
  border-top: 1px solid var(--border);
  background-color: rgba(241, 245, 249, 0.4);
}

.public-footer-grid {
  display: grid;
  gap: 2rem;
  padding: 3rem 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
  font-size: 0.875rem;
}

@media (min-width: 768px) {
  .public-footer-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.footer-heading {
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--foreground);
}

.footer-text {
  color: var(--muted-foreground);
  font-size: 0.75rem;
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.footer-links a {
  color: var(--muted-foreground);
  transition: color 0.15s ease;
}

.footer-links a:hover {
  color: var(--foreground);
}

.footer-social {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.footer-social a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background-color: var(--card);
  border: 1px solid var(--border);
  color: var(--muted-foreground);
  transition: color 0.15s ease;
}

.footer-social a:hover {
  background-color: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.footer-bottom {
  border-top: 1px solid var(--border);
  padding: 1rem 1.5rem;
  font-size: 0.75rem;
  color: var(--muted-foreground);
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
}

/* --- Dark Hero Theme (from contact page) --- */
.dark-hero {
  position: relative;
  background-size: cover !important;
  background-position: center !important;
  background-blend-mode: overlay;
  background-color: rgba(17, 24, 39, 0.85) !important;
  background: linear-gradient(135deg, #1E2D4A 0%, #243756 50%, #1E2D4A 100%);
  min-height: 90vh;
  display: flex;
  align-items: center;
}

.dark-hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.15) 0%, transparent 70%);
  pointer-events: none;
}

.dark-hero::after {
  content: '';
  position: absolute;
  bottom: -30%;
  left: -10%;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(239, 68, 68, 0.1) 0%, transparent 70%);
  pointer-events: none;
}

.dark-hero-content {
  position: relative;
  z-index: 1;
  text-align: left;
}

.dark-hero h1 {
  color: #fff;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.dark-hero p {
  color: rgba(255, 255, 255, 0.7);
}

.dark-hero .hero-badge,
.dark-hero .section-badge {
  background-color: rgba(37, 99, 235, 0.2) !important;
  border: 1px solid rgba(37, 99, 235, 0.3) !important;
  color: #60A5FA !important;
  display: inline-flex;
}

.dark-hero .breadcrumb-page {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 1.5rem;
}

.dark-hero .breadcrumb-page a {
  color: rgba(255, 255, 255, 0.6);
  transition: color 0.2s ease;
}

.dark-hero .breadcrumb-page a:hover {
  color: #fff;
}

.dark-hero .breadcrumb-page span {
  color: rgba(255, 255, 255, 0.9);
}

/* --- Hero Filter Dropdown --- */
.hero-filter-wrapper {
  position: relative;
  min-width: 190px;
}

.hero-filter-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  padding: 0.625rem 1rem 0.625rem 1.125rem;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.5;
  color: #fff;
  background-color: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  cursor: pointer;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  -webkit-user-select: none;
  user-select: none;
  white-space: nowrap;
}

.hero-filter-btn:hover {
  border-color: rgba(255, 255, 255, 0.25);
  background-color: rgba(15, 23, 42, 0.8);
}

.hero-filter-btn:focus-visible {
  border-color: rgba(96, 165, 250, 0.5);
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.15);
  outline: none;
}

.hero-filter-btn.open {
  border-color: rgba(96, 165, 250, 0.5);
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.15);
  background-color: rgba(15, 23, 42, 0.9);
}

.hero-filter-chevron {
  flex-shrink: 0;
  color: #94A3B8;
  transition: transform 0.25s ease;
}

.hero-filter-btn.open .hero-filter-chevron {
  transform: rotate(180deg);
}

.hero-filter-options {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 100;
  background-color: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 4px;
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

.hero-filter-options.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.hero-filter-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.7);
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
  -webkit-user-select: none;
  user-select: none;
}

.hero-filter-option::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: transparent;
  transition: background-color 0.2s ease;
  flex-shrink: 0;
}

.hero-filter-option:hover {
  background-color: rgba(96, 165, 250, 0.12);
  color: #fff;
}

.hero-filter-option.selected {
  color: #fff;
  background-color: rgba(96, 165, 250, 0.15);
}

.hero-filter-option.selected::before {
  background-color: #60A5FA;
}

/* --- Public Page Styles --- */
.hero-section {
  background-image: linear-gradient(to bottom, rgba(241, 245, 249, 0.6), var(--background));
  overflow: hidden;
}

.hero-grid {
  display: grid;
  gap: 2.5rem;
  padding: 0;
}

@media (min-width: 768px) {
  .hero-grid {
    grid-template-columns: 1.4fr 1fr;
  }
  .hero-cards {
    margin-left: 1.5rem;
  }
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid rgba(37, 99, 235, 0.3);
  background-color: var(--card);
  color: var(--primary);
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1.5rem;
}

.hero-title {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.05;
}

@media (min-width: 768px) {
  .hero-title {
    font-size: 4rem;
  }
}

@media (min-width: 992px) {
  .hero-title {
    font-size: 4.5rem;
  }
}

@media (min-width: 1200px) {
  .hero-title {
    font-size: 5rem;
  }
}

.hero-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.hero-card {
  border-radius: 24px;
  padding: 1.75rem;
  box-shadow: var(--shadow-lg);
}

.hero-card-lg {
  grid-column: span 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* --- Section Styles --- */
.section-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.75rem;
  margin-bottom: 0.75rem;
}

.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

/* --- Course Card --- */
.course-card-cover {
  aspect-ratio: 1 / 1;
  background-image: linear-gradient(to bottom right, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.course-card-cover-content {
  color: var(--primary-foreground);
  text-align: center;
}

.course-card-grade {
  position: absolute;
  bottom: 0.75rem;
  left: 0.75rem;
  background-color: rgba(248, 250, 252, 0.95);
  color: var(--foreground);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
}

/* --- Page Header --- */
.page-header {
  background-color: rgba(241, 245, 249, 0.4);
  border-bottom: 1px solid var(--border);
}

.page-header-inner {
  padding: 2.5rem 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
}

/* --- Stats Grid --- */
.stats-grid {
  display: grid;
  gap: 1rem;
  margin-top: 1.5rem;
}

@media (min-width: 768px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .stats-grid.cols-3 {
    grid-template-columns: repeat(3, 1fr);
  }
  .stats-grid.cols-4 {
    grid-template-columns: repeat(4, 1fr);
  }
  .stats-grid.cols-6 {
    grid-template-columns: repeat(6, 1fr);
  }
}

/* --- Dashboard Layout --- */
.dashboard-body {
  display: flex;
  min-height: 100vh;
  /* overflow:hidden intentionally removed here - it's set in modern-lms.css and institutional-dashboard.css */
}

.dashboard-main {
  flex: 1;
  min-width: 0;
  padding: 1.5rem;
}

@media (min-width: 768px) {
  .dashboard-main {
    margin-left: 16rem;
    padding: 2.5rem;
  }
}

/* --- Quick Actions Grid --- */
.quick-actions-grid {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

@media (min-width: 768px) {
  .quick-actions-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1024px) {
  .quick-actions-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* --- Content Grid --- */
.content-grid {
  display: grid;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

@media (min-width: 1024px) {
  .content-grid.sidebar-layout {
    grid-template-columns: 1fr 380px;
  }
  .content-grid.wide-sidebar {
    grid-template-columns: 1fr 360px;
  }
  .content-grid.medium-sidebar {
    grid-template-columns: 1fr 320px;
  }
  .content-grid.three-col {
    grid-template-columns: repeat(3, 1fr);
  }
  .content-grid.two-col {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* --- Floating WhatsApp Button --- */
.whatsapp-float {
  position: fixed;
  bottom: 5rem;
  right: 1.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.9rem 1.5rem;
  background-color: #25D366;
  color: #fff;
  border-radius: 50px;
  font-weight: 700;
  font-size: 1rem;
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.4);
  z-index: 999;
  transition: all 0.2s ease;
  text-decoration: none;
  cursor: pointer;
}
.whatsapp-float:hover {
  background-color: #20bd5a;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.5);
  color: #fff;
}
.whatsapp-float i {
  font-size: 1.4rem;
}

/* Course Detail Modal */
.course-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.course-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
}
.course-modal-card {
  position: relative;
  background: var(--background);
  border-radius: var(--radius);
  max-width: 720px;
  width: 100%;
  max-height: 100vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px rgba(0,0,0,0.25);
}
.course-modal-card::-webkit-scrollbar {
  width: 6px;
}
.course-modal-card::-webkit-scrollbar-thumb {
  background: var(--muted-foreground);
  border-radius: 3px;
}
.course-modal-close {
  position: sticky;
  top: 0.75rem;
  float: right;
  z-index: 1;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: var(--background);
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.25rem;
  color: var(--foreground);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  margin-right: 0.75rem;
}
