:root {
  --bg: #07131f;
  --bg-soft: #0d2033;
  --panel: rgba(7, 19, 31, 0.72);
  --panel-strong: rgba(10, 25, 40, 0.9);
  --line: rgba(255, 255, 255, 0.08);
  --text: #edf5ff;
  --muted: #b7c8dc;
  --accent: #f59e0b;
  --accent-strong: #f97316;
  --secondary: #38bdf8;
  --success: #22c55e;
  --danger: #f87171;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
}

body.light-theme {
  --bg: #f3f8ff;
  --bg-soft: #e8f1fb;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-strong: rgba(255, 255, 255, 0.98);
  --line: rgba(15, 23, 42, 0.12);
  --text: #10263d;
  --muted: #526578;
  --accent: #f59e0b;
  --accent-strong: #f97316;
  --secondary: #0ea5e9;
  --success: #16a34a;
  --danger: #dc2626;
  --shadow: 0 20px 42px rgba(15, 23, 42, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Cairo", serif;
  font-optical-sizing: auto;
  font-weight: 200;
  font-style: normal;
  font-variation-settings: "slnt" 0;
  color: var(--text);
  background:
    radial-gradient(circle at top right, rgba(56, 189, 248, 0.16), transparent 24%),
    radial-gradient(circle at left center, rgba(245, 158, 11, 0.12), transparent 28%),
    linear-gradient(135deg, #04111d 0%, #0a1d2f 48%, #10263d 100%);
}

body.light-theme {
  background:
    radial-gradient(circle at top right, rgba(56, 189, 248, 0.12), transparent 24%),
    radial-gradient(circle at left center, rgba(245, 158, 11, 0.08), transparent 28%),
    linear-gradient(135deg, #f7fbff 0%, #edf4fb 48%, #e6eef8 100%);
}

a {
  text-decoration: none;
}

.ambient-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.03), transparent 40%),
    radial-gradient(circle at 20% 20%, rgba(245, 158, 11, 0.1), transparent 16%),
    radial-gradient(circle at 80% 15%, rgba(56, 189, 248, 0.1), transparent 18%);
}

.app-container {
  width: min(1280px, calc(100% - 2rem));
  margin-inline: auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(18px);
  background: rgba(4, 17, 29, 0.6);
  border-bottom: 1px solid var(--line);
}

.navbar {
  padding: 1rem 0;
}

.navbar-toggler {
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 14px;
  padding: 0.5rem 0.65rem;
  background: rgba(255, 255, 255, 0.06);
}

.navbar-toggler:focus {
  box-shadow: 0 0 0 0.2rem rgba(56, 189, 248, 0.18);
}

.navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28237,245,255,0.95%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2.25' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 0.9rem;
  color: var(--text);
}

.brand-mark:hover,
.brand-mark:focus {
  color: var(--text);
}

.brand-mark-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #09111a;
  font-weight: 900;
  font-size: 1.4rem;
  box-shadow: 0 10px 30px rgba(249, 115, 22, 0.25);
}

.brand-mark strong,
.brand-mark small {
  display: block;
}

.brand-mark small {
  color: var(--muted);
  font-size: 0.78rem;
}

.nav-links,
.auth-links {
  gap: 0.5rem;
  align-items: center;
}

.auth-links form {
  margin: 0;
}

.nav-link {
  color: var(--muted);
  border-radius: 999px;
  padding: 0.7rem 1rem !important;
}

