/* ============================================
   BAC Theme — Visual Redesign
   ============================================ */

/* Section 1: Root variables */
:root {
  --bac-navy: #1A1F2E;
  --bac-navy-mid: #2A3147;
  --bac-navy-light: #3D4560;
  --bac-gold: #E8B84B;
  --bac-gold-pale: #FDF3D9;
  --bac-gold-mid: #C9961A;
  --bac-white: #FFFFFF;
  --bac-offwhite: #F7F8FA;
  --bac-border: rgba(26, 31, 46, 0.10);
  --bac-border-strong: rgba(26, 31, 46, 0.20);
  --bac-muted: #6B7280;
  --bac-text: #1A1F2E;
  --bac-success-bg: #EBF5EB;
  --bac-success: #2D7A2D;
  --bac-danger-bg: #FEF0F0;
  --bac-danger: #C0392B;
  --bac-warn-bg: #FEF8EC;
  --bac-warn: #B8860B;
  --bac-radius: 10px;
  --bac-radius-lg: 14px;
}

/* Section 2: Typography */
body, input, select, textarea, button {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

/* Section 3: Global base */
body {
  background: var(--bac-offwhite);
  color: var(--bac-text);
}
* {
  box-sizing: border-box;
}

/* Section 4: PIN screen */
#pin-screen {
  background: linear-gradient(160deg, var(--bac-navy) 0%, var(--bac-navy-mid) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  color: var(--bac-white);
}
#pin-screen h1 {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 6px;
}
#pin-screen .subtitle {
  font-size: 14px;
  opacity: 0.7;
  margin-bottom: 28px;
}
#pin-screen input[type="password"],
#pin-screen input[type="text"] {
  width: 220px;
  text-align: center;
  font-size: 28px;
  letter-spacing: 8px;
  padding: 14px;
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: var(--bac-radius);
  background: rgba(255,255,255,0.08);
  color: var(--bac-white);
  outline: none;
  transition: border-color 0.2s;
}
#pin-screen input:focus {
  border-color: var(--bac-gold);
}
#pin-screen button {
  margin-top: 18px;
  padding: 14px 48px;
  font-size: 16px;
  font-weight: 700;
  border: none;
  border-radius: var(--bac-radius);
  background: var(--bac-gold);
  color: var(--bac-navy);
  cursor: pointer;
  transition: background 0.15s;
}
#pin-screen button:hover {
  background: var(--bac-gold-mid);
}
#pin-screen .pin-error {
  color: #FF6B6B;
  font-size: 14px;
  margin-top: 12px;
  min-height: 20px;
}

/* Section 5: App header / top bar */
.header {
  background: linear-gradient(135deg, var(--bac-navy), var(--bac-navy-mid));
  color: var(--bac-white);
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 12px rgba(26, 31, 46, 0.15);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header h1 {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.01em;
}
.header .subtitle {
  font-size: 13px;
  opacity: 0.75;
}
.header .logo-area {
  display: flex;
  align-items: center;
  gap: 14px;
}
.header .logo-area img {
  height: 44px;
  width: 44px;
  object-fit: contain;
  border-radius: 8px;
  background: white;
  padding: 3px;
}
.status {
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.12);
  font-weight: 700;
}
.status.ok {
  background: rgba(45, 122, 45, 0.45);
}
.status.err {
  background: rgba(192, 57, 43, 0.45);
}

/* Section 6: Navigation tabs */
.nav {
  background: var(--bac-white);
  border-bottom: 1px solid var(--bac-border);
  display: flex;
  gap: 4px;
  padding: 8px 12px;
  overflow-x: auto;
  position: sticky;
  top: 68px;
  z-index: 99;
}
.nav button {
  background: none;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 700;
  color: var(--bac-muted);
  cursor: pointer;
  white-space: nowrap;
  min-height: 44px;
  transition: all 0.15s;
}
.nav button:hover {
  color: var(--bac-navy);
  background: var(--bac-offwhite);
}
.nav button.active {
  color: var(--bac-navy);
  border-color: var(--bac-border-strong);
  background: var(--bac-white);
  box-shadow: 0 2px 8px rgba(26, 31, 46, 0.06);
}

