/* === Base Reset & Variables === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
.hidden { display: none !important; }

:root {
  --brown: #2F241D;
  --gold: #FFC425;
  --gold-dark: #D2AA6E;
  --sand: #F5F0E8;
  --white: #FFFFFF;
  --green: #22c55e;
  --green-bg: #f0fdf4;
  --blue: #3b82f6;
  --blue-bg: #eff6ff;
  --gray: #9ca3af;
  --gray-bg: #f3f4f6;
  --red: #ef4444;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
  font-family: var(--font);
  background: var(--sand);
  color: var(--brown);
  line-height: 1.5;
}

/* === Header === */
header {
  background: var(--brown);
  color: var(--white);
  text-align: center;
  padding: 32px 16px;
  background-image: linear-gradient(135deg, #2F241D 0%, #4a3728 100%);
}

header h1 {
  font-size: 1.8rem;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

header .subtitle {
  color: var(--gold);
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 16px;
}

/* === Nav Bar === */
.nav-bar {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.nav-btn {
  padding: 8px 20px;
  border: 2px solid rgba(255,255,255,0.25);
  background: transparent;
  color: var(--white);
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 24px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
}

.nav-btn:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.4);
}

.nav-btn.active {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--brown);
}

/* === Container === */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
}

/* === Section Tabs === */
.section-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.tab {
  flex: 1;
  padding: 10px 16px;
  border: 2px solid var(--brown);
  background: var(--white);
  color: var(--brown);
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.tab:hover { background: var(--sand); }

.tab.active {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--brown);
}

/* === Calendar === */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.calendar-month {
  background: var(--white);
  border-radius: 10px;
  padding: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.calendar-month-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--brown);
  margin-bottom: 8px;
  text-align: center;
}

.calendar-dates {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.cal-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s;
}

.cal-date:hover {
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.cal-available {
  background: var(--green);
  color: var(--white);
}

.cal-unavailable {
  background: #e5e7eb;
  color: #9ca3af;
}

.cal-day {
  font-size: 0.55rem;
  font-weight: 600;
  line-height: 1;
  text-transform: uppercase;
}

.cal-num {
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.1;
}

/* === Highlight Animation === */
.game-card.highlight {
  animation: highlightPulse 1.5s ease;
}

@keyframes highlightPulse {
  0% { box-shadow: 0 0 0 0 rgba(255,196,37,0.6); }
  30% { box-shadow: 0 0 0 8px rgba(255,196,37,0.3); }
  100% { box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
}

/* === Filters === */
.filters {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}

.filters select {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.9rem;
  background: var(--white);
  color: var(--brown);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  cursor: pointer;
}

.checkbox-label input { width: 16px; height: 16px; cursor: pointer; }

/* === Legend === */
.legend {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
  font-size: 0.8rem;
  color: #666;
}

.legend-item { display: flex; align-items: center; gap: 4px; }

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.dot.available { background: var(--green); }
.dot.claimed { background: var(--blue); }
.dot.no { background: var(--gray); }

/* === Month Header === */
.month-header {
  font-size: 1.2rem;
  color: var(--brown);
  padding: 12px 0 8px;
  border-bottom: 2px solid var(--gold);
  margin-bottom: 12px;
}

/* === Games Grid === */
.games-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

/* === Game Cards === */
.game-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--white);
  border-radius: 10px;
  padding: 14px 16px;
  border-left: 4px solid var(--brown);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  transition: transform 0.15s, box-shadow 0.15s;
}

.game-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0,0,0,0.1);
}

.game-info { flex: 1; min-width: 0; }

.game-date {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--brown);
}

.game-opponent {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 2px 0;
}

.game-meta {
  font-size: 0.8rem;
  color: #777;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.giveaway-badge {
  display: inline-block;
  background: var(--gold);
  color: var(--brown);
  padding: 1px 8px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.price-badge {
  display: inline-block;
  background: var(--green-bg);
  color: var(--green);
  padding: 1px 8px;
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 700;
}

.section-badge {
  display: inline-block;
  background: var(--brown);
  color: var(--white);
  padding: 1px 8px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 600;
}

.game-actions {
  display: flex;
  flex-direction: row;
  gap: 8px;
  margin-top: 10px;
  flex-shrink: 0;
}

.game-actions .btn-section {
  flex: 1;
  text-align: center;
}

.btn-section {
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}

.btn-section-available {
  background: var(--gold);
  color: var(--brown);
}

.btn-section-available:hover { background: var(--gold-dark); }

.btn-section-unavailable {
  background: #e5e7eb;
  color: #9ca3af;
  cursor: default;
}

/* === Modal === */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; }
.modal.hidden { display: none; }
.modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.5); }

