/* ========================================
   DESIGN TOKENS
   ======================================== */
:root {
  /* Colors — dark theme with indigo accent */
  --bg-primary: #0f1117;
  --bg-secondary: #1a1d2e;
  --bg-card: #1e2235;
  --bg-sidebar: #161928;
  --bg-input: #252a3a;
  --bg-hover: #2a2f45;
  --bg-table-row: #1c2033;
  --bg-table-row-alt: #212539;

  --text-primary: #e8eaf0;
  --text-secondary: #9da3b4;
  --text-muted: #6b7189;
  --text-on-accent: #ffffff;

  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-glow: rgba(99, 102, 241, 0.25);
  --accent-soft: rgba(99, 102, 241, 0.12);

  --border: #2a2e42;
  --border-input: #3a3f55;
  --border-input-focus: #6366f1;

  --danger: #ef4444;
  --danger-hover: #f87171;
  --success: #22c55e;
  --warning: #f59e0b;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 24px var(--accent-glow);

  /* Layout */
  --header-height: 64px;
  --sidebar-width: 260px;

  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========================================
   RESET & BASE
   ======================================== */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* ========================================
   BUTTONS
   ======================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 24px;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-normal);
  text-decoration: none;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--accent);
  color: var(--text-on-accent);
  box-shadow: var(--shadow-sm), 0 0 0 0 var(--accent-glow);
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: var(--shadow-md), var(--shadow-glow);
  transform: translateY(-1px);
}

.btn-logout {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: 8px 18px;
  font-size: 0.82rem;
}

.btn-logout:hover {
  color: var(--danger);
  border-color: var(--danger);
  background: rgba(239, 68, 68, 0.08);
}

/* ========================================
   LOGIN SECTION
   ======================================== */
.login-section {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(139, 92, 246, 0.06) 0%, transparent 50%),
    var(--bg-primary);
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  box-shadow: var(--shadow-lg);
  animation: fadeInUp 0.5s var(--transition-slow);
}

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

.login-logo {
  text-align: center;
  margin-bottom: 36px;
}

.logo-icon {
  font-size: 2.8rem;
  display: block;
  margin-bottom: 8px;
  filter: drop-shadow(0 0 8px var(--accent-glow));
}

.login-logo h1 {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.login-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Form */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}

.form-group input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 0.92rem;
  transition: all var(--transition-fast);
  outline: none;
}

.form-group input::placeholder {
  color: var(--text-muted);
}

.form-group input:focus {
  border-color: var(--border-input-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: var(--bg-secondary);
}

.login-error {
  color: var(--danger);
  font-size: 0.84rem;
  text-align: center;
  padding: 10px;
  background: rgba(239, 68, 68, 0.08);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(239, 68, 68, 0.2);
  margin-bottom: 16px;
}

#login-form .btn-primary {
  width: 100%;
  padding: 13px;
  font-size: 0.95rem;
  margin-top: 8px;
}

/* ========================================
   DASHBOARD LAYOUT
   ======================================== */
.dashboard-section {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header */
.dashboard-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  z-index: 100;
  backdrop-filter: blur(12px);
  background: rgba(26, 29, 46, 0.88);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-logo {
  font-size: 1.5rem;
}

.header-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-username {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-primary);
}

.header-role-badge {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--accent-soft);
  color: var(--accent-hover);
  border: 1px solid rgba(99, 102, 241, 0.2);
}

/* Dashboard body */
.dashboard-body {
  display: flex;
  margin-top: var(--header-height);
  min-height: calc(100vh - var(--header-height));
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  min-height: calc(100vh - var(--header-height));
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  padding: 20px 12px;
  position: fixed;
  top: var(--header-height);
  left: 0;
  overflow-y: auto;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-family: var(--font-family);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
}

.sidebar-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sidebar-btn.active {
  background: var(--accent-soft);
  color: var(--accent-hover);
  font-weight: 600;
}

