/* ===================================================
   styles.css — Static School Portal theme
   Converted from the original Next.js dashboard into
   the modular frontend shape used by new-main (2).zip
   =================================================== */

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

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  transition: background-color 0.25s ease, color 0.25s ease;
}

:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f7f8fa;
  --bg-tertiary: #f3f4f6;
  --bg-elevated: #ffffff;
  --text-primary: #111827;
  --text-secondary: #6b7280;
  --text-tertiary: #9ca3af;
  --border-color: #e5e7eb;
  --border-light: #f3f4f6;
  --hover-bg: #f3f4f6;
  --input-bg: #ffffff;
  --input-border: #d1d5db;
  --input-focus: #38bdf8;
  --card-bg: #ffffff;
  --header-bg: #ffffff;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 18px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 20px 42px rgba(15, 23, 42, 0.16);
  --school-sky: #c3ebfa;
  --school-sky-light: #edf9fd;
  --school-purple: #cfceff;
  --school-purple-light: #f1f0ff;
  --school-yellow: #fae27c;
  --school-yellow-light: #fefce8;
}

[data-theme="dark"] {
  --bg-primary: #1f2937;
  --bg-secondary: #111827;
  --bg-tertiary: #374151;
  --bg-elevated: #252d3d;
  --text-primary: #f9fafb;
  --text-secondary: #d1d5db;
  --text-tertiary: #9ca3af;
  --border-color: #374151;
  --border-light: #4b5563;
  --hover-bg: #374151;
  --input-bg: #374151;
  --input-border: #4b5563;
  --input-focus: #60a5fa;
  --card-bg: #1f2937;
  --header-bg: #1f2937;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 8px 18px rgba(0,0,0,0.35);
  --shadow-lg: 0 20px 42px rgba(0,0,0,0.55);
}

* {
  transition-property: background-color, border-color, color, fill, stroke, box-shadow, transform;
  transition-duration: 180ms;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

.spinner {
  border: 3px solid var(--border-color);
  border-top: 3px solid #38bdf8;
  border-radius: 9999px;
  width: 24px;
  height: 24px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.fade-in { animation: fadeIn 0.25s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.gradient-bg { background: linear-gradient(135deg, #38bdf8 0%, #818cf8 50%, #c084fc 100%); }
[data-theme="dark"] .gradient-bg { background: linear-gradient(135deg, #075985 0%, #3730a3 52%, #581c87 100%); }

.card-hover { cursor: pointer; }
.card-hover:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.nav-item {
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
}
.nav-item:hover { background: rgba(56, 189, 248, 0.12); border-left-color: #38bdf8; }
.nav-item.active { background: rgba(56, 189, 248, 0.18); border-left-color: #38bdf8; font-weight: 700; }
[data-theme="dark"] .nav-item:hover { background: rgba(96, 165, 250, 0.16); }
[data-theme="dark"] .nav-item.active { background: rgba(96, 165, 250, 0.22); }

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}
.status-active, .status-present, .status-passed, .status-complete, .status-published { background: #dcfce7; color: #166534; }
.status-inactive, .status-absent, .status-failed, .status-overdue { background: #fee2e2; color: #991b1b; }
.status-pending, .status-upcoming, .status-draft { background: #fef3c7; color: #92400e; }
.status-info, .status-exam, .status-assignment { background: #dbeafe; color: #1e40af; }

.school-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
  background: var(--school-purple-light);
  color: #4f46e5;
  font-size: 0.75rem;
  font-weight: 700;
}
[data-theme="dark"] .school-chip { background: rgba(129, 140, 248, 0.16); color: #c7d2fe; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.18s ease;
  backdrop-filter: blur(4px);
  padding: 1rem;
}
[data-theme="dark"] .modal-overlay { background: rgba(0, 0, 0, 0.72); }
.modal-content {
  background: var(--card-bg);
  border-radius: 1rem;
  width: min(920px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
}

.toast-container {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.toast {
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  box-shadow: var(--shadow-lg);
  color: white;
  min-width: 240px;
  font-weight: 600;
  animation: slideToast 0.2s ease-out;
}
.toast-success { background: #16a34a; }
.toast-error { background: #dc2626; }
.toast-info { background: #2563eb; }
@keyframes slideToast { from { transform: translateX(16px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

[data-theme="dark"] body,
[data-theme="dark"] .bg-gray-50 { background-color: var(--bg-secondary) !important; color: var(--text-primary) !important; }
[data-theme="dark"] .bg-white { background-color: var(--card-bg) !important; color: var(--text-primary) !important; }
[data-theme="dark"] .bg-gray-100 { background-color: var(--bg-tertiary) !important; color: var(--text-primary) !important; }
[data-theme="dark"] .bg-gray-200 { background-color: var(--bg-tertiary) !important; }
[data-theme="dark"] .text-gray-900,
[data-theme="dark"] .text-gray-800 { color: var(--text-primary) !important; }
[data-theme="dark"] .text-gray-700,
[data-theme="dark"] .text-gray-600,
[data-theme="dark"] .text-gray-500 { color: var(--text-secondary) !important; }
[data-theme="dark"] .text-gray-400 { color: var(--text-tertiary) !important; }
[data-theme="dark"] .border-gray-100,
[data-theme="dark"] .border-gray-200,
[data-theme="dark"] .border-gray-300 { border-color: var(--border-color) !important; }
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  background-color: var(--input-bg) !important;
  border-color: var(--input-border) !important;
  color: var(--text-primary) !important;
}
[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder { color: var(--text-tertiary) !important; }
input, textarea, select { transition: all 0.18s ease; }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--input-focus) !important;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.16) !important;
}
[data-theme="dark"] thead { background-color: var(--bg-tertiary) !important; }
[data-theme="dark"] .hover\:bg-gray-50:hover { background-color: var(--hover-bg) !important; }
[data-theme="dark"] aside { background-color: var(--card-bg) !important; border-right-color: var(--border-color) !important; }
[data-theme="dark"] header { background-color: var(--header-bg) !important; border-bottom-color: var(--border-color) !important; }

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll table { min-width: 760px; }

@media (max-width: 1024px) {
  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 35;
  }
}
