/* CSS Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Font Face Declarations */
@font-face {
  font-family: 'DM Sans';
  src: url('./assets/fonts/DM_Sans/DMSans-VariableFont_opsz,wght.ttf') format('truetype-variations');
  font-weight: 300 700;
  font-display: swap;
}

@font-face {
  font-family: 'Bricolage Grotesque';
  src: url('./assets/fonts/Bricolage_Grotesque/BricolageGrotesque-VariableFont_opsz,wdth,wght.ttf') format('truetype-variations');
  font-weight: 700;
  font-display: swap;
}

/* CSS Custom Properties - Exact colors from style guide */
:root {
  /* Colors */
  --neutral-900: hsl(243, 96%, 9%);
  --neutral-800: hsl(243, 27%, 20%);
  --neutral-700: hsl(243, 23%, 24%);
  --neutral-600: hsl(243, 23%, 30%);
  --neutral-300: hsl(240, 6%, 70%);
  --neutral-200: hsl(250, 6%, 84%);
  --neutral-0: hsl(0, 0%, 100%);
  --orange-500: hsl(28, 100%, 52%);
  --blue-500: hsl(233, 67%, 56%);
  --blue-700: hsl(248, 70%, 36%);
  
  /* Typography */
  --font-body: 'DM Sans', sans-serif;
  --font-heading: 'Bricolage Grotesque', sans-serif;
  --font-size-base: 18px;
  
  /* Spacing */
  --spacing-xs: 8px;
  --spacing-sm: 16px;
  --spacing-md: 24px;
  --spacing-lg: 32px;
  --spacing-xl: 48px;
  --spacing-2xl: 64px;
  
  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  
  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.2);
  
  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
  --transition-slow: 0.4s ease;
}

/* Base Styles */
body {
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  line-height: 1.5;
  color: var(--neutral-0);
  background: var(--neutral-900);
  min-height: 100vh;
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header Styles */
.header {
  padding: 32px 24px;
  background: var(--neutral-900);
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  height: 40px;
  width: auto;
}

/* Units Dropdown */
.units-dropdown {
  position: relative;
}

.units-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--neutral-800);
  border: 1px solid var(--neutral-700);
  border-radius: 12px;
  padding: 16px 20px;
  color: var(--neutral-0);
  font-family: inherit;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-normal);
  min-width: 120px;
}

.units-toggle:hover {
  background: var(--neutral-700);
  border-color: var(--blue-500);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(115, 130, 255, 0.2);
}

.units-toggle:focus {
  outline: 2px solid var(--blue-500);
  outline-offset: 2px;
  background: var(--neutral-700);
  border-color: var(--blue-500);
}

.units-icon {
  width: 20px;
  height: 20px;
}

.dropdown-icon {
  width: 16px;
  height: 16px;
  transition: transform var(--transition-normal);
  margin-left: auto;
}

.units-dropdown.open .dropdown-icon {
  transform: rotate(180deg);
}

.units-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--neutral-800);
  border: 1px solid var(--neutral-700);
  border-radius: 16px;
  padding: 24px;
  min-width: 320px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all var(--transition-normal);
  z-index: 1000;
}

.units-dropdown.open .units-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.units-section {
  margin-bottom: 24px;
}

.units-section:last-child {
  margin-bottom: 0;
}

.units-section h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--neutral-200);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.unit-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.unit-option {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  padding: 12px;
  border-radius: 8px;
  transition: all var(--transition-fast);
}

.unit-option:hover {
  background: var(--neutral-700);
}

.unit-option input[type="radio"] {
  display: none;
}

.checkmark {
  width: 20px;
  height: 20px;
  border: 2px solid var(--neutral-600);
  border-radius: 50%;
  position: relative;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.unit-option input[type="radio"]:checked + .checkmark {
  border-color: var(--blue-500);
  background: var(--blue-500);
}

.unit-option input[type="radio"]:checked + .checkmark::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 8px;
  height: 8px;
  background: var(--neutral-0);
  border-radius: 50%;
}

.unit-option span:not(.checkmark) {
  font-size: 16px;
  font-weight: 500;
  color: var(--neutral-0);
}