.sidebar-icon {
  font-size: 1.15rem;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

/* Content area */
.content-area {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 32px 36px;
  min-height: calc(100vh - var(--header-height));
}

.content-page {
  animation: fadeIn 0.3s ease;
}

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

/* Page header */
.page-header {
  margin-bottom: 24px;
}

.page-header h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

/* ========================================
   TABLE STYLES
   ======================================== */
.table-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

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

.data-table thead th {
  background: var(--bg-sidebar);
  padding: 14px 20px;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table tbody tr {
  transition: background var(--transition-fast);
}

.data-table tbody tr:nth-child(odd) {
  background: var(--bg-table-row);
}

.data-table tbody tr:nth-child(even) {
  background: var(--bg-table-row-alt);
}

.data-table tbody tr:hover {
  background: var(--bg-hover);
}

.data-table td {
  padding: 13px 20px;
  font-size: 0.9rem;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

/* Day badge inside table */
.day-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--accent-soft);
  color: var(--accent-hover);
  border: 1px solid rgba(99, 102, 241, 0.15);
}

/* Date badge */
.date-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  background: rgba(6, 182, 212, 0.1);
  color: #22d3ee;
  border: 1px solid rgba(6, 182, 212, 0.15);
  white-space: nowrap;
}

/* Subject & Topic cells */
.cell-subject {
  font-weight: 600;
  color: var(--text-primary);
}

.cell-topic {
  color: var(--text-secondary);
  font-style: italic;
}

/* ========================================
   FILTER BAR & SELECT
   ======================================== */
.filter-bar {
  margin-bottom: 16px;
  padding: 12px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.filters-container {
  display: flex;
  gap: 15px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  width: 100%;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
}

.filter-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-md);
  padding: 9px 36px 9px 14px;
  font-family: var(--font-family);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  transition: all var(--transition-fast);
  min-width: 160px;

  /* Custom arrow */
  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='%239da3b4' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.filter-select:hover {
  border-color: var(--text-muted);
  background-color: var(--bg-hover);
}

.filter-select:focus {
  border-color: var(--border-input-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.filter-select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
  padding: 8px;
}

/* ========================================
   GRADE BADGES
   ======================================== */
.grade-value {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
  min-width: 36px;
  text-align: center;
}

.grade-high {
  background: rgba(34, 197, 94, 0.12);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.grade-mid {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.grade-low {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* ========================================
   PLACEHOLDER & EMPTY STATES
   ======================================== */
.placeholder-text {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.empty-state {
  text-align: center;
  padding: 80px 24px;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state-text {
  font-size: 0.95rem;
  color: var(--text-secondary);
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
  .sidebar {
    display: none;
  }

  .content-area {
    margin-left: 0;
    padding: 24px 16px;
  }

  .login-card {
    padding: 36px 24px;
  }

  .dashboard-header {
    padding: 0 16px;
  }

  .data-table td,
  .data-table thead th {
    padding: 10px 12px;
    font-size: 0.82rem;
  }
}

/* ========================================
   FILTERS STYLES
   ======================================== */
.filters-container {
  display: flex;
  gap: 15px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.filter-label {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.filter-select {
  padding: 10px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 0.9rem;
  cursor: pointer;
  outline: none;
  transition: all var(--transition-fast);
}

.filter-select:hover {
  border-color: var(--text-muted);
}

.filter-select:focus {
  border-color: var(--border-input-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: var(--bg-secondary);
}

/* ========================================
   SCROLLBAR
   ======================================== */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ========================================
   LOADING SPINNER
   ======================================== */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* ========================================
   MANAGE FORMS (Керування розкладом / оцінками)
   ======================================== */
.form-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.form-card h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.manage-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-row {
  display: flex;
  gap: 16px;
}

.form-row .form-group {
  flex: 1;
  margin-bottom: 0;
}

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  background: var(--accent);
  color: var(--text-on-accent);
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  align-self: flex-start;
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: var(--shadow-glow);
  transform: translateY(-1px);
}

.btn-danger-sm {
  padding: 5px 12px;
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-danger-sm:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
  transform: scale(1.05);
}
