/* Golf Insights – army green & light green palette */
:root {
  --army: #4b5320;
  --army-dark: #3a4119;
  --army-light: #5c6b2f;
  --green: #7cb342;
  --green-light: #a5d66b;
  --green-pale: #e8f5e9;
  --bg: #f5f7f2;
  --text: #1a1a1a;
  --text-muted: #5f6356;
  --white: #ffffff;
  --error: #c62828;
  --error-bg: #fbe9e7;
  --border: #c5cbb8;
  --radius: 8px;
}

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

html {
  -moz-text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

/* --- Buttons --- */

.btn {
  display: inline-block;
  padding: 12px 28px;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  -moz-appearance: none;
  -webkit-appearance: none;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--army);
  color: var(--white);
}

.btn-primary:hover {
  background: var(--army-dark);
}

.btn-secondary {
  background: var(--green);
  color: var(--white);
}

.btn-secondary:hover {
  background: var(--army-light);
}

/* --- Hero / Landing --- */

.hero {
  max-width: 720px;
  margin: 0 auto;
  padding: 60px 24px 80px;
  text-align: center;
}

.hero-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.hero-icon svg {
  display: block;
  width: 120px;
  height: 120px;
}

.hero h1 {
  font-size: 2.5rem;
  color: var(--army);
  margin-bottom: 12px;
}

.hero-tagline {
  font-size: 1.15rem;
  color: var(--text-muted);
  max-width: 480px;
  margin: 0 auto 32px;
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  margin-bottom: 64px;
}

/* Firefox fallback for flex gap */
@supports not (gap: 16px) {
  .hero-actions .btn {
    margin: 8px;
  }
}

.hero-features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  text-align: center;
}

.feature {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 20px;
  box-shadow: 0 2px 8px rgba(75, 83, 32, 0.06);
}

.feature-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
}

.feature-icon svg {
  display: block;
  width: 32px;
  height: 32px;
}

.feature h3 {
  color: var(--army);
  font-size: 1rem;
  margin-bottom: 8px;
}

.feature p {
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.5;
}

@media (max-width: 640px) {
  .hero h1 {
    font-size: 2rem;
  }

  .hero-actions {
    flex-direction: column;
    align-items: center;
  }

  .hero-actions .btn {
    width: 100%;
    max-width: 280px;
  }

  .hero-features {
    grid-template-columns: 1fr;
  }
}

/* --- Auth pages --- */

.auth-container {
  max-width: 400px;
  margin: 80px auto;
  padding: 40px 32px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 2px 8px rgba(75, 83, 32, 0.08);
}

.auth-container h1 {
  color: var(--army);
  font-size: 1.75rem;
  text-align: center;
  margin-bottom: 4px;
}

.auth-container h2 {
  color: var(--text-muted);
  font-size: 1rem;
  font-weight: 400;
  text-align: center;
  margin-bottom: 28px;
}

.auth-container form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-container label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--army);
  margin-top: 8px;
}

.auth-container input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  background: var(--green-pale);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
  -moz-appearance: none;
  -webkit-appearance: none;
}

.auth-container input:focus {
  border-color: var(--army-light);
  box-shadow: 0 0 0 2px rgba(75, 83, 32, 0.15);
}

.auth-container button {
  width: 100%;
  margin-top: 20px;
  padding: 12px;
  background: var(--army);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  -moz-appearance: none;
  -webkit-appearance: none;
}

.auth-container button:hover {
  background: var(--army-dark);
}

.auth-container button:active {
  background: var(--army-light);
}

.error {
  background: var(--error-bg);
  color: var(--error);
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  margin-bottom: 16px;
  text-align: center;
}

.alt-link {
  text-align: center;
  margin-top: 20px;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.alt-link a {
  color: var(--army);
  font-weight: 600;
  text-decoration: none;
}

.check-email-msg {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.5;
  text-align: center;
  margin-bottom: 20px;
}

.alt-link a:hover {
  text-decoration: underline;
}

/* --- Top bar --- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--army);
  color: var(--white);
}

.topbar-brand {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--white);
  text-decoration: none;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.875rem;
}

.btn-link {
  background: none;
  border: none;
  color: var(--green-light);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  padding: 0;
}

.btn-link:hover {
  text-decoration: underline;
}

.inline-form {
  display: inline;
}

/* --- Container --- */

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 24px;
}

/* --- Dashboard --- */

.dashboard-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.dashboard-header h1 {
  font-size: 1.5rem;
  color: var(--army);
}

