:root {
  --bg: #f2f6fc;
  --card: #ffffff;
  --text: #101828;
  --muted: #667085;
  --primary: #1a6ef5;
  --primary-hover: #0f5bd6;
  --primary-deep: #0b4bb8;
  --accent: #ffc627;
  --accent-hover: #f5b800;
  --accent-text: #1a1a1a;
  --dark: #0b0f19;
  --dark-soft: #141a2a;
  --border: #e4e9f2;
  --success-bg: #ecfdf5;
  --success-text: #065f46;
  --error-bg: #fef2f2;
  --error-text: #991b1b;
  --shadow: 0 10px 30px rgba(11, 15, 25, 0.08);
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top right, rgba(26, 110, 245, 0.07), transparent 40%),
    var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

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

/* ---- Dark navy header ---- */

.site-header {
  background: var(--dark);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 800;
  color: #ffffff;
  font-size: 1.15rem;
  letter-spacing: 0.01em;
}

.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  background: #ffffff;
  border: 2px solid rgba(255, 255, 255, 0.25);
}

.brand:hover {
  text-decoration: none;
}

.brand .brand-accent {
  color: var(--accent);
}

.site-header nav {
  display: flex;
  gap: 1.25rem;
  align-items: center;
}

.site-header nav a {
  color: #d7dceb;
  font-weight: 600;
  font-size: 0.95rem;
}

.site-header nav a:hover {
  color: #ffffff;
  text-decoration: none;
}

.site-header nav a.active {
  color: var(--accent);
}

.nav-email {
  color: #8b93a8;
  font-size: 0.9rem;
}

main.container {
  flex: 1;
  padding: 2rem 0 3rem;
}

