/* ── Shared variables ─────────────────────────────────────── */
:root {
  --bg: #0a0a0a;
  --bg-secondary: #121212;
  --card: #161616;
  --card-edge: #2a2a2a;
  --text: #f8f8f8;
  --muted: #b0b0b0;
  --accent: #ff6b7a;
  --accent-2: #ff8a94;
  --shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  overflow-x: hidden;
}

body {
  font-family: "Work Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}

/* ── Navbar ─────────────────────────────────────────────── */
.navbar {
  background: rgba(10, 10, 10, 0.95);
  backdrop-filter: blur(20px);
  padding: 16px 0;
  position: sticky;
  top: 0;
  z-index: 1000;
  border-bottom: 1px solid rgba(255, 107, 122, 0.2);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  overflow: visible;
}

.nav-content {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  max-width: 100%;
  overflow: visible;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo img {
  height: 50px;
  width: auto;
  object-fit: contain;
}

.nav-tabs {
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: center;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  justify-content: flex-end;
}

.nav-tab {
  background: none;
  border: none;
  padding: 10px 20px;
  font-family: "Work Sans", sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.3s;
  text-decoration: none;
}

.nav-tab:hover { color: var(--accent); }

.nav-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.nav-sign-in-btn {
  background: none;
  border: 1px solid rgba(255, 107, 122, 0.4);
  padding: 8px 18px;
  border-radius: 50px;
  font-family: "Work Sans", sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--accent);
  cursor: pointer;
  transition: all 0.3s;
}

.nav-sign-in-btn:hover {
  background: rgba(255, 107, 122, 0.1);
  border-color: var(--accent);
}

.nav-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Work Sans", sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  overflow: hidden;
  cursor: pointer;
}

.nav-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.nav-user-profile { position: relative; }

.nav-profile-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--card);
  border: 1px solid var(--card-edge);
  border-radius: 12px;
  min-width: 280px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  z-index: 1001;
  overflow: hidden;
}

.nav-profile-dropdown.open {
  display: block;
}

.nav-profile-info {
  padding: 16px;
  border-bottom: 1px solid var(--card-edge);
}

.nav-profile-name {
  font-weight: 600;
  color: var(--text);
  font-size: 14px;
  margin-bottom: 2px;
}

.nav-profile-email {
  font-size: 12px;
  color: var(--muted);
}

.nav-profile-action-btn {
  width: 100%;
  padding: 12px 16px;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text);
  font-family: "Work Sans", sans-serif;
  font-size: 14px;
  transition: background 0.2s;
}

.nav-profile-action-btn:hover {
  background: rgba(255, 255, 255, 0.05);
}

.nav-profile-signout-btn {
  border-top: 1px solid var(--card-edge);
}

/* ── Page layout ─────────────────────────────────────────── */
.history-page-main {
  min-height: calc(100vh - 83px);
  display: flex;
  flex-direction: column;
}

/* ── Sign-in gate ────────────────────────────────────────── */
.history-sign-in-gate {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
}

.history-gate-inner {
  text-align: center;
  max-width: 360px;
}

.history-gate-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
  letter-spacing: 0.5px;
}

.history-gate-subtitle {
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 24px;
}

.google-sign-in-btn {
  background: #fff;
  color: #333;
  border: none;
  padding: 12px 24px;
  border-radius: 6px;
  font-family: "Work Sans", sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.google-sign-in-btn:hover { background: #f0f0f0; }
.google-sign-in-btn:disabled { opacity: 0.6; cursor: default; }

.player-details-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 199;
}

.player-details-panel {
  position: fixed;
  top: 70px;
  right: 0;
  width: 340px;
  height: calc(100% - 70px);
  background: #1A1A1F;
  z-index: 200;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.4);
  overflow-y: auto;
  border-radius: 0 0 0 12px;
}

.player-details-panel-header {
  padding: 20px 24px;
  border-bottom: 1px solid #2A2A30;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  background: #1A1A1F;
  z-index: 1;
}

.player-details-panel-title {
  margin: 0;
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 1px;
}

.player-details-panel-subtitle {
  margin: 4px 0 0;
  color: #5A5A64;
  font-size: 12px;
}