.nav-link:hover,
.nav-link:focus {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

body.light-theme .nav-link:hover,
body.light-theme .nav-link:focus {
  background: rgba(15, 23, 42, 0.06);
}

.user-chip {
  background: rgba(255, 255, 255, 0.06);
}

.btn {
  border-radius: 999px;
  padding: 0.75rem 1.25rem;
  font-weight: 700;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  border-color: transparent;
  color: #09111a;
  box-shadow: 0 12px 28px rgba(249, 115, 22, 0.25);
}

.btn-primary:hover,
.btn-primary:focus {
  background: linear-gradient(135deg, #fbbf24, #fb923c);
  border-color: transparent;
  color: #09111a;
}

.btn-outline-light {
  border-color: rgba(255, 255, 255, 0.18);
}

.btn-danger-soft {
  border: 1px solid rgba(248, 113, 113, 0.32);
  background: rgba(248, 113, 113, 0.14);
  color: #ffd1d1;
}

.btn-danger-soft:hover,
.btn-danger-soft:focus {
  background: rgba(248, 113, 113, 0.22);
  color: #fff0f0;
}

.app-main {
  padding-block: 2rem 3rem;
}

.theme-toggle-btn {
  margin-inline-end: 0.75rem;
  min-width: 86px;
}

.dashboard-shell,
.page-shell {
  display: grid;
  gap: 1.5rem;
}

.hero-panel,
.page-header,
.glass-panel {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero-panel,
.page-header {
  border-radius: 32px;
}

.hero-panel {
  display: grid;
  grid-template-columns: 1.25fr 0.9fr;
  gap: 1.5rem;
  padding: 2rem;
  min-height: 340px;
}

.hero-panel::after,
.page-header::after,
.glass-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(130deg, rgba(255, 255, 255, 0.05), transparent 45%);
  pointer-events: none;
}

.hero-copy h1,
.page-header h1 {
  margin: 0.4rem 0 0.8rem;
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1.15;
}

.hero-copy p,
.page-header p,
.section-title-row p,
.empty-state-card,
.cycle-item p,
.recent-item p {
  color: var(--muted);
}

.hero-actions,
.page-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1.4rem;
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  align-content: end;
}

.metric-block,
.cycle-item,
.recent-item,
.empty-state-card {
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.metric-block {
  padding: 1.25rem;
}

.metric-block span {
  display: block;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.metric-block strong {
  font-size: 2rem;
}

.general-level {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.general-level.low {
  color: #ef4444;
}

.general-level.medium {
  color: #f59e0b;
}

.general-level.high {
  color: #22c55e;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
}

.glass-panel {
  border-radius: var(--radius-xl);
  padding: 1.5rem;
}

.section-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.section-title-row h2 {
  margin: 0;
  font-size: 1.45rem;
}

.eyebrow,
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 0.9rem;
}

.status-pill.accent {
  background: rgba(245, 158, 11, 0.16);
  color: #ffd89d;
}

.cycle-list,
.recent-list {
  display: grid;
  gap: 0.9rem;
}

.cycle-item,
.recent-item,
.empty-state-card {
  padding: 1rem 1.1rem;
}

.cycle-item,
.recent-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.cycle-item h3,
.recent-item h3 {
  margin: 0 0 0.2rem;
  font-size: 1rem;
}

.recent-meta {
  text-align: left;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.6rem 1.8rem;
}

.page-header.compact h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
}

.reviews-page-shell {
  width: calc(100vw - 1rem);
  margin-inline: calc(50% - 50vw + 0.5rem);
}

.users-page-shell {
  width: calc(100vw - 1.5rem);
  margin-inline: calc(50% - 50vw + 0.75rem);
}

.review-form {
  display: grid;
  gap: 1.5rem;
}

.auth-shell {
  min-height: calc(100vh - 11rem);
  display: grid;
  align-items: center;
  gap: 1.5rem;
}

.auth-page-header {
  display: grid;
  grid-template-columns: 1fr 1.3fr 1fr;
  align-items: center;
  gap: 1.5rem;
  padding: 1.25rem 1.5rem;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
}

.auth-header-logo {
  width: 100%;
  max-height: 120px;
  object-fit: contain;
}

.auth-header-logo-left {
  justify-self: start;
}

.auth-header-logo-center {
  justify-self: center;
  max-height: 130px;
}

.auth-header-logo-right {
  justify-self: end;
}

.auth-panel {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 1.5rem;
  align-items: stretch;
}

.auth-hero,
.auth-card {
  position: relative;
  overflow: hidden;
  border-radius: 32px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.auth-hero {
  padding: 2.25rem;
  background:
    radial-gradient(circle at top left, rgba(56, 189, 248, 0.18), transparent 26%),
    linear-gradient(145deg, rgba(9, 27, 43, 0.95), rgba(7, 18, 31, 0.88));
}

.official-auth-panel {
  grid-template-columns: 1.05fr 0.95fr;
}

.official-auth-hero {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(243, 247, 250, 0.97)),
    linear-gradient(145deg, rgba(9, 27, 43, 0.95), rgba(7, 18, 31, 0.88));
  border-color: rgba(15, 23, 42, 0.08);
}

.official-auth-hero h1,
.official-auth-card h2 {
  color: #10263d;
}

.official-auth-hero p,
.official-auth-card p,
.official-auth-feature-item span {
  color: #526578;
}

.official-auth-card {
  background: rgba(255, 255, 255, 0.94);
  border-color: rgba(15, 23, 42, 0.08);
  color-scheme: light;
}

.official-auth-card .form-control {
  background: rgba(15, 23, 42, 0.03);
  color: #10263d;
  border-color: rgba(15, 23, 42, 0.1);
}

.official-auth-card .form-control:focus,
.official-auth-card .form-control:active,
.official-auth-card .form-control:not(:placeholder-shown) {
  background: rgba(255, 255, 255, 0.98);
  color: #10263d;
  border-color: rgba(56, 189, 248, 0.38);
}

.official-auth-card .form-control::placeholder {
  color: #7a8a99;
}

.official-auth-card input:-webkit-autofill,
.official-auth-card input:-webkit-autofill:hover,
.official-auth-card input:-webkit-autofill:focus,
.official-auth-card input:-webkit-autofill:active {
  -webkit-text-fill-color: #10263d;
  -webkit-box-shadow: 0 0 0 1000px rgba(255, 255, 255, 0.98) inset;
  transition: background-color 9999s ease-out 0s;
}

.official-auth-card .form-check-input {
  border-color: rgba(15, 23, 42, 0.2);
}

.official-auth-card .remember-check,
.official-auth-card .validation-summary,
.official-auth-card .text-danger {
  color: #7a1f1f;
}

.official-auth-feature-item {
  background: rgba(15, 23, 42, 0.03);
  border-color: rgba(15, 23, 42, 0.08);
}

.official-auth-feature-item strong {
  color: #18344e;
}

.official-eyebrow {
  background: rgba(16, 38, 61, 0.08);
  color: #38546d;
}

.auth-hero h1 {
  margin: 0.5rem 0 0.85rem;
  font-size: clamp(2.1rem, 5vw, 3.3rem);
  line-height: 1.12;
}

.auth-hero p {
  max-width: 34rem;
  color: var(--muted);
}

.auth-feature-list {
  display: grid;
  gap: 1rem;
  margin-top: 2rem;
}

.auth-feature-item {
  padding: 1rem 1.1rem;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.auth-feature-item strong,
.auth-feature-item span {
  display: block;
}

.auth-feature-item span {
  margin-top: 0.35rem;
  color: var(--muted);
}

.auth-card {
  padding: 2rem;
  background: rgba(9, 23, 37, 0.88);
}

.auth-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.remember-check {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--muted);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem 1.2rem;
}

.form-field {
  display: grid;
  gap: 0.5rem;
}

.form-field label {
  font-weight: 700;
}

.form-control,
.form-select {
  min-height: 52px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.form-control[readonly] {
  background: rgba(255, 255, 255, 0.03);
}

.form-control:focus,
.form-select:focus,
.btn:focus {
  border-color: rgba(56, 189, 248, 0.7);
  box-shadow: 0 0 0 0.25rem rgba(56, 189, 248, 0.18);
}

.form-select option {
  color: #09111a;
}

.input-with-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
}

.inline-role-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
}

.import-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1.25rem;
}