/* Section 7: Section headers */
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.section-head h2 {
  font-size: 18px;
  font-weight: 800;
  color: var(--bac-navy);
}
.section-head .badge {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bac-gold-pale);
  color: var(--bac-gold-mid);
  font-weight: 700;
}

/* Section 8: Cards and content panels */
.card, .panel {
  background: var(--bac-white);
  border: 1px solid var(--bac-border);
  border-radius: var(--bac-radius-lg);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(26, 31, 46, 0.04);
}
.card h2, .panel h2 {
  font-size: 17px;
  font-weight: 800;
  color: var(--bac-navy);
  margin-bottom: 12px;
}
.card h3, .panel h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--bac-navy);
  margin-bottom: 8px;
}

/* Section 9: Buttons */
.btn, button.primary, .btn-primary {
  background: var(--bac-navy);
  color: var(--bac-white);
  border: none;
  border-radius: var(--bac-radius);
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 48px;
  transition: background 0.15s;
}
.btn:hover, button.primary:hover, .btn-primary:hover {
  background: var(--bac-navy-mid);
}
.btn-accent, button.accent {
  background: var(--bac-gold);
  color: var(--bac-navy);
}
.btn-accent:hover, button.accent:hover {
  background: var(--bac-gold-mid);
}
.btn-secondary, button.secondary, .btn.secondary {
  background: var(--bac-white);
  color: var(--bac-navy);
  border: 1px solid var(--bac-border-strong);
}
.btn-secondary:hover, button.secondary:hover, .btn.secondary:hover {
  background: var(--bac-offwhite);
}
.btn-danger, button.danger {
  background: var(--bac-danger);
  color: var(--bac-white);
}
.btn-danger:hover, button.danger:hover {
  background: #A93226;
}

/* Section 10: Form inputs */
input, select, textarea {
  width: 100%;
  padding: 12px 14px;
  font-size: 15px;
  border: 1px solid var(--bac-border-strong);
  border-radius: var(--bac-radius);
  background: var(--bac-white);
  color: var(--bac-text);
  min-height: 48px;
  transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--bac-gold);
  box-shadow: 0 0 0 3px rgba(232, 184, 75, 0.15);
}
label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--bac-muted);
  margin-bottom: 6px;
}

/* Section 11: Tables */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--bac-border);
  border-radius: var(--bac-radius-lg);
}
table {
  width: 100%;
  border-collapse: collapse;
}
th {
  background: var(--bac-offwhite);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--bac-muted);
  padding: 10px 14px;
  text-align: left;
  border-bottom: 2px solid var(--bac-border);
}
td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--bac-border);
  font-size: 14px;
  vertical-align: top;
}
tr:last-child td {
  border-bottom: none;
}
tr:hover td {
  background: rgba(232, 184, 75, 0.04);
}

/* Section 12: Status badges and tags */
.badge, .tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
}
.badge-success, .tag-success {
  background: var(--bac-success-bg);
  color: var(--bac-success);
}
.badge-danger, .tag-danger {
  background: var(--bac-danger-bg);
  color: var(--bac-danger);
}
.badge-warn, .tag-warn {
  background: var(--bac-warn-bg);
  color: var(--bac-warn);
}
.badge-gold, .tag-gold {
  background: var(--bac-gold-pale);
  color: var(--bac-gold-mid);
}
.badge-muted, .tag-muted {
  background: var(--bac-offwhite);
  color: var(--bac-muted);
}

