/* Mobile-first responsive CSS for Golf Stats App */

/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: #f5f5f5;
  padding: 0;
  margin: 0;
}

.container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 1rem;
}

/* Header */
header {
  background-color: #2c5530;
  color: white;
  padding: 1.5rem 1rem;
  margin: -1rem -1rem 2rem -1rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

header h1 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

header nav {
  margin-top: 1rem;
}

header nav a {
  color: white;
  text-decoration: none;
  margin-right: 1rem;
}

/* Cards */
.card {
  background: white;
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Forms */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: #555;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
  font-family: inherit;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #2c5530;
  box-shadow: 0 0 0 3px rgba(44, 85, 48, 0.1);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.checkbox-group label {
  display: flex;
  align-items: center;
  font-weight: normal;
  cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
  width: auto;
  margin-right: 0.5rem;
  cursor: pointer;
}

/* Range Slider */
input[type="range"] {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: #ddd;
  outline: none;
  -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #2c5530;
  cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #2c5530;
  cursor: pointer;
  border: none;
}

.range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.875rem;
  color: #666;
  margin-top: 0.5rem;
}

.range-value {
  text-align: center;
  margin-top: 0.5rem;
  font-weight: 500;
}

/* Buttons */
.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
  touch-action: manipulation;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background-color: #2c5530;
  color: white;
}

.btn-primary:hover {
  background-color: #1e3a21;
}

.btn-secondary {
  background-color: #6c757d;
  color: white;
}

.btn-secondary:hover {
  background-color: #5a6268;
}

.btn-success {
  background-color: #28a745;
  color: white;
}

.btn-success:hover {
  background-color: #218838;
}

.btn-danger {
  background-color: #dc3545;
  color: white;
}

.btn-danger:hover {
  background-color: #c82333;
}