/* Main Content */
.main {
  flex: 1;
  padding: 0 24px 48px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

/* Search Section */
.search-section {
  text-align: center;
  margin-bottom: 64px;
}

.search-title {
  font-family: var(--font-heading);
  font-size: 48px;
  font-weight: 700;
  margin-bottom: 48px;
  color: var(--neutral-0);
  line-height: 1.2;
}

.search-container {
  display: flex;
  gap: 16px;
  max-width: 600px;
  margin: 0 auto;
  position: relative;
}

.search-input-wrapper {
  flex: 1;
  position: relative;
}

.search-input {
  width: 100%;
  padding: 20px 24px;
  background: var(--neutral-800);
  border: 1px solid var(--neutral-700);
  border-radius: 16px;
  color: var(--neutral-0);
  font-family: inherit;
  font-size: 16px;
  font-weight: 400;
  transition: all var(--transition-normal);
}

.search-input::placeholder {
  color: var(--neutral-300);
}

.search-input:hover {
  border-color: var(--neutral-600);
  background: var(--neutral-700);
}

.search-input:focus {
  outline: none;
  border-color: var(--blue-500);
  background: var(--neutral-700);
  box-shadow: 0 0 0 3px rgba(115, 130, 255, 0.1);
}

.search-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--neutral-800);
  border: 1px solid var(--neutral-700);
  border-top: none;
  border-radius: 0 0 16px 16px;
  max-height: 240px;
  overflow-y: auto;
  z-index: 100;
  display: none;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.search-suggestions.visible {
  display: block;
}

.suggestion-item {
  padding: 16px 24px;
  cursor: pointer;
  transition: all var(--transition-fast);
  border-bottom: 1px solid var(--neutral-700);
}

.suggestion-item:last-child {
  border-bottom: none;
}

.suggestion-item:hover,
.suggestion-item.highlighted {
  background: var(--neutral-700);
}

.suggestion-name {
  font-weight: 600;
  color: var(--neutral-0);
  font-size: 16px;
  margin-bottom: 4px;
}

.suggestion-details {
  font-size: 14px;
  color: var(--neutral-300);
  font-weight: 400;
}

.search-button {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 32px;
  background: var(--blue-500);
  border: none;
  border-radius: 16px;
  color: var(--neutral-0);
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-normal);
  white-space: nowrap;
}

.search-button:hover {
  background: var(--blue-700);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(115, 130, 255, 0.3);
}

.search-button:focus {
  outline: 2px solid var(--blue-500);
  outline-offset: 2px;
}

.search-button:active {
  transform: translateY(0);
}

.search-button img {
  width: 20px;
  height: 20px;
}

.search-status {
  margin-top: 16px;
  font-size: 14px;
  min-height: 20px;
  font-weight: 500;
}

.search-status.searching {
  color: var(--blue-500);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.search-status.error {
  color: var(--orange-500);
}

.search-loading-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid transparent;
  border-top: 2px solid var(--blue-500);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Weather Content */
.weather-content {
  display: none;
  animation: fadeIn 0.5s ease-in-out;
}

.weather-content.visible {
  display: block;
}

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

/* Current Weather */
.current-weather {
  background: linear-gradient(135deg, var(--neutral-800) 0%, var(--neutral-700) 100%);
  border-radius: 24px;
  padding: 48px;
  margin-bottom: 48px;
  position: relative;
  overflow: hidden;
}

.current-weather::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: url('./assets/images/bg-today-large.svg');
  background-size: cover;
  background-position: center;
  opacity: 0.1;
  pointer-events: none;
}

.current-weather-main {
  display: flex;
  align-items: center;
  gap: 48px;
  margin-bottom: 48px;
  position: relative;
  z-index: 1;
}

.weather-icon-container {
  flex-shrink: 0;
}

.weather-icon {
  width: 120px;
  height: 120px;
  object-fit: contain;
}

.temperature-info {
  flex: 1;
}

.current-temperature {
  font-family: var(--font-heading);
  font-size: 96px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 16px;
  color: var(--neutral-0);
}

