/* GolfCal — design tokens */
:root {
  /* Warm neutrals */
  --bg: oklch(98% 0.004 90);
  --bg-elev: oklch(99.5% 0.003 90);
  --surface: oklch(100% 0 0);
  --ink: oklch(18% 0.01 90);
  --ink-2: oklch(38% 0.01 90);
  --ink-3: oklch(58% 0.01 90);
  --ink-4: oklch(78% 0.008 90);
  --hairline: oklch(92% 0.005 90);
  --hairline-strong: oklch(86% 0.006 90);

  /* Accent — fairway green (customizable) */
  --accent-h: 150;
  --accent: oklch(55% 0.09 var(--accent-h));
  --accent-soft: oklch(94% 0.035 var(--accent-h));
  --accent-ink: oklch(32% 0.07 var(--accent-h));

  /* Semantic */
  --warn: oklch(70% 0.13 70);
  --warn-soft: oklch(96% 0.04 80);
  --danger: oklch(58% 0.18 25);
  --danger-soft: oklch(95% 0.04 25);
  --info: oklch(58% 0.10 240);
  --info-soft: oklch(95% 0.03 240);
  --success: oklch(55% 0.09 150);
  --success-soft: oklch(94% 0.035 150);

  /* Score colors — paper scorecard convention */
  --score-eagle: #D68C3C;       /* amber/orange - under par by 2+ */
  --score-birdie: #C74242;      /* red - under par by 1 */
  --score-par: #d1d5db;         /* neutral gray - at par */
  --score-bogey: #4A7CC4;       /* blue - over par by 1 */
  --score-double: #8B4AC4;      /* purple - over par by 2 */
  --score-triple: #6B2DA4;      /* deep purple - over par by 3+ */
  /* Soft/pastel versions for backgrounds */
  --score-eagle-soft: oklch(94% 0.08 75);
  --score-birdie-soft: oklch(94% 0.06 27);
  --score-par-soft: transparent;
  --score-bogey-soft: oklch(94% 0.05 248);
  --score-double-soft: oklch(94% 0.05 305);
  --score-triple-soft: oklch(91% 0.06 305);
  /* Delta chip colors */
  --delta-good: oklch(45% 0.12 155);     /* green - improvement */
  --delta-good-bg: oklch(94% 0.04 155);
  --delta-bad: oklch(50% 0.16 25);       /* red - regression */
  --delta-bad-bg: oklch(95% 0.04 30);

  /* Shape */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 26px;
  --r-pill: 999px;

  /* Shadow */
  --sh-1: 0 1px 2px rgba(10, 10, 10, 0.04), 0 0 0 0.5px rgba(10, 10, 10, 0.04);
  --sh-2: 0 6px 24px rgba(10, 10, 10, 0.06), 0 1px 2px rgba(10, 10, 10, 0.04);
  --sh-3: 0 24px 60px rgba(10, 10, 10, 0.10), 0 2px 6px rgba(10, 10, 10, 0.05);

  /* Density */
  --pad-sm: 14px;
  --pad-md: 20px;
  --pad-lg: 28px;
  --gap: 16px;

  /* Type */
  --font-ui: -apple-system, "SF Pro Text", "SF Pro Display", system-ui, Helvetica, Arial, sans-serif;
  --font-display: ui-serif, "New York", "Times New Roman", serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

[data-theme="dark"] {
  --bg: oklch(18% 0.008 260);
  --bg-elev: oklch(22% 0.01 260);
  --surface: oklch(24% 0.01 260);
  --ink: oklch(96% 0.005 90);
  --ink-2: oklch(80% 0.008 90);
  --ink-3: oklch(62% 0.008 90);
  --ink-4: oklch(42% 0.008 90);
  --hairline: oklch(30% 0.008 260);
  --hairline-strong: oklch(36% 0.01 260);
  --accent: oklch(72% 0.11 var(--accent-h));
  --accent-soft: oklch(30% 0.05 var(--accent-h));
  --accent-ink: oklch(86% 0.08 var(--accent-h));
  --warn-soft: oklch(32% 0.05 80);
  --danger-soft: oklch(30% 0.06 25);
  --info-soft: oklch(30% 0.05 240);
  --success-soft: oklch(30% 0.05 150);
  --sh-1: 0 1px 2px rgba(0,0,0,0.3);
  --sh-2: 0 6px 24px rgba(0,0,0,0.4);
  --sh-3: 0 24px 60px rgba(0,0,0,0.5);
  /* Score colors - slightly lighter in dark mode for visibility */
  --score-eagle: #E4A155;
  --score-birdie: #D45858;
  --score-par: #6b7280;
  --score-bogey: #5A8CD4;
  --score-double: #9B5AD4;
  --score-triple: #7B3DB4;
  --score-eagle-soft: oklch(32% 0.08 75);
  --score-birdie-soft: oklch(32% 0.06 27);
  --score-par-soft: oklch(26% 0.01 260);
  --score-bogey-soft: oklch(32% 0.05 248);
  --score-double-soft: oklch(32% 0.05 305);
  --score-triple-soft: oklch(30% 0.06 305);
  --delta-good-bg: oklch(30% 0.05 155);
  --delta-bad-bg: oklch(30% 0.05 30);
}

[data-density="compact"] {
  --pad-sm: 10px;
  --pad-md: 14px;
  --pad-lg: 20px;
  --gap: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01", "cv11";
  letter-spacing: -0.005em;
}
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; color: inherit; }

/* scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: var(--hairline-strong);
  border-radius: 999px;
  border: 3px solid var(--bg);
}
::-webkit-scrollbar-track { background: transparent; }

/* Common component classes */
.card {
  background: var(--surface);
  border: 0.5px solid var(--hairline);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
}

.hairline {
  border-bottom: 0.5px solid var(--hairline);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  background: var(--hairline);
  color: var(--ink-2);
}
.pill.accent { background: var(--accent-soft); color: var(--accent-ink); }
.pill.warn { background: var(--warn-soft); color: oklch(40% 0.13 70); }
.pill.danger { background: var(--danger-soft); color: var(--danger); }
.pill.info { background: var(--info-soft); color: var(--info); }
.pill.success { background: var(--success-soft); color: var(--success); }

/* Compact club abbreviation chip used in event/score lists. */
.club-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--hairline);
  color: var(--ink-2);
  letter-spacing: 0.04em;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  border: 0.5px solid transparent;
  transition: background 120ms ease, transform 80ms ease;
  background: var(--surface);
  color: var(--ink);
  border-color: var(--hairline-strong);
}
.btn:hover {
  background: var(--hairline);
}
.btn:active {
  transform: scale(0.98);
}
.btn.primary {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
.btn.primary:hover {
  background: oklch(28% 0.02 90);
}
.btn.accent {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.btn.accent:hover {
  background: oklch(from var(--accent) calc(l - 0.05) c h);
}
.btn.ghost {
  background: transparent;
  border-color: transparent;
}
.btn.sm {
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 8px;
}
.btn.lg {
  padding: 14px 20px;
  font-size: 15px;
  border-radius: 14px;
}

.mono {
  font-family: var(--font-mono);
}

.display {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}
.fade-in {
  animation: fadeIn 220ms ease both;
}

@keyframes sheetIn {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.sheet-anim {
  animation: sheetIn 280ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Image placeholders with subtle stripes */
.stripe-ph {
  background:
    repeating-linear-gradient(135deg,
      oklch(90% 0.02 var(--accent-h)) 0 12px,
      oklch(94% 0.015 var(--accent-h)) 12px 24px);
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-md);
}

/* Form inputs */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
input[type="tel"],
input[type="search"],
select,
textarea {
  border: 0.5px solid var(--hairline-strong);
  border-radius: var(--r-md);
  background: var(--bg);
  padding: 10px 12px;
  font-size: 14px;
  transition: border-color 120ms ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

input::placeholder,
textarea::placeholder {
  color: var(--ink-3);
}

label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
  margin-bottom: 6px;
}

/* Section labels (e.g., "ROUND", "COURSE", "DATE") */
.section-label {
  font-size: 11px;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 500;
}

/* Tabs Component */
.tabs {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  background: var(--hairline);
  border-radius: 12px;
}

.tabs .tab {
  padding: 8px 16px;
  border-radius: 9px;
  border: 0;
  background: transparent;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 120ms ease;
}

.tabs .tab:hover:not(.active) {
  background: rgba(0, 0, 0, 0.05);
}

.tabs .tab.active {
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  box-shadow: var(--sh-1);
}

.tabs .tab-count {
  font-size: 11px;
  color: var(--ink-3);
  font-weight: 500;
}

/* Detail Panel (slide-out from right) */
.detail-panel {
  position: fixed;
  top: 0;
  right: -500px;
  width: 500px;
  max-width: 100vw;
  height: 100vh;
  background: var(--surface);
  box-shadow: var(--sh-3);
  z-index: 1000;
  transition: right 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  overflow-y: auto;
}

.detail-panel.open {
  right: 0;
}

.detail-panel-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 999;
}

.detail-panel-backdrop.show {
  display: block;
}

/* Modal Wizard */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop.show {
  display: flex;
}

.modal {
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-3);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  animation: fadeIn 220ms ease both;
}

.modal-header {
  padding: 32px 32px 24px;
  border-bottom: 0.5px solid var(--hairline);
}

.modal-step {
  font-size: 11px;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
  font-weight: 500;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--ink);
}