.player-details-panel-close {
  background: none;
  border: none;
  color: #5A5A64;
  font-size: 26px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}

.player-details-panel-body {
  padding: 28px 24px;
}

.player-details-stack {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.player-details-label {
  display: block;
  color: #8B8B96;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 8px;
  font-weight: 600;
}

.player-details-row {
  display: flex;
  gap: 10px;
}

.player-details-input,
.player-details-select {
  width: 100%;
  padding: 12px 14px;
  background: #2A2A30;
  border: 1px solid #3A3A42;
  border-radius: 8px;
  color: #fff;
  font-size: 15px;
  font-family: "Work Sans", sans-serif;
  outline: none;
  box-sizing: border-box;
}

.player-details-input:focus,
.player-details-select:focus {
  border-color: var(--accent);
}

.player-details-hand-btn {
  flex: 1;
  padding: 12px 14px;
  background: #2A2A30;
  border: 1px solid #3A3A42;
  border-radius: 8px;
  color: #8B8B96;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}

.player-details-hand-btn.active {
  border-color: var(--accent);
  background: rgba(255, 107, 122, 0.15);
  color: #fff;
}

.player-details-save-btn {
  width: 100%;
  border: none;
  border-radius: 8px;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  font-family: "Work Sans", sans-serif;
  cursor: pointer;
}

.player-details-saved-msg {
  margin: -8px 0 0;
  text-align: center;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
}

/* ── History View ────────────────────────────────────────── */
:root {
  --hr-red: #c8312a;
  --hr-red-dim: rgba(200,49,42,0.08);
  --hr-green: #5a9e72;
  --hr-amber: #c8a22a;
  --hr-blue: #4e88d4;
  --hr-text: #e8e4df;
  --hr-muted: #5a5550;
  --hr-border: #1e1e1e;
}

.history-view { padding: 0; }
.history-view-inner {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 0 40px;
}

.history-stat-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  border-bottom: 1px solid var(--hr-border);
  overflow: hidden;
}
.history-stat-cell {
  padding: 14px 12px;
  border-right: 1px solid var(--hr-border);
}
.history-stat-cell:last-child { border-right: none; }
.history-stat-lbl {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--hr-muted);
  margin-bottom: 6px;
}
.history-stat-val {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  color: var(--hr-text);
}
.history-stat-val.accent { color: var(--hr-red); }
.history-stat-val.good   { color: var(--hr-green); }
.history-stat-delta { font-size: 11px; color: #444; margin-top: 5px; }
.history-stat-delta.up { color: var(--hr-green); }

.history-sub-tabs {
  display: flex;
  border-bottom: 1px solid var(--hr-border);
  margin-bottom: 16px;
}
.history-sub-tab {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 12px 16px;
  color: var(--hr-muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.history-sub-tab:hover { color: var(--hr-text); }
.history-sub-tab.active { color: var(--hr-text); border-bottom-color: var(--hr-red); }

.history-panel { display: block; }
.history-panel[hidden] { display: none; }

.history-filters {
  display: flex;
  gap: 6px;
  padding: 0 12px 12px;
  overflow-x: auto;
  scrollbar-width: none;
}
.history-filters::-webkit-scrollbar { display: none; }
.history-chip {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  background: none;
  border: 1px solid #2a2a2a;
  border-radius: 2px;
  padding: 4px 10px;
  color: var(--hr-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.12s;
}
.history-chip.active {
  border-color: rgba(200,49,42,0.5);
  color: var(--hr-red);
  background: var(--hr-red-dim);
}

.history-status {
  font-size: 14px;
  color: var(--hr-muted);
  text-align: center;
  padding: 24px 0;
}
.history-empty { font-size: 13px; color: var(--hr-muted); text-align: center; padding: 32px 0; }

.history-sessions-list { display: flex; flex-direction: column; gap: 2px; }

.history-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 8px 0;
}
.history-pagination[hidden] { display: none; }
.history-page-btn {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  background: none;
  border: 1px solid #2a2a2a;
  border-radius: 2px;
  padding: 5px 12px;
  color: var(--hr-muted);
  cursor: pointer;
  transition: all 0.12s;
}
.history-page-btn:hover:not(:disabled) { border-color: rgba(200,49,42,0.5); color: var(--hr-red); }
.history-page-btn:disabled { opacity: 0.3; cursor: default; }
.history-page-info {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 12px;
  color: var(--hr-muted);
}

.history-session-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 2px;
  cursor: pointer;
  position: relative;
  transition: background 0.12s, border-color 0.12s;
}
.history-session-item:hover { background: #1c1c1c; border-color: rgba(255,255,255,0.1); }
.history-session-item::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
}
.history-session-item.grade-a::before { background: var(--hr-green); }
.history-session-item.grade-b::before { background: var(--hr-blue); }
.history-session-item.grade-c::before { background: var(--hr-amber); }
.history-session-item.grade-d::before { background: var(--hr-red); }

.history-grade-block {
  width: 38px;
  height: 38px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 18px;
  font-weight: 800;
  flex-shrink: 0;
}
.history-grade-block.a { background: rgba(90,158,114,0.15); color: var(--hr-green); }
.history-grade-block.b { background: rgba(78,136,212,0.15); color: var(--hr-blue); }
.history-grade-block.c { background: rgba(200,162,42,0.15); color: var(--hr-amber); }
.history-grade-block.d { background: rgba(200,49,42,0.15); color: var(--hr-red); }
.history-grade-block.shotsync-grade { background: rgba(59,130,246,0.15); color: #3b82f6; font-size: 14px; }

.history-sess-info { min-width: 0; }
.history-sess-date {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: #d0cdc8;
}
.history-sess-time { font-size: 12px; font-weight: 400; color: #3a3a3a; text-transform: none; letter-spacing: 0; }
.history-sess-meta { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.history-mode-badge {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  background: #1e1e1e;
  border: 1px solid #2a2a2a;
  padding: 2px 5px;
  border-radius: 1px;
}
.history-sess-form { font-size: 11px; color: #3a3a3a; }
.shotsync-badge { background: #3b82f6; color: #fff; border-color: #3b82f6; }

.history-sess-nums { text-align: right; flex-shrink: 0; }
.history-sess-fg {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
}
.history-sess-fg.good { color: var(--hr-green); }
.history-sess-fg.mid  { color: var(--hr-amber); }
.history-sess-fg.bad  { color: var(--hr-red); }
.history-sess-shots { font-size: 10px; color: #444; margin-top: 3px; }

.history-coaching-note {
  background: var(--hr-red-dim);
  border-left: 3px solid var(--hr-red);
  padding: 10px 12px;
  margin: 0 0 16px;
  border-radius: 0 4px 4px 0;
}
.history-coaching-label {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--hr-red);
  margin-bottom: 3px;
}
.history-coaching-text { font-size: 13px; color: #b0aba5; line-height: 1.4; }
.history-coaching-text b { color: var(--hr-text); font-weight: 500; }

.history-charts-wrap { display: flex; flex-direction: column; gap: 14px; margin-bottom: 20px; }
.history-chart-card {
  background: #161616;
  border: 1px solid var(--hr-border);
  border-radius: 4px;
  padding: 14px 16px;
}
.history-chart-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--hr-muted);
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
}
.history-chart-latest { font-size: 18px; font-weight: 800; color: var(--hr-red); }
.history-chart-svg svg { width: 100%; height: 110px; }

.history-check-averages { margin-top: 4px; }
.history-checks-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--hr-muted);
  margin-bottom: 14px;
}
.history-check-row {
  display: grid;
  grid-template-columns: 100px 1fr 36px;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.history-check-label {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--hr-muted);
}
.history-check-bar-track {
  height: 4px;
  background: #1e1e1e;
  border-radius: 1px;
  overflow: hidden;
}
.history-check-bar-fill { height: 100%; border-radius: 1px; transition: width 0.5s ease; }
.history-check-pct {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 13px;
  font-weight: 700;
  text-align: right;
}

/* ── Screen utility ──────────────────────────────────────── */
.screen[hidden] { display: none; }
