/* ---- Design tokens ---- */
:root {
  --color-text: #1F2937;
  --color-muted: #6B7280;
  --color-border: #E5E7EB;
  --color-primary: #2F80ED;
  --color-primary-dark: #1C64D1;
  --color-accent-wear: #1B9C85;
  --color-accent-bring: #2F80ED;
  --color-warning-text: #B45309;
  --color-warning-bg: #FEF3C7;
  --color-error-text: #B91C1C;
  --color-error-bg: #FEE2E2;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow-card: 0 16px 40px rgba(31, 41, 55, 0.08), 0 2px 8px rgba(31, 41, 55, 0.04);
}

/* Base */
body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #EAF4FD 0%, #F7FAFC 55%, #F9FAFB 100%);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--color-text);
}

/* Card */
.card {
  max-width: 660px;
  margin: 1.5rem auto;
  background-color: #FFFFFF;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 1.75rem;
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 1.75rem;
}

.header-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.app-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.header h1 {
  font-size: 1.6rem;
  font-weight: 700;
  margin: 0;
}

.subtitle {
  font-size: 0.95rem;
  color: var(--color-muted);
  margin: 0.4rem 0 0 0;
}

/* Search panel: groups city, date, and the button into one unit */
.search-panel {
  background-color: #F8FAFC;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.field {
  display: flex;
  flex-direction: column;
}

.field label {
  font-size: 0.85rem;
  color: var(--color-muted);
  margin-bottom: 0.35rem;
}

.field input {
  height: 44px;
  font-size: 1rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  background-color: #FFFFFF;
}

.field input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(47, 128, 237, 0.15);
}

.field input.invalid-field {
  border-color: var(--color-warning-text);
}

/* Button */
.button {
  width: 100%;
  height: 44px;
  background-color: var(--color-primary);
  color: #FFFFFF;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

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

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

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

/* State area */
.state-area {
  margin-top: 1.5rem;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
}

.empty-icon {
  font-size: 2.5rem;
  line-height: 1;
  margin-bottom: 0.75rem;
}

.empty-title {
  font-weight: 600;
  color: var(--color-text);
  margin: 0 0 0.35rem 0;
}

.empty-text {
  color: var(--color-muted);
  margin: 0 0 0.25rem 0;
}

.empty-hint {
  font-size: 0.875rem;
  color: var(--color-muted);
  margin: 0;
}

/* Loading state */
.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 2.5rem 1rem;
  color: var(--color-muted);
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Banner (used for error and invalid input states) */
.banner {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  margin: 0;
}

.banner-error {
  background-color: var(--color-error-bg);
  color: var(--color-error-text);
  border-left: 4px solid var(--color-error-text);
}

.banner-invalid {
  background-color: var(--color-warning-bg);
  color: var(--color-warning-text);
  border-left: 4px solid var(--color-warning-text);
}

/* Weather result */
.weather-result {
  background-color: #F5FAFF;
  border: 1px solid #E3EEFC;
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.weather-header {
  margin: 0 0 0.5rem 0;
}

.weather-location {
  font-weight: 700;
  font-size: 1.2rem;
}

.weather-date {
  color: var(--color-muted);
}

.weather-summary-text {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 1rem 0;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
}

.chip {
  background-color: #FFFFFF;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.7rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.chip-label {
  display: block;
  color: var(--color-muted);
  font-weight: 500;
  font-size: 0.75rem;
  margin-bottom: 0.2rem;
}

/* Recommendation sections (What to Wear / What to Bring) */
.recommendation-section {
  margin-top: 1rem;
  background-color: #FAFBFC;
  border: 1px solid var(--color-border);
  border-top: 3px solid var(--color-accent-wear);
  border-radius: var(--radius-md);
  padding: 1rem 1.1rem;
}

/* The second recommendation section rendered is always "What to Bring"
   (script.js always outputs Wear, then Bring, in that order). */
.recommendation-section + .recommendation-section {
  border-top-color: var(--color-accent-bring);
}

.recommendation-header {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.5rem 0;
}

.recommendation-list {
  margin: 0;
  padding-left: 1.1rem;
}

.recommendation-list li {
  margin-bottom: 0.5rem;
}

.recommendation-list li:last-child {
  margin-bottom: 0;
}

.recommendation-empty {
  margin: 0;
  color: var(--color-muted);
  font-size: 0.9rem;
}

/* Responsive layout */
@media (min-width: 601px) {
  .card {
    margin: 3rem auto;
    padding: 2.25rem;
  }

  .form {
    flex-direction: row;
    align-items: flex-end;
    flex-wrap: wrap;
  }

  .field {
    flex: 1;
  }

  .field:first-child {
    flex: 1.5;
  }

  .button {
    width: auto;
    padding: 0 1.5rem;
  }

  .stats-row {
    grid-template-columns: repeat(4, 1fr);
  }
}