.modal-close {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--ink-2);
  transition: all 120ms ease;
}

.modal-close:hover {
  background: var(--hairline);
  color: var(--ink);
}

.modal-body {
  padding: 24px 32px;
}

.modal-footer {
  padding: 20px 32px;
  border-top: 0.5px solid var(--hairline);
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

/* Selection List (for modal wizards) */
.selection-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.selection-item {
  padding: 16px;
  border-radius: var(--r-md);
  border: 1.5px solid var(--hairline);
  background: var(--surface);
  cursor: pointer;
  transition: all 120ms ease;
  display: flex;
  align-items: center;
  gap: 12px;
}

.selection-item:hover {
  border-color: var(--hairline-strong);
  background: var(--bg);
}

.selection-item.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.selection-item .check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--hairline-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
}

.selection-item.selected .check {
  background: var(--accent);
  border-color: var(--accent);
}

.selection-item-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  background: var(--hairline);
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 600;
  border-radius: 6px;
  letter-spacing: 0.02em;
}

.selection-item-content {
  flex: 1;
  min-width: 0;
}

.selection-item-title {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 4px;
}

.selection-item-meta {
  font-size: 13px;
  color: var(--ink-2);
}

/* Time Slot Grid */
.time-slot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
  max-height: 400px;
  overflow-y: auto;
  padding: 4px;
}

.time-slot {
  padding: 12px 8px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--hairline);
  background: var(--surface);
  cursor: pointer;
  transition: all 120ms ease;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  position: relative;
}

.time-slot:hover:not(.disabled) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.time-slot.selected {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.time-slot.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: var(--hairline);
}

.time-slot-indicator {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.time-slot-indicator.available {
  background: var(--success);
}

.time-slot-indicator.limited {
  background: var(--warn);
}

.time-slot-indicator.full {
  background: var(--danger);
}

/* Theme toggle button */
.theme-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 999;
  background: var(--surface);
  border: 0.5px solid var(--hairline-strong);
  border-radius: var(--r-pill);
  padding: 8px 12px;
  font-size: 12px;
  box-shadow: var(--sh-2);
  display: flex;
  align-items: center;
  gap: 6px;
}