/* Section 13: Modals and overlays */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(26, 31, 46, 0.50);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal {
  background: var(--bac-white);
  border-radius: var(--bac-radius-lg);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(26, 31, 46, 0.25);
}
.modal-header {
  background: var(--bac-navy);
  color: var(--bac-white);
  padding: 16px 20px;
  border-radius: var(--bac-radius-lg) var(--bac-radius-lg) 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-header h2 {
  font-size: 17px;
  font-weight: 800;
  color: var(--bac-white);
  margin: 0;
}
.modal-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 22px;
  cursor: pointer;
  padding: 4px 8px;
  min-width: 40px;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-close:hover {
  color: var(--bac-white);
}
.modal-body {
  padding: 20px;
}

/* Section 14: Alert / info strips */
.alert, .info-strip {
  padding: 12px 16px;
  border-radius: var(--bac-radius);
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.alert-success, .info-strip.success {
  background: var(--bac-success-bg);
  color: var(--bac-success);
}
.alert-danger, .info-strip.danger {
  background: var(--bac-danger-bg);
  color: var(--bac-danger);
}
.alert-warn, .info-strip.warn {
  background: var(--bac-warn-bg);
  color: var(--bac-warn);
}
.alert-info, .info-strip.info {
  background: var(--bac-gold-pale);
  color: var(--bac-gold-mid);
}

/* Section 15: Distance filter tabs */
.dist-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.dist-tabs button {
  padding: 8px 16px;
  border: 1px solid var(--bac-border-strong);
  border-radius: 999px;
  background: var(--bac-white);
  color: var(--bac-muted);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  min-height: 40px;
  transition: all 0.15s;
}
.dist-tabs button:hover {
  border-color: var(--bac-navy-light);
  color: var(--bac-navy);
}
.dist-tabs button.active {
  background: var(--bac-navy);
  color: var(--bac-white);
  border-color: var(--bac-navy);
}

/* Section 16: Mobile responsive overrides */
@media (max-width: 768px) {
  .header {
    padding: 10px 14px;
  }
  .header h1 {
    font-size: 17px;
  }
  .nav {
    padding: 6px 8px;
    gap: 2px;
  }
  .nav button {
    padding: 8px 12px;
    font-size: 13px;
  }
  .card, .panel {
    padding: 16px;
    border-radius: var(--bac-radius);
    margin-bottom: 10px;
  }
  .btn, button.primary, .btn-primary {
    width: 100%;
    padding: 14px 20px;
  }
  .modal {
    max-width: 100%;
    margin: 10px;
    border-radius: var(--bac-radius);
  }
  .modal-header {
    border-radius: var(--bac-radius) var(--bac-radius) 0 0;
  }
  table {
    font-size: 13px;
  }
  th, td {
    padding: 8px 10px;
  }
}

/* Section 17: Stopwatch page specific */
.clock {
  font-family: 'Courier New', monospace;
  font-size: 64px;
  font-weight: 700;
  color: var(--bac-white);
  letter-spacing: 2px;
}
.split-list {
  background: var(--bac-white);
  border-radius: var(--bac-radius);
  overflow-y: auto;
}
.split-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--bac-border);
  font-size: 14px;
}
.split-item:last-child {
  border-bottom: none;
}
.split-item .position {
  font-weight: 800;
  color: var(--bac-navy);
  min-width: 32px;
}
.split-item .time {
  font-family: 'Courier New', monospace;
  font-weight: 700;
  color: var(--bac-navy);
}

/* Section 18: Volunteer portal specific */
.volunteer-card {
  background: var(--bac-white);
  border: 1px solid var(--bac-border);
  border-radius: var(--bac-radius-lg);
  padding: 22px;
  box-shadow: 0 4px 16px rgba(26, 31, 46, 0.05);
}
.volunteer-card h1 {
  font-size: 24px;
  font-weight: 800;
  color: var(--bac-navy);
}
.role-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}
.role {
  background: var(--bac-gold-pale);
  border: 1px solid rgba(232, 184, 75, 0.2);
  border-radius: var(--bac-radius);
  padding: 14px;
}
.role h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--bac-navy);
  margin-bottom: 4px;
}
.role p {
  font-size: 13px;
  color: var(--bac-muted);
  margin: 0;
}

/* ============================================================
   BAC THEME — TARGETED FIXES
   Based on actual HTML inspection of bac-handicap.vercel.app
   High specificity selectors used deliberately to win cascade
   ============================================================ */