.location {
  font-size: 28px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--neutral-0);
}

.date-time {
  font-size: 18px;
  color: var(--neutral-300);
  font-weight: 300;
}

/* Weather Metrics */
.weather-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 32px;
  position: relative;
  z-index: 1;
}

.metric {
  text-align: center;
  padding: 32px 24px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all var(--transition-normal);
}

.metric:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-2px);
}

.metric-label {
  font-size: 14px;
  color: var(--neutral-300);
  margin-bottom: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.metric-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--neutral-0);
}

/* Section Titles */
.section-title {
  font-family: var(--font-heading);
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 32px;
  color: var(--neutral-0);
}

/* Daily Forecast */
.daily-forecast {
  margin-bottom: 48px;
}

.forecast-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 16px;
}

.forecast-day {
  background: var(--neutral-800);
  border: 1px solid var(--neutral-700);
  border-radius: 16px;
  padding: 24px 16px;
  text-align: center;
  transition: all var(--transition-normal);
  cursor: pointer;
}

.forecast-day:hover {
  background: var(--neutral-700);
  border-color: var(--blue-500);
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(115, 130, 255, 0.2);
}

.forecast-day.today {
  background: var(--blue-500);
  border-color: var(--blue-500);
}

.forecast-day.today:hover {
  background: var(--blue-700);
  border-color: var(--blue-700);
}

.forecast-date {
  font-size: 14px;
  color: var(--neutral-300);
  margin-bottom: 16px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.forecast-day.today .forecast-date {
  color: var(--neutral-0);
}

.forecast-icon {
  width: 56px;
  height: 56px;
  margin: 16px auto;
  object-fit: contain;
}

.forecast-temps {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}

.forecast-high {
  font-weight: 700;
  font-size: 20px;
  color: var(--neutral-0);
}

.forecast-low {
  color: var(--neutral-300);
  font-size: 16px;
  font-weight: 500;
}

.forecast-day.today .forecast-low {
  color: var(--neutral-200);
}

/* Hourly Forecast */
.hourly-forecast {
  margin-bottom: 48px;
}

.day-selector {
  display: flex;
  gap: 8px;
  margin-bottom: 32px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.day-button {
  flex-shrink: 0;
  padding: 16px 24px;
  background: var(--neutral-800);
  border: 1px solid var(--neutral-700);
  border-radius: 12px;
  color: var(--neutral-300);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-normal);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.day-button:hover {
  background: var(--neutral-700);
  color: var(--neutral-0);
  border-color: var(--neutral-600);
  transform: translateY(-1px);
}

.day-button.active {
  background: var(--blue-500);
  border-color: var(--blue-500);
  color: var(--neutral-0);
}

.day-button.active:hover {
  background: var(--blue-700);
  border-color: var(--blue-700);
}

.hourly-chart {
  background: var(--neutral-800);
  border: 1px solid var(--neutral-700);
  border-radius: 16px;
  padding: 32px;
  overflow-x: auto;
}

.hourly-grid {
  display: grid;
  grid-template-columns: repeat(24, 1fr);
  gap: 16px;
  min-width: 1000px;
}

.hourly-item {
  text-align: center;
  padding: 16px 8px;
  border-radius: 12px;
  transition: all var(--transition-fast);
}

.hourly-item:hover {
  background: var(--neutral-700);
  transform: translateY(-2px);
}

.hourly-time {
  font-size: 12px;
  color: var(--neutral-300);
  margin-bottom: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.hourly-icon {
  width: 40px;
  height: 40px;
  margin: 12px auto;
  object-fit: contain;
}

.hourly-temp {
  font-size: 16px;
  font-weight: 700;
  margin-top: 12px;
  color: var(--neutral-0);
}

/* Loading State */
.loading-state {
  display: none;
  text-align: center;
  padding: 120px 24px;
  animation: fadeIn 0.3s ease-in-out;
}

.loading-state.visible {
  display: block;
}

.loading-spinner {
  margin-bottom: 32px;
}

.spinner {
  width: 64px;
  height: 64px;
  border: 4px solid var(--neutral-700);
  border-top: 4px solid var(--blue-500);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-state p {
  color: var(--neutral-300);
  font-size: 18px;
  font-weight: 500;
}

/* Error States */
.error-state,
.no-results-state {
  display: none;
  text-align: center;
  padding: 120px 24px;
  animation: fadeIn 0.3s ease-in-out;
}

.error-state.visible,
.no-results-state.visible {
  display: block;
}

.error-icon {
  width: 80px;
  height: 80px;
  margin-bottom: 32px;
  opacity: 0.6;
}

.error-state h3,
.no-results-state h3 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--neutral-0);
}

.error-state p,
.no-results-state p {
  color: var(--neutral-300);
  margin-bottom: 32px;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
  font-weight: 400;
  line-height: 1.6;
  font-size: 16px;
}

.retry-button {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 16px 32px;
  background: var(--blue-500);
  border: none;
  border-radius: 16px;
  color: var(--neutral-0);
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-normal);
}

.retry-button:hover {
  background: var(--blue-700);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(115, 130, 255, 0.3);
}

.retry-button:focus {
  outline: 2px solid var(--blue-500);
  outline-offset: 2px;
}

.retry-button img {
  width: 20px;
  height: 20px;
}

/* Attribution */
.attribution {
  text-align: center;
  padding: 32px 24px;
  font-size: 14px;
  color: var(--neutral-300);
  border-top: 1px solid var(--neutral-800);
  margin-top: auto;
}

.attribution a {
  color: var(--blue-500);
  text-decoration: none;
  transition: color var(--transition-fast);
  font-weight: 600;
}

.attribution a:hover {
  color: var(--blue-700);
}

/* Responsive Design */
@media (max-width: 1024px) {
  .weather-metrics {
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
  }
  
  .forecast-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
  }
  
  .hourly-grid {
    min-width: 800px;
  }
}