.site-footer {
  background: var(--dark);
  color: #8b93a8;
  font-size: 0.9rem;
  padding: 1.25rem 0 1.5rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

/* ---- Blue hero ---- */

.hero {
  text-align: center;
  padding: 3.5rem 1.5rem;
  background: linear-gradient(135deg, #1a6ef5 0%, #0b4bb8 100%);
  border: none;
  color: #ffffff;
}

.hero h1 {
  margin-top: 0;
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  color: #ffffff;
}

.hero h1 .hero-accent {
  color: var(--accent);
}

.hero p {
  color: #dbe7ff;
  font-size: 1.05rem;
}

.hero-pill {
  display: inline-block;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  border-radius: 999px;
  padding: 0.3rem 0.9rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.form-card {
  max-width: 420px;
  margin: 0 auto 1.25rem;
}

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

@media (max-width: 760px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

h1, h2 {
  margin-top: 0;
}

.muted {
  color: var(--muted);
}

.muted.small,
.small {
  font-size: 0.9rem;
}

.stack-form {
  display: grid;
  gap: 1rem;
}

.stack-form label {
  display: grid;
  gap: 0.4rem;
  font-weight: 600;
  font-size: 0.95rem;
}

input,
textarea,
button {
  font: inherit;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
  background: #fff;
}

input:focus,
textarea:focus {
  outline: 2px solid rgba(26, 110, 245, 0.35);
  border-color: var(--primary);
}

textarea {
  resize: vertical;
}

.inline-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.button-row {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

/* ---- Buttons ---- */

.btn {
  display: inline-block;
  border: none;
  border-radius: 999px;
  padding: 0.7rem 1.2rem;
  cursor: pointer;
  font-weight: 700;
  text-decoration: none;
  text-align: center;
  transition: background 0.15s ease, transform 0.1s ease;
}

.btn:hover {
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-accent {
  background: var(--accent);
  color: var(--accent-text);
}

.btn-accent:hover {
  background: var(--accent-hover);
}

.btn-outline-light {
  background: transparent;
  color: #ffffff;
  border: 2px solid rgba(255, 255, 255, 0.7);
}

.btn-outline-light:hover {
  background: rgba(255, 255, 255, 0.12);
}

.btn-secondary {
  background: var(--dark-soft);
  color: #fff;
}

.btn-secondary:hover {
  background: #1e2740;
}

.btn-light {
  background: #eef2f7;
  color: var(--text);
}

.btn-light:hover {
  background: #e1e7ef;
}

.btn-small {
  padding: 0.45rem 0.9rem;
  font-size: 0.9rem;
}

.btn-disabled,
.btn:disabled {
  background: #d1d5db;
  color: #4b5563;
  cursor: not-allowed;
}

.inline-form {
  display: inline;
  margin: 0;
}

.flash-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1.25rem;
  display: grid;
  gap: 0.6rem;
}

.flash {
  padding: 0.85rem 1rem;
  border-radius: 10px;
  border: 1px solid transparent;
}

.flash-success {
  background: var(--success-bg);
  color: var(--success-text);
  border-color: #a7f3d0;
}

.flash-error {
  background: var(--error-bg);
  color: var(--error-text);
  border-color: #fecaca;
}

.table-wrap {
  overflow-x: auto;
}

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

th,
td {
  text-align: left;
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

th {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}

.badge {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.badge-available {
  background: #dbeafe;
  color: #0b4bb8;
}

.badge-booked {
  background: #fee2e2;
  color: #991b1b;
}

.badge-mine {
  background: #fff3c9;
  color: #7a5800;
}

.booking-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  display: grid;
  gap: 0.75rem;
}

.booking-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  padding: 0.75rem;
  background: #f7f9fd;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.drive-link {
  font-weight: 700;
}

.notes-box {
  white-space: pre-wrap;
  background: #f7f9fd;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.9rem 1rem;
  line-height: 1.5;
}

/* ---- Student booking layout ---- */

.dash-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.dash-top h1 {
  margin: 0;
}

.notice-fast {
  margin: 0;
  padding: 0.6rem 1rem;
  border-radius: 999px;
  background: #fff3c9;
  border: 1px solid var(--accent);
  color: #7a5800;
  font-weight: 600;
  font-size: 0.95rem;
}

.booking-layout {
  display: grid;
  grid-template-columns: 5fr 7fr;
  gap: 1.25rem;
  align-items: stretch;
  min-height: calc(100vh - 230px);
}

@media (max-width: 860px) {
  .booking-layout {
    grid-template-columns: 1fr;
    min-height: unset;
  }
}

.howto-card,
.booking-card {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
}

.howto-card {
  background: var(--dark-soft);
  border-color: rgba(255, 255, 255, 0.08);
  color: #e7ebf5;
}

.howto-card h2 {
  color: #ffffff;
}

.howto-card .muted {
  color: #97a0b5;
}

.howto-card .notes-box {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
  color: #e7ebf5;
}

.howto-card .drive-link {
  color: #7fb0ff;
}

.video-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  overflow: hidden;
  background: #000;
}

.video-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.howto-extras {
  margin-top: 1rem;
  display: grid;
  gap: 0.75rem;
}

.my-bookings-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.date-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin: 0.5rem 0 1.25rem;
}

.arrow-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, transform 0.1s ease;
}

.arrow-btn:hover:not(:disabled) {
  background: #e8f0fe;
  transform: scale(1.05);
}

.arrow-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.current-date {
  font-weight: 700;
  font-size: 1.15rem;
  min-width: 230px;
  text-align: center;
}

.slot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.75rem;
  align-content: start;
  flex: 1;
  margin-bottom: 1.25rem;
}

.slot-box {
  border: 2px solid var(--border);
  background: #fff;
  border-radius: 10px;
  padding: 0.9rem 0.5rem;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.slot-box:hover {
  background: #dcfce7;
  border-color: #4ade80;
  color: #166534;
}

.slot-box.selected {
  background: #22c55e;
  border-color: #16a34a;
  color: #fff;
}

.btn-book {
  width: 100%;
  padding: 0.85rem;
  font-size: 1.05rem;
  background: var(--accent);
  color: var(--accent-text);
}

.btn-book:hover:not(:disabled) {
  background: var(--accent-hover);
}

.center {
  text-align: center;
}

/* ---- Personal notes ---- */

.student-notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.student-note-card {
  display: grid;
  gap: 0.6rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f7f9fd;
}

.student-note-head {
  display: grid;
  gap: 0.15rem;
}

.student-note-card .btn {
  justify-self: start;
}

.personal-note {
  margin-top: 1rem;
}

.personal-note h3 {
  margin: 0 0 0.5rem;
}

.personal-note .notes-box {
  background: #fff3c9;
  border-color: var(--accent);
  color: #3c2f00;
}

.howto-card .personal-note .notes-box {
  background: rgba(255, 198, 39, 0.12);
  border-color: rgba(255, 198, 39, 0.5);
  color: #ffe9a8;
}

.howto-card .personal-note h3 {
  color: var(--accent);
}

/* ---- Attendance ---- */

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.section-head h2 {
  margin: 0;
}

.page-heading {
  margin-bottom: 1.25rem;
}

.page-heading h1,
.page-heading p {
  margin-bottom: 0.25rem;
}

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

.stat-card {
  display: grid;
  gap: 0.2rem;
  padding: 1.15rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.stat-value {
  color: var(--primary-deep);
  font-size: 1.8rem;
  font-weight: 800;
}

.admin-links {
  display: grid;
  gap: 0.75rem;
}

.admin-links a {
  display: grid;
  gap: 0.15rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f7f9fd;
}

.admin-links a:hover {
  border-color: var(--primary);
  text-decoration: none;
}

.admin-links span {
  color: var(--muted);
  font-size: 0.9rem;
}

.search-form {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.search-form input {
  flex: 1;
}

.note-cell {
  min-width: 240px;
}

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

.note-form .btn {
  justify-self: start;
}

.settings-card {
  max-width: 720px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.badge-present {
  background: #d1fae5;
  color: #065f46;
}

.badge-absent {
  background: #fee2e2;
  color: #991b1b;
}

.badge-pending {
  background: #f3f4f6;
  color: #4b5563;
}

.attendance-actions {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.btn-present {
  background: #16a34a;
  color: #fff;
}

.btn-present:hover {
  background: #15803d;
}

.btn-absent {
  background: #dc2626;
  color: #fff;
}

.btn-absent:hover {
  background: #b91c1c;
}

@media (max-width: 760px) {
  .header-inner {
    align-items: flex-start;
    flex-direction: column;
  }

  .site-header nav {
    width: 100%;
    gap: 0.85rem;
    overflow-x: auto;
    padding-bottom: 0.25rem;
  }

  .site-header nav a {
    white-space: nowrap;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .search-form {
    align-items: stretch;
    flex-direction: column;
  }
}