/* ── BODY BACKGROUND ───────────────────────────────────────── */
body {
  background: #F7F8FA !important;
}

/* ── HEADER (div.header) ────────────────────────────────────── */
div.header {
  background: #1A1F2E !important;
  border-bottom: 3px solid #E8B84B !important;
  padding-bottom: 0 !important;
}

div.header h1,
div.header h2,
div.header .club-name,
div.header span {
  color: #ffffff !important;
}

div.header p,
div.header .subtitle {
  color: rgba(255,255,255,0.5) !important;
}

div.header img {
  border-radius: 8px;
}

/* ── NAV (div.nav > button) ─────────────────────────────────── */
div.nav {
  background: #1A1F2E !important;
  border-bottom: none !important;
  display: flex !important;
  overflow-x: auto !important;
  scrollbar-width: none !important;
  padding: 0 8px !important;
  gap: 0 !important;
  position: sticky !important;
  top: 0 !important;
  z-index: 99 !important;
  backdrop-filter: none !important;
  border-top: 1px solid rgba(255,255,255,0.08) !important;
}

div.nav::-webkit-scrollbar {
  display: none;
}

div.nav button {
  background: transparent !important;
  border: none !important;
  border-bottom: 3px solid transparent !important;
  border-radius: 0 !important;
  color: rgba(255,255,255,0.45) !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  padding: 12px 14px !important;
  cursor: pointer !important;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  transition: color 0.15s, border-color 0.15s !important;
  min-height: auto !important;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
}

div.nav button:hover {
  color: rgba(255,255,255,0.8) !important;
  background: rgba(255,255,255,0.05) !important;
}

div.nav button.active {
  color: #E8B84B !important;
  border-bottom-color: #E8B84B !important;
  font-weight: 700 !important;
  background: transparent !important;
}

/* ── BOTTOM NAV (mobile) ────────────────────────────────────── */
div.bottom-nav {
  background: #ffffff !important;
  border-top: 1px solid rgba(26,31,46,0.1) !important;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.06) !important;
}

div.bottom-nav button {
  color: #6B7280 !important;
  background: transparent !important;
  border: none !important;
}

div.bottom-nav button.active {
  color: #1A1F2E !important;
}

/* ── PANELS (div.panel) ─────────────────────────────────────── */
div.panel {
  background: #F7F8FA !important;
}

div.panel h2 {
  font-size: 17px !important;
  font-weight: 700 !important;
  color: #1A1F2E !important;
}

div.panel h3 {
  font-size: 14px !important;
  font-weight: 700 !important;
  color: #1A1F2E !important;
}

/* ── QUICK ACTION BUTTONS ───────────────────────────────────── */
div.panel button[onclick*="showPanel('entry')"] {
  background: #1A1F2E !important;
  color: #ffffff !important;
  border: none !important;
  border-radius: 8px !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  padding: 11px 16px !important;
  cursor: pointer !important;
}

div.panel button[onclick*="showPanel('results')"],
div.panel button[onclick*="showPanel('standings')"],
div.panel button[onclick*="showPanel('handicaps')"],
div.panel button[onclick*="showPanel('runners')"] {
  background: #ffffff !important;
  color: #1A1F2E !important;
  border: 1.5px solid rgba(26,31,46,0.18) !important;
  border-radius: 8px !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  padding: 11px 16px !important;
  cursor: pointer !important;
}

/* ── REVIEW RESULTS BUTTON ──────────────────────────────────── */
button#reviewBtn,
button[onclick*="reviewResults"],
button[onclick*="openReview"] {
  background: #E8B84B !important;
  color: #1A1F2E !important;
  border: none !important;
  border-radius: 10px !important;
  font-weight: 800 !important;
  font-size: 15px !important;
  padding: 14px 20px !important;
  cursor: pointer !important;
  width: 100% !important;
}

/* ── FAB (floating add row button) ─────────────────────────── */
button.fab-add,
button#fabAddRow {
  background: #1A1F2E !important;
  color: #ffffff !important;
  border: none !important;
  box-shadow: 0 4px 16px rgba(26,31,46,0.3) !important;
}