.btn-small {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Name Entry Form */
.name-entry-form {
  max-width: 500px;
  margin: 2rem auto;
}

/* Dashboard */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.dashboard-header h2 {
  font-size: 1.75rem;
  color: #333;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  text-align: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.stat-label {
  font-size: 0.875rem;
  color: #666;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: bold;
  color: #2c5530;
  word-break: break-word;
}

/* Rounds List */
.rounds-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.round-card {
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.round-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.round-header h4 {
  font-size: 1.25rem;
  color: #333;
}

.round-date {
  color: #666;
  font-size: 0.875rem;
}

.round-details {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
  color: #666;
  font-size: 0.875rem;
}

.round-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

/* Round Entry */
.round-setup {
  max-width: 600px;
  margin: 0 auto;
}

.hole-entry {
  max-width: 800px;
  margin: 0 auto;
}

.hole-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.hole-header h2 {
  font-size: 2rem;
  color: #2c5530;
  margin-bottom: 0.5rem;
}

.hole-progress {
  color: #666;
  font-size: 0.875rem;
}

.hole-navigation {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin: 2rem 0;
}

.round-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 2rem;
}

/* Empty State */
.empty-state {
  text-align: center;
  color: #666;
  padding: 2rem;
  font-style: italic;
}

.error {
  color: #dc3545;
  text-align: center;
  padding: 1rem;
}

/* Landing Page */
.landing-content {
  text-align: center;
  padding: 3rem 1rem;
  max-width: 600px;
  margin: 0 auto;
}

.landing-content p {
  font-size: 1.125rem;
  color: #666;
}

/* Desktop Styles */
@media (min-width: 768px) {
  .container {
    padding: 2rem;
  }
  
  header {
    padding: 2rem;
    margin: -2rem -2rem 2rem -2rem;
  }
  
  header h1 {
    font-size: 2rem;
  }
  
  .form-row {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .dashboard-header {
    flex-wrap: nowrap;
  }
  
  .hole-navigation {
    justify-content: center;
  }
  
  .round-actions {
    justify-content: center;
  }
}

@media (min-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  
  .form-row {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Inside the two-column layout, make stat cards fit better */
.dashboard-col-stats .stats-grid {
  grid-template-columns: repeat(2, 1fr);
}

@media (min-width: 1200px) {
  .dashboard-col-stats .stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Touch-friendly adjustments for mobile */
@media (max-width: 767px) {
  .btn {
    min-height: 44px; /* iOS touch target size */
    min-width: 44px;
  }
  
  .form-group input,
  .form-group select {
    min-height: 44px;
    font-size: 16px; /* Prevents zoom on iOS */
  }
  
  input[type="range"] {
    height: 12px;
  }
  
  input[type="range"]::-webkit-slider-thumb {
    width: 24px;
    height: 24px;
  }
  
  input[type="range"]::-moz-range-thumb {
    width: 24px;
    height: 24px;
  }
}

/* Scorecard */
.scorecard-container {
  margin-top: 1rem;
  overflow-x: auto;
}

.scorecard-wrapper {
  overflow-x: auto;
}

.scorecard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  margin-top: 1rem;
}

.scorecard-table th,
.scorecard-table td {
  padding: 0.5rem;
  text-align: center;
  border: 1px solid #ddd;
}

.scorecard-table th {
  background-color: #2c5530;
  color: white;
  font-weight: 600;
}

.scorecard-table tbody tr:nth-child(even) {
  background-color: #f9f9f9;
}

.scorecard-table tbody tr:hover {
  background-color: #f0f0f0;
}

.scorecard-totals {
  background-color: #e8f5e9;
  font-weight: bold;
}

.hole-link {
  background: none;
  border: none;
  color: #2c5530;
  text-decoration: underline;
  cursor: pointer;
  font-size: inherit;
  padding: 0;
  font-weight: 500;
}

.hole-link:hover {
  color: #1e3a21;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-content {
  background-color: white;
  border-radius: 8px;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid #ddd;
}

.modal-header h2 {
  margin: 0;
  color: #333;
}

.modal-close {
  background: none;
  border: none;
  font-size: 2rem;
  color: #666;
  cursor: pointer;
  padding: 0;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.modal-close:hover {
  color: #333;
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  padding: 1.5rem;
  border-top: 1px solid #ddd;
}

.chip-pitch-group {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 0.5rem;
}

.chip-pitch-option {
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.chip-pitch-option:hover {
  background-color: #f5f5f5;
}

.chip-pitch-option input[type="checkbox"] {
  margin-right: 0.5rem;
  width: auto;
}

.chip-pitch-option input[type="checkbox"]:checked + span {
  font-weight: 600;
  color: #2c5530;
}

/* Chip/Pitch Shots */
.chip-pitch-shot {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.chip-pitch-shot select {
  flex: 1;
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.875rem;
}

.chip-pitch-shot .btn {
  min-width: auto;
  padding: 0.25rem 0.5rem;
  font-size: 1.25rem;
  line-height: 1;
}

/* Radio Button Group */
.radio-group {
  display: flex;
  gap: 1rem;
  margin-top: 0.5rem;
}

.radio-option {
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 0.5rem 1rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.radio-option:hover {
  background-color: #f5f5f5;
}

.radio-option input[type="radio"] {
  margin-right: 0.5rem;
  width: auto;
}

.radio-option input[type="radio"]:checked + span {
  font-weight: 600;
  color: #2c5530;
}

/* Two-Column Dashboard Layout */
.dashboard-columns {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.dashboard-col {
  min-width: 0;
}

/* Stats graphs grid */
.stats-graphs-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-top: 1rem;
}

.stats-graph-container {
  margin-bottom: 0;
}

.stats-graph-container h4 {
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  color: #555;
}

/* Average score row in scorecard */
.scorecard-avg-row td {
  font-size: 0.75rem;
  color: #888;
  font-style: italic;
  padding: 0.25rem 0.5rem;
  border-top: none;
}

@media (min-width: 1024px) {
  .dashboard-columns {
    flex-direction: row;
    height: calc(100vh - 140px);
  }
  
  .dashboard-col {
    flex: 1;
    overflow-y: auto;
    padding-right: 0.5rem;
  }
  
  .dashboard-col-stats {
    flex: 0 0 45%;
    max-width: 45%;
  }
  
  .dashboard-col-rounds {
    flex: 0 0 55%;
    max-width: 55%;
  }
  
  .stats-graphs-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* Print Styles */
@media print {
  .btn,
  .round-actions,
  .hole-navigation {
    display: none;
  }
  
  .modal {
    display: none !important;
  }
}
