/* ===========================
   CSS Custom Properties
   =========================== */
:root {
  /* Light mode (default) */
  --bg: #FFF9F5;
  --surface: #FFFFFF;
  --surface-alt: #FFF0E8;
  --text: #2D2D2D;
  --text-secondary: #666666;
  --primary: #FF6B6B;
  --primary-hover: #FF5252;
  --secondary: #4ECDC4;
  --secondary-hover: #3DBDB5;
  --border: #E8DDD5;
  --shadow: rgba(180, 140, 110, 0.12);
  --shadow-hover: rgba(180, 140, 110, 0.22);
  --field-bg: #FFFFFF;
  --field-text: #2D2D2D;
  --field-border: #E8DDD5;
  --field-placeholder: #999999;
  --badge-free-bg: #E8F5E9;
  --badge-free-text: #2E7D32;
  --badge-low-bg: #FFF8E1;
  --badge-low-text: #F57F17;
  --badge-mid-bg: #FFF3E0;
  --badge-mid-text: #E65100;
  --badge-high-bg: #FFEBEE;
  --badge-high-text: #C62828;
  --callout-bg: #FFF8E1;
  --callout-border: #FFE082;
  --booking-bg: #E3F2FD;
  --booking-text: #1565C0;
}

[data-theme="dark"] {
  --bg: #1A1A2E;
  --surface: #2D2D3F;
  --surface-alt: #363650;
  --text: #E8E8F0;
  --text-secondary: #A0A0B8;
  --primary: #FF7B7B;
  --primary-hover: #FF9090;
  --secondary: #5ED8CF;
  --secondary-hover: #7AE4DD;
  --border: #404058;
  --shadow: rgba(0, 0, 0, 0.3);
  --shadow-hover: rgba(0, 0, 0, 0.45);
  --field-bg: #363650;
  --field-text: #E8E8F0;
  --field-border: #4A4A64;
  --field-placeholder: #8888A0;
  --badge-free-bg: #1B3B1E;
  --badge-free-text: #66BB6A;
  --badge-low-bg: #3B3420;
  --badge-low-text: #FFD54F;
  --badge-mid-bg: #3B2A1A;
  --badge-mid-text: #FFB74D;
  --badge-high-bg: #3B1A1A;
  --badge-high-text: #EF9A9A;
  --callout-bg: #3B3420;
  --callout-border: #6B5B30;
  --booking-bg: #1A2A3B;
  --booking-text: #64B5F6;
}

/* ===========================
   Base / Reset
   =========================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Nunito', sans-serif;
  font-weight: 400;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg);
  transition: background-color 0.3s, color 0.3s;
  min-height: 100vh;
  padding-bottom: 32px;
}

/* ===========================
   Header
   =========================== */
.header {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #FFFFFF;
  text-align: center;
  padding: 32px 16px 24px;
  position: relative;
}

.header__title {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.header__subtitle {
  font-size: 0.95rem;
  font-weight: 500;
  opacity: 0.9;
}

.theme-toggle {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 1.2rem;
  cursor: pointer;
  transition: background 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.35);
}

/* ===========================
   Main Content
   =========================== */
.main {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
}

/* ===========================
   Form
   =========================== */
.form__fieldset {
  border: none;
  background: var(--surface);
  border-radius: 14px;
  padding: 20px 16px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px var(--shadow);
  transition: background-color 0.3s, box-shadow 0.3s;
}

.form__legend {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 12px;
}

.form__group {
  margin-bottom: 12px;
}

.form__group:last-child {
  margin-bottom: 0;
}

.form__group--inline {
  display: inline-flex;
  flex-direction: column;
  width: calc(50% - 6px);
}

.form__group--inline:first-child {
  margin-right: 12px;
}

.form__label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.form__input,
.form__select,
.form__textarea {
  width: 100%;
  padding: 10px 12px;
  font-family: 'Nunito', sans-serif;
  font-size: 0.95rem;
  color: var(--field-text);
  background-color: var(--field-bg);
  border: 1.5px solid var(--field-border);
  border-radius: 8px;
  transition: border-color 0.2s, background-color 0.3s, color 0.3s;
  min-height: 44px;
}

.form__input:focus,
.form__select:focus,
.form__textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.15);
}

.form__input::placeholder,
.form__textarea::placeholder {
  color: var(--field-placeholder);
}

.form__select {
  appearance: menulist;
  cursor: pointer;
}

input[type="date"] {
  -webkit-appearance: none;
  color: var(--field-text);
  background-color: var(--field-bg);
}

input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  filter: var(--text-secondary);
}

[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.7);
}

.form__textarea {
  resize: vertical;
  min-height: 80px;
}

.form__checkboxes {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.form__checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  cursor: pointer;
  min-height: 44px;
}

.form__checkbox-label input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* ===========================
   Child Entries
   =========================== */
.child-entry {
  background: var(--surface-alt);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 12px;
  transition: background-color 0.3s;
}

.child-entry.pop-in {
  animation: popIn 0.3s ease-out;
}