/* ── TIMESHEET TABLE INPUTS ─────────────────────────────────── */
#timesheetBody td input,
#timesheetTable td input {
  border: 1px solid rgba(26,31,46,0.18) !important;
  border-radius: 6px !important;
  font-size: 14px !important;
  padding: 6px 8px !important;
  background: #ffffff !important;
  font-variant-numeric: tabular-nums !important;
  min-height: 36px !important;
}

#timesheetBody td input:focus,
#timesheetTable td input:focus {
  border-color: #1A1F2E !important;
  outline: none !important;
  box-shadow: 0 0 0 3px rgba(26,31,46,0.08) !important;
}

/* ── TABLES ─────────────────────────────────────────────────── */
table thead th {
  font-size: 10px !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.6px !important;
  color: #6B7280 !important;
  padding: 10px 12px !important;
  border-bottom: 1px solid rgba(26,31,46,0.1) !important;
  background: #F7F8FA !important;
}

table tbody td {
  padding: 10px 12px !important;
  border-bottom: 1px solid rgba(26,31,46,0.07) !important;
  font-size: 13px !important;
  color: #1A1F2E !important;
  vertical-align: middle !important;
}

table tbody tr:hover {
  background: #F7F8FA !important;
}

table tbody tr:last-child td {
  border-bottom: none !important;
}

/* ── FORM INPUTS ────────────────────────────────────────────── */
input[type="text"],
input[type="number"],
input[type="password"],
input[type="date"],
input[type="tel"],
select,
textarea {
  border: 1px solid rgba(26,31,46,0.2) !important;
  border-radius: 8px !important;
  padding: 10px 12px !important;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
  color: #1A1F2E !important;
  background: #ffffff !important;
  outline: none !important;
  -webkit-appearance: none !important;
  appearance: none !important;
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
  border-color: #1A1F2E !important;
  box-shadow: 0 0 0 3px rgba(26,31,46,0.08) !important;
}

@media (max-width: 768px) {
  input[type="text"],
  input[type="number"],
  input[type="password"],
  select,
  textarea {
    font-size: 16px !important;
  }
}

/* ── TEST MODE BANNER ───────────────────────────────────────── */
div#testModeBanner {
  background: #FEF8EC !important;
  color: #B8860B !important;
  border-bottom: 2px solid #E8B84B !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  text-align: center !important;
  padding: 8px 16px !important;
}

/* ── CONFIRM/CANCEL BUTTONS ─────────────────────────────────── */
button[onclick*="cancel"],
button[onclick*="Cancel"] {
  background: #ffffff !important;
  color: #1A1F2E !important;
  border: 1.5px solid rgba(26,31,46,0.2) !important;
  border-radius: 8px !important;
  font-weight: 600 !important;
}

button[onclick*="save"],
button[onclick*="Save"],
button#confirmSaveBtn {
  background: #1A1F2E !important;
  color: #ffffff !important;
  border: none !important;
  border-radius: 8px !important;
  font-weight: 700 !important;
}

/* ── FILTER TABS (All / 1K / 3K / 6K) ──────────────────────── */
button.filter-btn {
  border-radius: 20px !important;
  border: 1px solid rgba(26,31,46,0.2) !important;
  background: #ffffff !important;
  color: #6B7280 !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  padding: 5px 14px !important;
}

button.filter-btn.active {
  background: #1A1F2E !important;
  border-color: #1A1F2E !important;
  color: #ffffff !important;
}

/* ── STOPWATCH LAP BUTTON ───────────────────────────────────── */
button#lapBtn,
button.lap-btn {
  background: #E8B84B !important;
  color: #1A1F2E !important;
  border: none !important;
  border-radius: 50% !important;
  width: 120px !important;
  height: 120px !important;
  font-size: 20px !important;
  font-weight: 800 !important;
  -webkit-tap-highlight-color: transparent !important;
  touch-action: manipulation !important;
}