@media (max-width: 768px) {
  .header {
    padding: 24px 16px;
  }
  
  .main {
    padding: 0 16px 32px;
  }
  
  .search-title {
    font-size: 36px;
    margin-bottom: 32px;
  }
  
  .search-container {
    flex-direction: column;
  }
  
  .search-button {
    justify-content: center;
  }
  
  .current-weather {
    padding: 32px 24px;
  }
  
  .current-weather-main {
    flex-direction: column;
    text-align: center;
    gap: 32px;
  }
  
  .current-temperature {
    font-size: 72px;
  }
  
  .location {
    font-size: 24px;
  }
  
  .weather-icon {
    width: 100px;
    height: 100px;
  }
  
  .weather-metrics {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
  
  .metric {
    padding: 24px 16px;
  }
  
  .forecast-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
  }
  
  .forecast-day {
    padding: 20px 12px;
  }
  
  .forecast-icon {
    width: 48px;
    height: 48px;
    margin: 12px auto;
  }
  
  .units-menu {
    right: auto;
    left: 0;
    min-width: 280px;
  }
  
  .section-title {
    font-size: 28px;
    margin-bottom: 24px;
  }
  
  .hourly-chart {
    padding: 24px 16px;
  }
  
  .hourly-grid {
    min-width: 600px;
    gap: 12px;
  }
  
  .hourly-item {
    padding: 12px 6px;
  }
  
  .hourly-icon {
    width: 32px;
    height: 32px;
    margin: 8px auto;
  }
}

@media (max-width: 480px) {
  .header {
    padding: 16px;
  }
  
  .main {
    padding: 0 16px 24px;
  }
  
  .search-title {
    font-size: 28px;
  }
  
  .current-temperature {
    font-size: 56px;
  }
  
  .location {
    font-size: 20px;
  }
  
  .weather-metrics {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .forecast-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .day-selector {
    gap: 4px;
  }
  
  .day-button {
    padding: 12px 16px;
    font-size: 12px;
  }
  
  .hourly-grid {
    min-width: 480px;
    gap: 8px;
  }
  
  .units-toggle {
    padding: 12px 16px;
    font-size: 14px;
  }
  
  .units-menu {
    min-width: 260px;
    padding: 20px;
  }
}