/* =====================================================
   scorecard.css — Weekend Birdie scorecard page styles
   ===================================================== */

/* ── PAGE SHELL ─────────────────────────────────── */
.sc-page {
  min-height: 100vh;
  background: var(--cream);
  padding-top: 80px;
}

/* ── AUTH GATE ──────────────────────────────────── */
.auth-gate {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 80px);
  text-align: center;
  padding: 40px 24px;
}
.auth-gate-icon {
  width: 72px; height: 72px;
  background: var(--green-pale);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 24px;
}
.auth-gate-icon svg { width: 32px; height: 32px; }
.auth-gate h2 {
  font-family: 'Playfair Display', serif;
  font-size: 2rem; color: var(--green-deep);
  margin: 0 0 12px;
}
.auth-gate p { color: var(--text-mid); max-width: 380px; margin: 0 auto 28px; line-height: 1.6; }
.auth-gate-btns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.btn-primary {
  background: var(--green-mid); color: #fff; border: none;
  padding: 12px 28px; border-radius: 8px; font-family: 'DM Sans', sans-serif;
  font-size: 15px; font-weight: 500; cursor: pointer; transition: background 0.2s;
  text-decoration: none; display: inline-block;
}
.btn-primary:hover { background: var(--green-dark); }

.btn-outline {
  background: transparent; color: var(--green-mid);
  border: 1.5px solid var(--green-mid);
  padding: 12px 28px; border-radius: 8px; font-family: 'DM Sans', sans-serif;
  font-size: 15px; font-weight: 500; cursor: pointer; transition: all 0.2s;
  text-decoration: none; display: inline-block;
}
.btn-outline:hover { background: var(--green-pale); }

/* ── MAIN APP ───────────────────────────────────── */
.sc-app { display: none; max-width: 1100px; margin: 0 auto; padding: 40px 24px 80px; }
.sc-app.visible { display: block; }

/* ── TABS ───────────────────────────────────────── */
.sc-tabs {
  display: flex; gap: 0; border-bottom: 2px solid var(--cream-dark);
  margin-bottom: 36px;
}
.sc-tab {
  padding: 12px 24px; background: none; border: none; border-bottom: 3px solid transparent;
  margin-bottom: -2px; font-family: 'DM Sans', sans-serif; font-size: 15px;
  font-weight: 500; color: var(--text-muted); cursor: pointer; transition: all 0.2s;
}
.sc-tab.active { color: var(--green-mid); border-bottom-color: var(--green-mid); }
.sc-tab:hover:not(.active) { color: var(--text-dark); }
.sc-panel { display: none; }
.sc-panel.active { display: block; }

/* ── HEADINGS ───────────────────────────────────── */
.sc-heading {
  font-family: 'Playfair Display', serif;
  font-size: 1.6rem; color: var(--green-deep);
  margin: 0 0 4px;
}
.sc-sub { color: var(--text-muted); font-size: 14px; margin: 0 0 28px; }

/* ── ROUND FORM ─────────────────────────────────── */
.round-form-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 16px;
  background: #fff;
  border: 1px solid var(--cream-dark);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 28px;
}
@media (max-width: 720px) { .round-form-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .round-form-grid { grid-template-columns: 1fr; } }

.form-field label {
  display: block; font-size: 11px; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--text-muted); margin-bottom: 6px;
}
.form-field select,
.form-field input[type="date"],
.form-field input[type="text"] {
  width: 100%; padding: 10px 12px;
  border: 1.5px solid var(--cream-dark); border-radius: 8px;
  font-family: 'DM Sans', sans-serif; font-size: 14px; color: var(--text-dark);
  background: var(--cream); appearance: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}
.form-field select:focus,
.form-field input:focus { outline: none; border-color: var(--green-mid); }