.badge {
  background: var(--green-pale);
  color: var(--army-light);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 12px;
}

.rounds-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.round-card {
  display: block;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.round-card:hover {
  border-color: var(--army-light);
  box-shadow: 0 2px 8px rgba(75, 83, 32, 0.1);
}

.round-card-top {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
}

.round-score {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--army);
}

.round-par {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.round-card-stats {
  display: flex;
  gap: 16px;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.round-card-date {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 24px;
}

.pagination-info {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.btn-disabled {
  background: var(--border);
  color: var(--text-muted);
  cursor: default;
  pointer-events: none;
}

.empty-state {
  text-align: center;
  padding: 48px 24px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.empty-state p {
  color: var(--text-muted);
  margin-bottom: 20px;
  font-size: 1.05rem;
}

/* --- Round form --- */

.container h1 {
  font-size: 1.5rem;
  color: var(--army);
  margin-bottom: 24px;
}

.round-form {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--army);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  background: var(--green-pale);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
  -moz-appearance: none;
  -webkit-appearance: none;
}

.form-group select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%234b5320' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.form-group textarea {
  resize: vertical;
  min-height: 72px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--army-light);
  box-shadow: 0 0 0 2px rgba(75, 83, 32, 0.15);
}

.penalty-fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin: 0;
}

.penalty-fieldset legend {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--army);
  padding: 0 8px;
}

.btn-full {
  width: 100%;
  margin-top: 8px;
}

@media (max-width: 640px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

/* --- Handicap card --- */

.handicap-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--army);
  color: var(--white);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 24px;
}

.handicap-main {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.handicap-label {
  font-size: 0.875rem;
  font-weight: 500;
  opacity: 0.8;
}

.handicap-value {
  font-size: 2rem;
  font-weight: 700;
}

.handicap-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.handicap-trend {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 10px;
}

.handicap-trend-improving {
  background: var(--green);
  color: var(--white);
}

.handicap-trend-declining {
  background: var(--error);
  color: var(--white);
}

.handicap-trend-stable {
  background: var(--green-pale);
  color: var(--army);
}

.handicap-trend-neutral {
  background: rgba(255, 255, 255, 0.15);
  color: var(--white);
}

.handicap-rounds {
  font-size: 0.75rem;
  opacity: 0.7;
}

@media (max-width: 640px) {
  .handicap-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .handicap-meta {
    align-items: flex-start;
  }
}

/* --- Flash messages --- */

.flash {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  margin-bottom: 20px;
  line-height: 1.4;
}

.flash-success {
  background: var(--green-pale);
  color: var(--army);
  border: 1px solid var(--green);
}

/* --- Error pages --- */

.error-page {
  max-width: 480px;
  margin: 120px auto;
  padding: 48px 32px;
  text-align: center;
}

.error-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.error-icon svg {
  display: block;
  width: 64px;
  height: 64px;
}

.error-page h1 {
  font-size: 3rem;
  font-weight: 700;
  color: var(--army);
  margin-bottom: 8px;
}

.error-message {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-bottom: 28px;
  line-height: 1.5;
}

/* --- Round detail --- */

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
}

.detail-header h1 {
  margin-bottom: 4px;
}

.detail-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--army);
}

.detail-date {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.detail-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.btn-danger {
  background: var(--error);
  color: var(--white);
  border: none;
  font-family: inherit;
  cursor: pointer;
}

.btn-danger:hover {
  background: #a52020;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}

.stat-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.stat-value {
  display: block;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--army);
}

.stat-sub {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.detail-notes {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 24px;
}

.detail-notes h3 {
  font-size: 0.875rem;
  color: var(--army);
  margin-bottom: 8px;
}

.detail-notes p {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.5;
}

.insights-section {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.insights-section h2 {
  font-size: 1.15rem;
  color: var(--army);
  margin-bottom: 12px;
}

.insights-summary {
  font-size: 1rem;
  color: var(--text);
  margin-bottom: 16px;
}

.insights-list {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.insights-list li {
  padding: 10px 14px;
  background: var(--green-pale);
  border-radius: var(--radius);
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.4;
}

.insights-focus {
  padding: 12px 16px;
  background: var(--army);
  color: var(--white);
  border-radius: var(--radius);
  font-size: 0.9rem;
  line-height: 1.4;
}

.insights-focus strong {
  color: var(--green-light);
}

@media (max-width: 640px) {
  .detail-header {
    flex-direction: column;
    gap: 12px;
  }

  .detail-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