@keyframes popIn {
  0% {
    opacity: 0;
    transform: scale(0.9);
  }
  60% {
    transform: scale(1.02);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.child-entry__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.child-entry__label {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
}

.child-entry__fields {
  display: flex;
  flex-wrap: wrap;
}

.child-entry__remove {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background-color 0.2s;
  font-family: 'Nunito', sans-serif;
}

.child-entry__remove:hover {
  background-color: rgba(255, 107, 107, 0.1);
}

/* ===========================
   Buttons
   =========================== */
.btn {
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
  min-height: 44px;
}

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

.btn--primary {
  background-color: var(--primary);
  color: #FFFFFF;
  font-size: 1.05rem;
  padding: 14px 24px;
}

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

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

.btn--secondary {
  background-color: var(--secondary);
  color: #FFFFFF;
  font-size: 0.9rem;
  padding: 8px 16px;
}

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

.btn--small {
  font-size: 0.85rem;
  padding: 8px 14px;
  border-radius: 8px;
}

.btn--full {
  width: 100%;
}

.btn--outline {
  background: transparent;
  border: 1.5px solid var(--primary);
  color: var(--primary);
  padding: 8px 14px;
  font-size: 0.85rem;
}

.btn--outline:hover {
  background-color: var(--primary);
  color: #FFFFFF;
}

.btn--outline-secondary {
  background: transparent;
  border: 1.5px solid var(--secondary);
  color: var(--secondary);
  padding: 8px 14px;
  font-size: 0.85rem;
}

.btn--outline-secondary:hover {
  background-color: var(--secondary);
  color: #FFFFFF;
}

/* ===========================
   Loading
   =========================== */
.loading {
  text-align: center;
  padding: 48px 16px;
}

.loading__spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading__text {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ===========================
   Error
   =========================== */
.error-message {
  background: var(--badge-high-bg);
  color: var(--badge-high-text);
  padding: 16px;
  border-radius: 10px;
  margin-top: 16px;
  font-weight: 600;
  text-align: center;
}

/* ===========================
   Results
   =========================== */
.results {
  margin-top: 24px;
}

#back-btn {
  margin-bottom: 16px;
}

.results__summary {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 16px;
  line-height: 1.6;
}

/* Weather Bar */
.weather-bar {
  background: var(--surface);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 2px 8px var(--shadow);
  flex-wrap: wrap;
  transition: background-color 0.3s;
}

.weather-bar__emoji {
  font-size: 2rem;
}

.weather-bar__details {
  flex: 1;
}

.weather-bar__condition {
  font-weight: 700;
  font-size: 1rem;
}

.weather-bar__meta {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Events Link */
.events-link {
  display: inline-block;
  color: var(--primary);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  margin-bottom: 16px;
  padding: 8px 0;
}

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

/* Activity Grid */
.activity-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 600px) {
  .activity-grid {
    grid-template-columns: 1fr;
  }
}

/* Activity Card */
.activity-card {
  background: var(--surface);
  border-radius: 14px;
  padding: 20px 16px;
  box-shadow: 0 2px 10px var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s, background-color 0.3s;
  opacity: 0;
  animation: fadeInUp 0.4s ease-out forwards;
  display: flex;
  flex-direction: column;
}

.activity-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px var(--shadow-hover);
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.activity-card__title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 6px;
}

.activity-card__meta {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

/* Badges row */
.activity-card__badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
}

.badge--free {
  background: var(--badge-free-bg);
  color: var(--badge-free-text);
}

.badge--low {
  background: var(--badge-low-bg);
  color: var(--badge-low-text);
}

.badge--mid {
  background: var(--badge-mid-bg);
  color: var(--badge-mid-text);
}

.badge--high {
  background: var(--badge-high-bg);
  color: var(--badge-high-text);
}

.badge--booking {
  background: var(--booking-bg);
  color: var(--booking-text);
}

.activity-card__description {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.55;
  margin-bottom: 12px;
  flex: 1;
}

/* Rain Backup Callout */
.activity-card__rain-backup {
  background: var(--callout-bg);
  border-left: 3px solid var(--callout-border);
  border-radius: 0 8px 8px 0;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 0.85rem;
}

.activity-card__rain-backup strong {
  display: block;
  margin-bottom: 2px;
}

/* Accessibility Notes */
.activity-card__accessibility {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

/* Tips */
.activity-card__tips {
  list-style: none;
  margin-bottom: 14px;
}

.activity-card__tips li {
  font-size: 0.85rem;
  color: var(--text-secondary);
  padding-left: 18px;
  position: relative;
  margin-bottom: 4px;
}

.activity-card__tips li::before {
  content: '\2714';
  position: absolute;
  left: 0;
  color: var(--secondary);
  font-size: 0.8rem;
}

/* Card Actions */
.activity-card__actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

.activity-card__actions .btn {
  flex: 1;
  text-align: center;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  border-radius: 8px;
}

/* ===========================
   Responsive
   =========================== */
@media (max-width: 600px) {
  .header__title {
    font-size: 1.8rem;
  }

  .main {
    padding: 12px;
  }

  .form__fieldset {
    padding: 16px 12px;
  }

  .form__group--inline {
    width: calc(50% - 4px);
  }

  .form__group--inline:first-child {
    margin-right: 8px;
  }
}