/* ── SCORECARD TABLE ────────────────────────────── */
.sc-table-wrap {
  background: #fff;
  border: 1px solid var(--cream-dark);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 24px;
}
.sc-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.sc-table th {
  background: var(--green-deep); color: rgba(255,255,255,0.85);
  font-family: 'DM Sans', sans-serif; font-size: 11px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
  padding: 10px 8px; text-align: center;
}
.sc-table th:first-child { text-align: left; padding-left: 16px; }
.sc-table td {
  padding: 8px 6px; text-align: center;
  border-bottom: 1px solid var(--cream-dark);
  color: var(--text-dark);
}
.sc-table td:first-child { text-align: left; padding-left: 16px; font-weight: 500; }
.sc-table tr:last-child td { border-bottom: none; }
.sc-table tr.nine-divider td { border-top: 2px solid var(--green-border); }
.sc-table tr.totals-row td {
  background: var(--green-pale); font-weight: 600;
  color: var(--green-deep); font-size: 13px;
}

/* Score inputs */
.score-input {
  width: 44px; padding: 6px 4px;
  border: 1.5px solid var(--cream-dark); border-radius: 6px;
  text-align: center; font-family: 'DM Sans', sans-serif; font-size: 14px;
  font-weight: 600; background: var(--cream); transition: all 0.15s;
}
.score-input:focus { outline: none; border-color: var(--green-mid); background: #fff; }
.score-input.eagle  { background: #1a5c1a; color: #fff; border-color: #1a5c1a; }
.score-input.birdie { background: var(--green-mid); color: #fff; border-color: var(--green-mid); }
.score-input.par    { background: var(--green-pale); color: var(--green-deep); border-color: var(--green-border); }
.score-input.bogey  { background: #fff8e1; color: #8a6200; border-color: #f0c000; }
.score-input.double { background: #fff0ee; color: #c0392b; border-color: #e74c3c; }
.score-input.triple { background: #c0392b; color: #fff; border-color: #c0392b; }

.par-cell { font-weight: 600; color: var(--green-dark); }
.si-cell  { color: var(--text-muted); font-size: 12px; }
.yds-cell { color: var(--text-mid); font-size: 12px; }

/* ── HANDICAP BAR ───────────────────────────────── */
.hcp-bar {
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
  background: var(--green-deep); color: #fff;
  border-radius: 12px; padding: 20px 28px;
  margin-bottom: 24px;
}
.hcp-item { display: flex; flex-direction: column; gap: 2px; }
.hcp-label { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.65; }
.hcp-value { font-family: 'Playfair Display', serif; font-size: 1.8rem; font-weight: 700; }
.hcp-divider { width: 1px; height: 48px; background: rgba(255,255,255,0.2); }
.hcp-bar .save-btn {
  margin-left: auto; background: var(--green-light); color: #fff;
  border: none; padding: 12px 24px; border-radius: 8px;
  font-family: 'DM Sans', sans-serif; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: background 0.2s;
}
.hcp-bar .save-btn:hover { background: #7ab52a; }
.hcp-bar .save-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── HISTORY TABLE ──────────────────────────────── */
.history-empty {
  text-align: center; padding: 60px 24px;
  color: var(--text-muted);
}
.history-empty svg { margin-bottom: 16px; opacity: 0.4; }
.history-table {
  width: 100%; border-collapse: collapse; font-size: 14px;
  background: #fff; border-radius: 12px; overflow: hidden;
  border: 1px solid var(--cream-dark);
}
.history-table th {
  background: var(--green-deep); color: rgba(255,255,255,0.8);
  font-size: 11px; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; padding: 12px 16px; text-align: left;
}
.history-table td {
  padding: 14px 16px; border-bottom: 1px solid var(--cream-dark);
  color: var(--text-dark);
}
.history-table tr:last-child td { border-bottom: none; }
.history-table tr:hover td { background: var(--cream); }
.diff-badge {
  display: inline-block; background: var(--green-pale);
  color: var(--green-dark); padding: 2px 8px; border-radius: 99px;
  font-size: 12px; font-weight: 600;
}
.delete-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: 4px 8px; border-radius: 6px;
  transition: all 0.15s; font-size: 13px;
}
.delete-btn:hover { background: #fee; color: #c0392b; }

/* ── HANDICAP PANEL ─────────────────────────────── */
.hcp-panel-grid { display: grid; grid-template-columns: 260px 1fr; gap: 24px; }
@media (max-width: 700px) { .hcp-panel-grid { grid-template-columns: 1fr; } }
.hcp-card {
  background: var(--green-deep); color: #fff;
  border-radius: 16px; padding: 32px 28px;
  text-align: center;
}
.hcp-card-label { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.6; margin-bottom: 8px; }
.hcp-card-value { font-family: 'Playfair Display', serif; font-size: 4rem; font-weight: 700; line-height: 1; }
.hcp-card-note  { font-size: 12px; opacity: 0.5; margin-top: 8px; }
.hcp-breakdown {
  background: #fff; border: 1px solid var(--cream-dark); border-radius: 16px; padding: 24px;
}
.hcp-breakdown h3 { font-family: 'Playfair Display', serif; font-size: 1.1rem; color: var(--green-deep); margin: 0 0 16px; }
.hcp-diffs-list { display: flex; flex-direction: column; gap: 8px; }
.hcp-diff-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-radius: 8px; background: var(--cream);
  font-size: 13px;
}
.hcp-diff-row.best { background: var(--green-pale); }
.hcp-diff-row .course-name { color: var(--text-mid); font-size: 12px; }
.hcp-diff-val { font-weight: 700; color: var(--green-dark); }
.hcp-formula-note {
  margin-top: 20px; font-size: 12px; color: var(--text-muted);
  line-height: 1.6; padding-top: 16px; border-top: 1px solid var(--cream-dark);
}
.hcp-formula-note strong { color: var(--text-mid); }

/* ── WELCOME BANNER ─────────────────────────────── */
.welcome-banner {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px;
  margin-bottom: 32px;
}
.welcome-banner h1 {
  font-family: 'Playfair Display', serif;
  font-size: 2rem; color: var(--green-deep); margin: 0;
}
.welcome-banner h1 span { color: var(--green-light); font-style: italic; }
/* ── NEW ROUND BUTTON ───────────────────────────── */
.new-round-btn {
  background: var(--green-mid); color: #fff; border: none;
  padding: 12px 22px; border-radius: 8px;
  font-family: 'DM Sans', sans-serif; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: background 0.2s; display: flex; align-items: center; gap: 8px;
  white-space: nowrap;
}
.new-round-btn:hover { background: var(--green-dark); }

/* ── QUICK STATS ────────────────────────────────── */
.quick-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
  margin-bottom: 32px;
}
@media (max-width: 600px) { .quick-stats { grid-template-columns: 1fr 1fr; } }
.qs-card {
  background: #fff; border: 1px solid var(--cream-dark);
  border-radius: 12px; padding: 20px;
}
.qs-label { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 6px; }
.qs-value { font-family: 'Playfair Display', serif; font-size: 2rem; color: var(--green-deep); }
.qs-sub   { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ── TEE DOT ────────────────────────────────────── */
.tee-dot {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  margin-right: 6px; vertical-align: middle; border: 1px solid rgba(0,0,0,0.15);
}

/* ── TOAST ──────────────────────────────────────── */
.toast {
  position: fixed; bottom: 32px; left: 50%; transform: translateX(-50%) translateY(80px);
  background: var(--green-deep); color: #fff;
  padding: 14px 24px; border-radius: 10px;
  font-family: 'DM Sans', sans-serif; font-size: 14px; font-weight: 500;
  z-index: 9999; transition: transform 0.3s ease, opacity 0.3s ease;
  opacity: 0; pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ── PROFILE CARD ────────────────────────────────── */
.profile-card {
  background: #fff;
  border: 1px solid var(--cream-dark);
  border-radius: 16px;
  padding: 24px 28px;
  margin-bottom: 28px;
}
.profile-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--cream-dark);
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 16px;
}
.profile-card-user { display: flex; align-items: center; gap: 14px; }
.profile-card-avatar {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--green-mid); color: #fff;
  font-family: 'DM Sans', sans-serif; font-size: 16px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.profile-card-name {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem; font-weight: 700; color: var(--green-deep); margin: 0 0 3px;
}
.profile-card-since { font-size: 12px; color: var(--text-muted); }
.profile-card-hcp {
  text-align: right;
}
.profile-card-hcp-label {
  font-size: 10px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-muted); margin-bottom: 2px;
}
.profile-card-hcp-value {
  font-family: 'Playfair Display', serif;
  font-size: 2.4rem; font-weight: 700; color: var(--green-mid); line-height: 1;
}

.profile-card-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
  margin-bottom: 20px;
}
.profile-stat {
  background: var(--green-pale);
  border-radius: 10px; padding: 14px 16px; text-align: center;
}
.profile-stat-val {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem; font-weight: 700; color: var(--green-deep);
}
.profile-stat-lbl {
  font-size: 10px; font-weight: 600; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--text-muted); margin-top: 3px;
}

.profile-card-recent-label {
  font-size: 10px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-muted); margin-bottom: 12px;
}
.profile-recent-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid var(--cream-dark);
  gap: 12px;
}
.profile-recent-row:last-child { border-bottom: none; }
.profile-recent-course {
  font-weight: 500; font-size: 14px; color: var(--text-dark);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.profile-recent-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.profile-recent-right { text-align: right; flex-shrink: 0; }
.profile-recent-score {
  font-size: 15px; font-weight: 600; color: var(--text-dark);
}
.profile-recent-score span { font-size: 12px; color: var(--green-light); margin-left: 4px; }
.profile-recent-diff { font-size: 12px; color: var(--text-muted); }

/* ── SHARE BUTTON ────────────────────────────────── */
.share-btn {
  background: none; border: 1.5px solid var(--cream-dark);
  color: var(--text-muted); padding: 4px 10px; border-radius: 6px;
  cursor: pointer; font-family: 'DM Sans', sans-serif; font-size: 12px;
  transition: all 0.15s; display: inline-flex; align-items: center; gap: 5px;
}
.share-btn:hover { border-color: var(--green-mid); color: var(--green-mid); background: var(--green-pale); }

/* ── MOBILE SCORECARD ────────────────────────────── */
@media (max-width: 640px) {
  /* Scorecard table scrolls horizontally */
  .sc-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .sc-table { min-width: 420px; font-size: 12px; }
  .sc-table th, .sc-table td { padding: 6px 4px; }
  .sc-table th:first-child, .sc-table td:first-child { padding-left: 10px; }

  /* Sticky hole column */
  .sc-table th:first-child,
  .sc-table td:first-child {
    position: sticky; left: 0; z-index: 1;
    background: var(--green-deep);
  }
  .sc-table td:first-child { background: #fff; }
  .sc-table tr.totals-row td:first-child { background: var(--green-pale); }
  .sc-table tr.nine-divider td:first-child { background: #fff; }

  /* Smaller score inputs on mobile */
  .score-input { width: 36px; font-size: 13px; padding: 5px 2px; }

  /* Handicap bar stack on mobile */
  .hcp-bar { flex-direction: column; align-items: flex-start; gap: 12px; padding: 16px; }
  .hcp-divider { display: none; }
  .hcp-bar .save-btn { width: 100%; margin-left: 0; }

  /* Round form grid — 2 cols on mobile */
  .round-form-grid { grid-template-columns: 1fr 1fr; gap: 10px; padding: 16px; }

  /* Profile card stats 3-col stays but smaller */
  .profile-stat { padding: 10px 8px; }
  .profile-stat-val { font-size: 1.2rem; }

  /* History table scroll */
  .history-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .history-table th, .history-table td { white-space: nowrap; padding: 10px 12px; }

  /* Quick stats 2×2 grid on mobile */
  .quick-stats { grid-template-columns: 1fr 1fr; }

  /* Welcome banner stack on mobile */
  .welcome-banner { flex-direction: column; align-items: flex-start; gap: 12px; }
}
