:root {
  --navy: #1b2a4a;
  --navy-dark: #131f38;
  --red: #a3231f;
  --red-dark: #7f1a17;
  --cream: #f7f5f0;
  --text: #24272b;
  --muted: #5c6370;
  --border: #dfe1e6;
  --success-bg: #e6f4ea;
  --success-text: #1e6b33;
  --error-bg: #fbe9e7;
  --error-text: #9c2b20;
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: #fff;
  line-height: 1.55;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; color: var(--navy); line-height: 1.2; }
h1 { font-size: 2.1rem; margin-top: 0.2em; }
h2 { font-size: 1.5rem; margin-top: 1.6em; }
a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header / nav */
.site-header { background: var(--navy); color: #fff; }
.header-inner { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; flex-wrap: wrap; gap: 10px; }
.brand { display: flex; align-items: center; gap: 8px; color: #fff; font-family: Georgia, serif; font-size: 1.25rem; font-weight: bold; }
.brand:hover { text-decoration: none; opacity: 0.9; }
.brand-mark { font-size: 1.3rem; }
.main-nav { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.main-nav a { color: #dfe4ee; font-weight: 500; }
.main-nav a.active, .main-nav a:hover { color: #fff; }
.main-nav a:hover { text-decoration: none; border-bottom: 2px solid var(--red); padding-bottom: 2px; }
.nav-user { color: #cfd6e4; font-size: 0.9rem; }

/* "Classes" dropdown in the main nav -- shown on hover/focus (desktop mouse)
   and toggled by click via shared/public/js/site.js (adds/removes .is-open,
   for touch/keyboard use -- see that file). The trigger link itself still
   goes straight to /classes with JS disabled.
   `.nav-dropdown-menu`'s gap above the visible panel is `padding-top`, NOT
   `margin`, deliberately -- padding is still part of the hoverable box, so
   there's no dead zone between the trigger and the menu for the pointer to
   fall through (a `margin-top` gap there was closing the menu before the
   cursor could reach it). The actual visible panel is the `-inner` div. */
.nav-dropdown { position: relative; }
.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  padding-top: 8px;
  z-index: 20;
}
.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu,
.nav-dropdown.is-open .nav-dropdown-menu {
  display: block;
}
.nav-dropdown-menu-inner {
  min-width: 180px;
  background: var(--navy);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius);
  padding: 6px 0;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}
.nav-dropdown-menu a {
  display: block;
  padding: 8px 16px;
  white-space: nowrap;
  color: #dfe4ee;
}
.nav-dropdown-menu a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border-bottom: none;
  padding-bottom: 8px;
}

/* Flash messages */
.flash { padding: 12px 0; font-weight: 500; }
.flash-success { background: var(--success-bg); color: var(--success-text); }
.flash-error { background: var(--error-bg); color: var(--error-text); }

/* Hero */
.hero { background: linear-gradient(135deg, var(--navy) 0%, var(--navy-dark) 100%); color: #fff; padding: 70px 0; }
.hero-inner { max-width: 760px; }
.hero h1 { color: #fff; font-size: 2.4rem; margin-bottom: 0.4em; }
.hero-sub { color: #d7ddea; font-size: 1.1rem; margin-bottom: 1.6em; }
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }

/* Buttons */
.button, .button-outline, .link-button {
  display: inline-block;
  padding: 12px 22px;
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  font-size: 1rem;
}
.button { background: var(--red); color: #fff; border-color: var(--red); }
.button:hover { background: var(--red-dark); border-color: var(--red-dark); text-decoration: none; }
.button-outline { background: transparent; color: #fff; border-color: #fff; }
.button-outline.small { padding: 6px 14px; font-size: 0.9rem; }
.button-outline:hover { background: rgba(255,255,255,0.12); text-decoration: none; }
section .button-outline, .booking-option .button-outline { color: var(--navy); border-color: var(--navy); }
section .button-outline:hover { background: var(--navy); color: #fff; }
.link-button { background: none; border: none; color: #dfe4ee; padding: 0; font-weight: 500; text-decoration: underline; cursor: pointer; }
.inline-form { display: inline; }
.link-arrow { font-weight: 600; }
.link-arrow.back { display: inline-block; margin-bottom: 1em; }

/* Sections & cards */
.section { padding: 40px 0; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; margin-top: 1.2em; }
.card { border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; background: var(--cream); }
.class-category { margin-top: 2.4em; }
.class-category:first-of-type { margin-top: 1.6em; }
.class-category h2 { border-bottom: 1px solid var(--border); padding-bottom: 0.3em; }
.card h3 { margin-top: 0; font-size: 1.15rem; }
.price { font-weight: 700; color: var(--navy); }
.meta { color: var(--muted); font-size: 0.92rem; }
.alt-path { background: var(--cream); border-radius: var(--radius); padding: 20px; }

.upcoming-list { list-style: none; padding: 0; }
.upcoming-list li { padding: 10px 0; border-bottom: 1px solid var(--border); }

/* Class detail syllabus */
.syllabus { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; margin: 1.2em 0; }
.syllabus-section { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 20px; background: var(--cream); }
.syllabus-section h3 { margin-top: 0; font-size: 1rem; }
.syllabus-section ul { margin: 0; padding-left: 1.2em; }
.syllabus-section li { padding: 3px 0; }

/* About / instructor page */
.instructor-layout { display: flex; gap: 30px; flex-wrap: wrap; margin-top: 1.5em; }
.instructor-photo {
  width: 220px; height: 220px; border-radius: var(--radius);
  background: var(--cream); border: 1px dashed var(--border);
  display: flex; align-items: center; justify-content: center; color: var(--muted); flex-shrink: 0;
}
.instructor-bio { flex: 1; min-width: 260px; }
.instructor-title { color: var(--muted); font-weight: 600; margin-top: -0.6em; }

.ltp-banner { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-start; margin-top: 1.5em; }
.ltp-badge {
  /* Padding here is the mark's required clear space -- keep it clear of any other
     graphic, logo, or text per the Red Cross Training Provider graphic guidelines. */
  width: 260px; padding: 22px; background: #fff; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.ltp-badge img { display: block; width: 100%; height: auto; }
.ltp-banner > div:last-child { flex: 1; min-width: 260px; }

/* Booking browse */
.view-toggle { display: flex; gap: 10px; margin: 1em 0 1.6em; flex-wrap: wrap; align-items: center; }
.view-toggle a { padding: 8px 18px; border: 1px solid var(--border); border-radius: 20px; color: var(--navy); font-weight: 600; }
.view-toggle a.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.view-toggle a:hover { text-decoration: none; }
.filter-chip { padding: 6px 14px; border-radius: 20px; background: var(--cream); font-size: 0.88rem; }
.filter-chip a { margin-left: 8px; }

.day-group { margin-bottom: 1.6em; }
.occurrence-list { list-style: none; padding: 0; }
.occurrence-row a {
  display: grid; grid-template-columns: 90px 1fr 160px 120px; gap: 12px; align-items: center;
  padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 8px;
  color: var(--text);
}
.occurrence-row a:hover { border-color: var(--red); text-decoration: none; }
.occ-time { font-weight: 700; color: var(--navy); }
.occ-seats { color: var(--muted); font-size: 0.88rem; text-align: right; }

.calendar-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1em; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.calendar-weekday { font-weight: 700; color: var(--muted); text-align: center; padding: 6px 0; font-size: 0.85rem; }
.calendar-cell { min-height: 90px; border: 1px solid var(--border); border-radius: 6px; padding: 6px; font-size: 0.82rem; }
.calendar-cell.empty { border: none; }
.cell-day { font-weight: 700; color: var(--navy); }
.cell-event { display: block; background: var(--cream); border-radius: 4px; padding: 3px 5px; margin-top: 4px; color: var(--navy); }
.cell-event:hover { background: var(--red); color: #fff; text-decoration: none; }

/* Booking detail */
.booking-detail .seats { font-weight: 600; }
.booking-panel { display: flex; gap: 24px; flex-wrap: wrap; margin-top: 1.5em; }
.booking-option { flex: 1; min-width: 280px; border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.booking-option.alt { background: var(--cream); }
.booking-form { display: flex; flex-direction: column; gap: 12px; margin-top: 1em; }
.booking-form label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 0.9rem; }
.booking-form input, .admin-form input, .admin-form select { padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px; font-size: 1rem; }
.notice { padding: 10px 14px; border-radius: 6px; background: var(--cream); }
.notice-error { background: var(--error-bg); color: var(--error-text); }
.notice-success { background: var(--success-bg); color: var(--success-text); }

.booking-result { text-align: center; padding: 60px 0; }

/* Subscribe form (footer) */
.subscribe-form { display: flex; flex-direction: column; gap: 8px; }
.subscribe-form input { padding: 9px 10px; border-radius: 6px; border: 1px solid #3a4a6b; background: #22345a; color: #fff; }
.subscribe-form input::placeholder { color: #9fb0cc; }
.subscribe-form button { padding: 9px; border-radius: 6px; border: none; background: var(--red); color: #fff; font-weight: 600; cursor: pointer; }
.subscribe-form button:hover { background: var(--red-dark); }
.footer-notice { margin-top: 10px; font-size: 0.88rem; padding: 8px 10px; }

/* Footer */
.site-footer { background: var(--navy-dark); color: #cfd6e4; margin-top: 40px; padding: 40px 0 0; }
.footer-inner { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 30px; }
.site-footer h3 { color: #fff; font-size: 1.05rem; margin-top: 0; }
.site-footer a { color: #cfd6e4; }
.footer-bottom { border-top: 1px solid #2a3a5c; margin-top: 30px; padding: 16px 20px; font-size: 0.85rem; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.footer-bottom .staff-link { color: #7c8bab; }

/* Admin console */
.admin-shell { background: var(--navy-dark); color: #fff; padding: 14px 0; }
.admin-shell .container { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.admin-nav { display: flex; gap: 16px; flex-wrap: wrap; }
.admin-nav a { color: #dfe4ee; font-weight: 600; }
.admin-nav a.active { color: #fff; border-bottom: 2px solid var(--red); padding-bottom: 2px; }
.admin-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin: 1em 0 2em; padding: 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--cream); }
.admin-form label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 0.85rem; }
.admin-form .actions { display: flex; gap: 10px; }
.dashboard-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin: 1.5em 0; }
.dashboard-tile { border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; text-align: center; }
.dashboard-tile .num { font-size: 2rem; font-weight: 700; color: var(--navy); display: block; }
.row-actions { display: flex; gap: 8px; align-items: center; }
.row-actions select { padding: 4px 6px; border-radius: 4px; border: 1px solid var(--border); }
.row-actions button, .icon-button { padding: 4px 10px; font-size: 0.85rem; border-radius: 4px; border: 1px solid var(--border); background: #fff; cursor: pointer; }
.icon-button.danger { color: var(--error-text); border-color: var(--error-text); }

/* Admin table */
.admin-table { width: 100%; border-collapse: collapse; margin: 1em 0 2em; }
.admin-table th, .admin-table td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; font-size: 0.9rem; }
.admin-table th { background: var(--cream); }
.status { padding: 2px 8px; border-radius: 10px; font-size: 0.8rem; font-weight: 600; }
.status-paid { background: var(--success-bg); color: var(--success-text); }
.status-pending { background: #fff4d6; color: #8a6d1a; }
.status-cancelled, .status-failed { background: var(--error-bg); color: var(--error-text); }

@media (max-width: 640px) {
  .occurrence-row a { grid-template-columns: 70px 1fr; grid-template-rows: auto auto; }
  .occ-location, .occ-seats { grid-column: 2; }
}