.modal-content {
  position: relative;
  background: var(--white);
  padding: 28px;
  border-radius: 14px;
  max-width: 440px;
  width: 92%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.modal-content h2 {
  font-size: 1.3rem;
  margin-bottom: 4px;
  color: var(--brown);
}

#modal-game-details {
  background: var(--sand);
  padding: 12px;
  border-radius: 8px;
  margin: 12px 0 16px;
  font-size: 0.9rem;
}

.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 4px; color: var(--brown); }
.form-group input, .form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: var(--font);
}
.form-group input:focus, .form-group textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(255,196,37,0.2);
}

.modal-buttons { display: flex; gap: 10px; margin-top: 18px; }

.btn-primary {
  flex: 1;
  background: var(--gold);
  color: var(--brown);
  font-weight: 700;
  border: none;
  padding: 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.2s;
}

.btn-primary:hover { background: var(--gold-dark); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-cancel {
  padding: 12px 20px;
  border: 1px solid #ddd;
  background: var(--white);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  color: #666;
}

/* === Toast === */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--brown);
  color: var(--white);
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  z-index: 200;
  transition: opacity 0.3s;
}

.toast.hidden { opacity: 0; pointer-events: none; }
.toast.error { background: var(--red); }
.toast.success { background: var(--green); }

/* === My Games === */
.mygames-lookup {
  background: var(--white);
  border-radius: 10px;
  padding: 24px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  margin-bottom: 20px;
}

.mygames-lookup h2 {
  font-size: 1.3rem;
  margin-bottom: 4px;
  color: var(--brown);
}

.mygames-lookup p {
  font-size: 0.9rem;
  color: #777;
  margin-bottom: 16px;
}

.mygames-input-row {
  display: flex;
  gap: 8px;
  max-width: 400px;
  margin: 0 auto;
}

.mygames-input-row input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: var(--font);
}

.mygames-input-row input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(255,196,37,0.2);
}

.mygames-input-row .btn-primary {
  flex: none;
  padding: 10px 20px;
}

.mygames-count {
  font-size: 1rem;
  color: var(--brown);
  margin-bottom: 12px;
}

/* === Empty State === */
.empty-state {
  text-align: center;
  padding: 48px 16px;
  color: #999;
  font-size: 1rem;
}

/* === Admin Styles === */
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.admin-header a { color: var(--gold); text-decoration: none; font-weight: 600; }

#login-section {
  max-width: 340px;
  margin: 60px auto;
  text-align: center;
}

#login-section input {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 1rem;
  margin-bottom: 12px;
}

#login-section button {
  width: 100%;
  padding: 12px;
  background: var(--gold);
  color: var(--brown);
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--white);
  padding: 16px;
  border-radius: 10px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.stat-card .number { font-size: 2rem; font-weight: 700; color: var(--brown); }
.stat-card .label { font-size: 0.8rem; color: #777; margin-top: 2px; }

.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  margin-bottom: 24px;
}

.admin-table th {
  background: var(--brown);
  color: var(--white);
  padding: 10px 12px;
  text-align: left;
  font-size: 0.8rem;
  font-weight: 600;
}

.admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #eee;
  font-size: 0.85rem;
}

.admin-table tr:last-child td { border-bottom: none; }

.btn-small {
  padding: 4px 12px;
  border: none;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-danger { background: #fee2e2; color: #dc2626; }
.btn-danger:hover { background: #fecaca; }

.admin-select {
  padding: 4px 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.8rem;
}

.section-title {
  font-size: 1.1rem;
  margin: 24px 0 12px;
  color: var(--brown);
}

/* === Responsive === */
@media (max-width: 900px) {
  .calendar-grid { grid-template-columns: repeat(2, 1fr); }
  .games-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  header { padding: 24px 16px; }
  header h1 { font-size: 1.4rem; }

  .nav-bar { gap: 6px; }
  .nav-btn { padding: 6px 14px; font-size: 0.8rem; }

  .calendar-grid { grid-template-columns: 1fr; }
  .games-grid { grid-template-columns: 1fr; }

  .modal-content { padding: 20px; width: 96%; }

  .filters { flex-wrap: wrap; }

  .legend { flex-wrap: wrap; gap: 10px; }

  .mygames-input-row { flex-direction: column; }

  .admin-table { font-size: 0.75rem; }
  .admin-table th, .admin-table td { padding: 6px 8px; }
}