.filters-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
  min-height: 42px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  margin-inline: 0.5rem;
}

.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_paginate {
  color: var(--muted) !important;
  margin-top: 1rem;
}

.dataTables_wrapper .paginate_button {
  color: var(--muted) !important;
}

.dataTables_wrapper .paginate_button.current,
.dataTables_wrapper .paginate_button.current:hover {
  background: rgba(245, 158, 11, 0.18) !important;
  border: 1px solid rgba(245, 158, 11, 0.28) !important;
  color: #ffd89d !important;
}

.criteria-table-wrapper {
  overflow-x: auto;
}

.reviews-page-shell .page-header,
.reviews-page-shell .glass-panel {
  padding-inline: 1rem;
}

.users-page-shell .page-header,
.users-page-shell .glass-panel {
  padding-inline: 1rem;
}

.users-table-panel {
  grid-column: 1 / -1;
}

.password-update-form {
  grid-template-columns: minmax(180px, 1fr) auto;
}

.criteria-header-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.criteria-header-card {
  padding: 1rem 1.1rem;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.14), rgba(56, 189, 248, 0.08));
  border: 1px solid rgba(245, 158, 11, 0.22);
}

.criteria-header-card span,
.criteria-header-card strong {
  display: block;
}

.criteria-header-card span {
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 0.25rem;
}

