﻿/* =============================================
   Golf Score App - Main Stylesheet
   ============================================= */
:root {
  --green-dark:   #1b4332;
  --green-main:   #2d6a4f;
  --green-mid:    #40916c;
  --green-light:  #74c69d;
  --green-pale:   #d8f3dc;
  --green-bg:     #f0fdf4;
  --gold:         #f4a261;
  --gold-dark:    #e76f51;
  --white:        #ffffff;
  --gray-100:     #f8f9fa;
  --gray-200:     #e9ecef;
  --gray-600:     #6c757d;
  --gray-800:     #343a40;
  --red:          #dc3545;
  --blue:         #0d6efd;

  --score-eagle:   #f4d03f;
  --score-birdie:  #e74c3c;
  --score-par:     #ffffff;
  --score-bogey:   #85c1e9;
  --score-double:  #5dade2;
  --score-triple:  #2e86c1;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Sarabun', 'Noto Sans Thai', sans-serif;
  background: var(--green-bg);
  color: var(--gray-800);
  min-height: 100vh;
  font-size: 16px;
}

/* ── Navbar ── */
.navbar {
  background: var(--green-dark);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.navbar-brand {
  color: var(--white);
  font-size: 1.15rem;
  font-weight: 700;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.navbar-brand .icon { font-size: 1.4rem; }
.navbar-right { display: flex; align-items: center; gap: 12px; }
.navbar a.nav-link {
  color: var(--green-pale);
  text-decoration: none;
  font-size: 0.9rem;
}
.navbar a.nav-link:hover { color: #fff; }

/* ── Container ── */
.container { max-width: 480px; margin: 0 auto; padding: 0 16px; }
.container-wide { max-width: 720px; margin: 0 auto; padding: 0 16px; }

/* ── Page header ── */
.page-header {
  background: linear-gradient(135deg, var(--green-dark), var(--green-main));
  color: #fff;
  padding: 24px 20px 20px;
  text-align: center;
}
.page-header h1 { font-size: 1.4rem; font-weight: 700; }
.page-header p  { font-size: 0.9rem; opacity: .85; margin-top: 4px; }

/* ── Cards ── */
.card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 2px 12px rgba(0,0,0,.08);
  overflow: hidden;
  margin-bottom: 16px;
}
.card-header {
  background: var(--green-main);
  color: #fff;
  padding: 12px 16px;
  font-weight: 700;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-body { padding: 16px; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  text-decoration: none;
}
.btn-block { width: 100%; display: flex; }
.btn-lg { padding: 16px 24px; font-size: 1.1rem; border-radius: 14px; }
.btn-sm { padding: 8px 14px; font-size: 0.85rem; border-radius: 10px; }

.btn-primary   { background: var(--green-main); color: #fff; }
.btn-primary:hover { background: var(--green-dark); }
.btn-secondary { background: var(--gray-200); color: var(--gray-800); }
.btn-secondary:hover { background: #d0d0d0; }
.btn-gold      { background: var(--gold); color: #fff; }
.btn-gold:hover { background: var(--gold-dark); }
.btn-danger    { background: var(--red); color: #fff; }
.btn-danger:hover { background: #b02a37; }
.btn-outline   { background: transparent; border: 2px solid var(--green-main); color: var(--green-main); }
.btn-outline:hover { background: var(--green-main); color: #fff; }

.btn:disabled  { opacity: .5; cursor: not-allowed; }

/* ── Form elements ── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-weight: 600; margin-bottom: 6px; color: var(--green-dark); }
.form-control {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--gray-200);
  border-radius: 12px;
  font-size: 1rem;
  font-family: inherit;
  transition: border-color .2s;
  background: #fff;
}
.form-control:focus {
  outline: none;
  border-color: var(--green-mid);
  box-shadow: 0 0 0 3px rgba(64,145,108,.15);
}
.form-hint { font-size: 0.82rem; color: var(--gray-600); margin-top: 4px; }

/* ── Alert ── */
.alert {
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 0.9rem;
}
.alert-danger  { background: #fde8e8; border: 1px solid #f5c6c6; color: #7d1a1a; }
.alert-success { background: #d8f3dc; border: 1px solid #95d5b2; color: #1b4332; }
.alert-info    { background: #dbeafe; border: 1px solid #93c5fd; color: #1e3a5f; }

/* ── Landing Page ── */
.landing {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  background: linear-gradient(160deg, var(--green-dark) 0%, var(--green-main) 50%, var(--green-mid) 100%);
}
.landing-logo {
  font-size: 5rem;
  margin-bottom: 8px;
}
.landing-title {
  color: #fff;
  font-size: 1.8rem;
  font-weight: 800;
  text-align: center;
  line-height: 1.3;
}
.landing-subtitle {
  color: var(--green-pale);
  font-size: 0.95rem;
  text-align: center;
  margin-top: 6px;
  margin-bottom: 40px;
}
.role-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  width: 100%;
  max-width: 380px;
}
.role-card {
  background: rgba(255,255,255,.12);
  border: 2px solid rgba(255,255,255,.25);
  border-radius: 20px;
  padding: 28px 16px;
  text-align: center;
  cursor: pointer;
  text-decoration: none;
  color: #fff;
  transition: all .25s;
  backdrop-filter: blur(8px);
}
.role-card:hover {
  background: rgba(255,255,255,.22);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
}
.role-card .role-icon { font-size: 2.8rem; display: block; margin-bottom: 10px; }
.role-card .role-title { font-size: 1.1rem; font-weight: 700; }
.role-card .role-desc  { font-size: 0.78rem; opacity: .8; margin-top: 4px; }

/* ── Scorecard ── */
.scorecard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.scorecard-table th {
  background: var(--green-dark);
  color: #fff;
  padding: 8px 6px;
  text-align: center;
  font-weight: 700;
}
.scorecard-table td {
  padding: 9px 6px;
  text-align: center;
  border-bottom: 1px solid var(--gray-200);
}
.scorecard-table tr:hover td { background: var(--green-pale); }
.scorecard-table tr.out-row td,
.scorecard-table tr.in-row td,
.scorecard-table tr.total-row td {
  background: var(--green-pale);
  font-weight: 700;
}
.scorecard-table tr.total-row td { background: var(--green-main); color: #fff; font-size: 1rem; }

.score-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
}
.score-circle.hole-in-one { background: #6f42c1; color: #fff; border: 3px solid #4a0e8f; }
.score-circle.albatross   { background: #fd7e14; color: #fff; border: 3px solid #c9560b; }
.score-circle.eagle       { background: var(--score-eagle); color: #333; border: 2px solid #c9a800; }
.score-circle.birdie      { background: var(--score-birdie); color: #fff; border: 2px solid #a52834; }
.score-circle.par         { background: #fff; color: #333; border: 2px solid #999; }
.score-circle.bogey       { background: var(--score-bogey); color: #1a5276; border: 2px solid #5dade2; }
.score-circle.double-bogey { background: var(--score-double); color: #fff; border: 2px solid #1a6898; }
.score-circle.triple-bogey { background: var(--score-triple); color: #fff; border: 2px solid #1a3d6d; }
.score-circle.empty       { background: #eee; color: #ccc; border: 2px dashed #ccc; }

/* ── Hole Info Card ── */
.hole-hero {
  background: linear-gradient(135deg, var(--green-dark), var(--green-mid));
  color: #fff;
  padding: 20px;
  text-align: center;
}
.hole-number-big { font-size: 3.5rem; font-weight: 900; line-height: 1; }
.hole-meta { display: flex; justify-content: center; gap: 20px; margin-top: 12px; flex-wrap: wrap; }
.hole-meta-item { text-align: center; }
.hole-meta-item .val { font-size: 1.5rem; font-weight: 700; }
.hole-meta-item .lbl { font-size: 0.75rem; opacity: .8; }

/* ── Hole Diagram ── */
.hole-diagram {
  position: relative;
  width: 100%;
  max-width: 300px;
  margin: 0 auto;
}
#holeCanvas {
  display: block;
  width: 100%;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
}

/* ── GPS Section ── */
.gps-section { padding: 16px; }
.gps-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.9rem;
  margin-bottom: 12px;
}
.gps-status.ready    { background: #d8f3dc; color: var(--green-dark); }
.gps-status.waiting  { background: #fef9c3; color: #7a5c00; }
.gps-status.error    { background: #fde8e8; color: #7d1a1a; }

.shot-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--gray-200);
}
.shot-num {
  width: 28px;
  height: 28px;
  background: var(--green-main);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.shot-dist { font-weight: 700; color: var(--green-dark); font-size: 1rem; }
.shot-dist span { font-size: 0.8rem; font-weight: 400; color: var(--gray-600); }

/* ── Stroke Counter ── */
.stroke-counter {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 20px;
}
.stroke-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  font-size: 1.8rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s;
}
.stroke-btn.minus { background: var(--gray-200); color: var(--gray-800); }
.stroke-btn.plus  { background: var(--green-main); color: #fff; }
.stroke-btn:hover { transform: scale(1.1); }
.stroke-num {
  font-size: 3.5rem;
  font-weight: 900;
  color: var(--green-dark);
  min-width: 80px;
  text-align: center;
}

/* ── Summary ── */
.summary-hero {
  background: linear-gradient(135deg, var(--green-dark), var(--green-main));
  color: #fff;
  padding: 32px 20px;
  text-align: center;
}
.summary-score { font-size: 4rem; font-weight: 900; }
.summary-label { font-size: 1.1rem; opacity: .85; }
.score-diff { font-size: 1.8rem; font-weight: 700; }
.score-diff.under { color: var(--score-eagle); }
.score-diff.over  { color: #f8c4c4; }
.score-diff.even  { color: #a8f0c0; }

.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 16px;
}
.summary-stat {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.summary-stat .s-val { font-size: 2rem; font-weight: 800; color: var(--green-dark); }
.summary-stat .s-lbl { font-size: 0.8rem; color: var(--gray-600); margin-top: 2px; }

/* ── Progress Bar ── */
.progress-bar {
  height: 6px;
  background: var(--gray-200);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 8px;
}
.progress-fill {
  height: 100%;
  background: var(--green-mid);
  border-radius: 3px;
  transition: width .4s ease;
}

/* ── Hole Navigation ── */
.hole-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #fff;
  border-top: 1px solid var(--gray-200);
  position: sticky;
  bottom: 0;
  z-index: 50;
  gap: 12px;
}

/* ── Tabs ── */
.tabs {
  display: flex;
  background: var(--gray-100);
  border-radius: 10px;
  padding: 4px;
  gap: 4px;
  margin-bottom: 16px;
}
.tab-btn {
  flex: 1;
  padding: 9px;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-size: 0.9rem;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  color: var(--gray-600);
  transition: all .2s;
}
.tab-btn.active { background: #fff; color: var(--green-dark); box-shadow: 0 1px 4px rgba(0,0,0,.1); }

/* ── Badge ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
}
.badge-green  { background: var(--green-pale); color: var(--green-dark); }
.badge-gold   { background: #fef3c7; color: #92400e; }
.badge-gray   { background: var(--gray-200); color: var(--gray-600); }

/* ── Utilities ── */
.mt-1 { margin-top: 4px; }  .mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; }
.mt-5 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }
.p-4  { padding: 16px; }     .p-3  { padding: 12px; }
.text-center { text-align: center; }
.text-small  { font-size: 0.85rem; }
.text-muted  { color: var(--gray-600); }
.text-white  { color: #fff; }
.fw-bold     { font-weight: 700; }
.d-flex      { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2       { gap: 8px; }
.gap-3       { gap: 12px; }
.w-100       { width: 100%; }
.divider     { height: 1px; background: var(--gray-200); margin: 12px 0; }

/* ── Spinner ── */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 20px; height: 20px;
  border: 3px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .8s linear infinite;
  display: inline-block;
}

/* ── Responsive ── */
@media (max-width: 400px) {
  .role-grid { grid-template-columns: 1fr; }
  .scorecard-table { font-size: 0.75rem; }
  .score-circle { width: 28px; height: 28px; font-size: 0.75rem; }
}