.criteria-header-card strong {
  color: #ffe1b3;
  font-size: 1rem;
}

.criteria-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 0.75rem;
}

.criteria-table th {
  color: var(--muted);
  font-weight: 700;
  padding: 0 0.8rem 0.35rem;
  white-space: nowrap;
}

.criteria-table td {
  background: rgba(255, 255, 255, 0.04);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding: 0.9rem 0.8rem;
  vertical-align: top;
}

.criteria-table td:first-child {
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  border-top-right-radius: 18px;
  border-bottom-right-radius: 18px;
}

.criteria-table td:last-child {
  border-left: 1px solid rgba(255, 255, 255, 0.06);
  border-top-left-radius: 18px;
  border-bottom-left-radius: 18px;
  min-width: 220px;
}

.teacher-only-row {
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.level-indicator {
  display: inline-flex;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.04);
}

.level-indicator.low {
  background: #ef4444;
}

.level-indicator.medium {
  background: #f97316;
}

.level-indicator.high {
  background: #22c55e;
}

.teacher-only-row.is-hidden {
  display: none;
}

.empty-state-cell {
  text-align: center;
  color: var(--muted);
}

.score-preview {
  text-align: left;
}

.score-preview span {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
}

.score-preview strong {
  font-size: 2rem;
  color: #ffd89d;
}

.submit-bar {
  display: flex;
  justify-content: flex-start;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.validation-summary ul {
  margin: 0;
  padding-right: 1.2rem;
}

.text-danger {
  color: #ffb4b4 !important;
}

.import-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(5, 14, 24, 0.72);
  backdrop-filter: blur(4px);
}

.import-loading-overlay.is-visible {
  display: flex;
}

.import-loading-card {
  width: min(430px, calc(100% - 2rem));
  padding: 1.4rem;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(8, 24, 39, 0.96);
  text-align: center;
  display: grid;
  gap: 0.55rem;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.3);
}

.import-loading-card strong {
  font-size: 1.1rem;
}

.import-loading-card span {
  color: var(--muted);
}

.import-spinner {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--secondary);
  margin-inline: auto;
  animation: import-spin 0.9s linear infinite;
}

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

.alert-success {
  border: none;
  border-radius: 18px;
  background: rgba(34, 197, 94, 0.15);
  color: #c8ffd8;
}

.footer-bar {
  border-top: 1px solid var(--line);
  background: rgba(4, 17, 29, 0.6);
}

.footer-content {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0 1.4rem;
  color: var(--muted);
  font-size: 0.95rem;
}

@media (max-width: 992px) {
  .auth-page-header,
  .hero-panel,
  .auth-panel,
  .dashboard-grid,
  .import-summary,
  .filters-grid,
  .form-grid,
  .page-header {
    grid-template-columns: 1fr;
  }

  .hero-panel,
  .page-header {
    display: grid;
  }

  .hero-metrics {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .app-container {
    width: min(100% - 1rem, 100%);
  }

  .hero-panel,
  .auth-hero,
  .auth-card,
  .glass-panel,
  .page-header {
    padding: 1.2rem;
    border-radius: 24px;
  }

  .hero-metrics,
  .form-grid,
  .criteria-header-grid {
    grid-template-columns: 1fr;
  }

  .reviews-page-shell {
    width: calc(100vw - 0.5rem);
    margin-inline: calc(50% - 50vw + 0.25rem);
  }

  .auth-page-header {
    gap: 0.75rem;
    padding: 1rem;
  }

  .auth-header-logo {
    max-height: 84px;
  }

  .input-with-button {
    grid-template-columns: 1fr;
  }

  .navbar-collapse {
    margin-top: 1rem;
    padding-top: 0.5rem;
  }

  .nav-links,
  .auth-links {
    width: 100%;
    gap: 0.75rem;
  }

  .auth-links {
    margin-top: 0.75rem;
  }

  .auth-links .nav-item,
  .auth-links form,
  .auth-links .btn,
  .auth-links .user-chip {
    width: 100%;
  }

  .auth-links .btn,
  .auth-links .user-chip {
    display: flex;
    justify-content: center;
    text-align: center;
  }

  .footer-content,
  .cycle-item,
  .recent-item,
  .section-title-row {
    grid-template-columns: 1fr;
    display: grid;
  }

  .recent-meta,
  .score-preview {
    text-align: right;
  }

  .submit-bar .btn {
    width: 100%;
  }
}
