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

:root {
  /* Color System */
  --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%);

  /* Semantic Colors */
  --background: var(--neutral-900);
  --foreground: var(--neutral-0);
  --card: var(--neutral-800);
  --card-foreground: var(--neutral-0);
  --secondary: var(--neutral-700);
  --secondary-foreground: var(--neutral-0);
  --muted: var(--neutral-600);
  --muted-foreground: var(--neutral-300);
  --primary: var(--blue-500);
  --primary-foreground: var(--neutral-0);
  --border: var(--neutral-700);

  /* Typography */
  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading: 'Bricolage Grotesque', -apple-system, BlinkMacSystemFont, sans-serif;
  
  /* Gradients */
  --gradient-primary: linear-gradient(135deg, var(--primary), var(--blue-700));
  --gradient-orange: linear-gradient(135deg, var(--orange-500), hsl(45, 100%, 58%));
  
  /* Shadows */
  --shadow-sm: 0 2px 8px hsla(243, 96%, 9%, 0.1);
  --shadow-md: 0 4px 16px hsla(243, 96%, 9%, 0.15);
  --shadow-lg: 0 8px 32px hsla(243, 96%, 9%, 0.2);
  
  /* Transitions */
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.6;
  color: var(--foreground);
  background-color: var(--background);
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Header */
.header {
  padding: 2rem 0;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo img {
  width: 10.5rem;
  height: 6rem;
}

.logo-icon {
  width: 2rem;
  height: 2rem;
  background: var(--gradient-orange);
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
}

.logo-text {
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--foreground);
}

/* Units Toggle */
.units-toggle {
  position: relative;
}

.units-button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background-color: var(--secondary);
  color: var(--foreground);
  border: none;
  border-radius: 0.5rem;
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: var(--transition);
}

.units-button:hover {
  background-color: var(--muted);
}

.icon {
  width: 1rem;
  height: 1rem;
}

.dropdown-arrow {
  transition: transform 0.2s;
}

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

.units-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  box-shadow: var(--shadow-lg);
  min-width: 16rem;
  z-index: 20;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-0.5rem);
  transition: var(--transition);
}

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

.units-content {
  padding: 1rem;
}

.unit-section {
  margin-bottom: 1rem;
}

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

.unit-label {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  margin-bottom: 0.5rem;
}

.unit-buttons {
  display: flex;
  gap: 0.5rem;
  flex-direction: column;
  width: 100%;
}

.unit-btn {
  padding: 0.375rem;
  width: 100%;
  height: 30px;
  border: none;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  cursor: pointer;
  background-color: var(--card);
  transition: var(--transition);
  color: var(--foreground);
  text-align: start;
}

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

.unit-btn.active {
  background-color: var(--neutral-600);
  color: var(--primary-foreground);
}
.unit-btn.active::after {
  content: " ✓"; 
  font-weight: bold;
  color: whitesmoke;
  float: right;
}

.unit-btn:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Main Content */
.main {
  padding: 0 0 4rem;
}

.title-section {
  text-align: center;
  margin-bottom: 2rem;
}

.main-title {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  color: var(--foreground);
  line-height: 1.2;
}

/* Search */
.search-section {
  max-width: 28rem;
  margin: 0 auto 2rem;
}

.search-form {
  position: relative;
}

.search-input-container {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 1rem;
  color: var(--muted-foreground);
  z-index: 2;
  top: 1.1rem;
}

.search-input {
  width: 100%;
  padding: 1rem 1rem 1rem 3rem;
  font-size: 1.125rem;
  background-color: var(--card);
  border: 2px solid var(--border);
  border-radius: 1rem;
  color: var(--foreground);
  transition: var(--transition);
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px hsla(233, 67%, 56%, 0.1);
}

.search-input::placeholder {
  color: var(--muted-foreground);
}

.search-button {
  position: absolute;
  right: 0.5rem;
  top: 0.5rem;
  bottom: 0.5rem;
  padding: 0 1.5rem;
  background-color: var(--primary);
  color: var(--primary-foreground);
  border: none;
  border-radius: 0.5rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.search-button:hover:not(:disabled) {
  background-color: var(--blue-700);
}

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

.suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 0.5rem;
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  box-shadow: var(--shadow-lg);
  z-index: 10;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-0.5rem);
  transition: var(--transition);
}

.suggestions.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.suggestion-item {
  padding: 0.75rem 1rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}

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

.suggestion-item:last-child {
  border-bottom: none;
  border-radius: 0 0 0.75rem 0.75rem;
}

.suggestion-item:first-child {
  border-radius: 0.75rem 0.75rem 0 0;
}

.suggestion-name {
  color: var(--foreground);
  font-weight: 500;
}

.suggestion-detail {
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

/* Error Message */
.error-message {
  text-align: center;
  color: hsl(0, 100%, 67%);
  font-size: 1.125rem;
  margin-bottom: 2rem;
}

/* Weather Content */
.weather-content {
  margin-top: 2rem;
}

.weather-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

@media (min-width: 1024px) {
  .weather-grid {
    grid-template-columns: 2fr 1fr;
  }
}

.weather-left {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Current Weather */
.current-weather {
  background: var(--gradient-primary);
  border-radius: 1rem;
  padding: 2rem;
  color: var(--neutral-0);
  position: relative;
  overflow: hidden;
}

.weather-bg-decoration {
  position: absolute;
  top: -4rem;
  right: -4rem;
  width: 8rem;
  height: 8rem;
  background: hsla(0, 0%, 100%, 0.1);
  border-radius: 50%;
}

.weather-bg-decoration-2 {
  position: absolute;
  bottom: -3rem;
  left: -3rem;
  width: 6rem;
  height: 6rem;
  background: hsla(0, 0%, 100%, 0.05);
  border-radius: 50%;
}

.current-weather-content {
  position: relative;
  z-index: 1;
}

.current-weather-info {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.weather-main{
  display: flex;
  align-items: center;
  gap: 2rem;
}

@media (min-width: 1024px) {
  .current-weather-info {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}

.location-name {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.location-date {
  color: hsla(0, 0%, 100%, 0.8);
  font-size: 1.125rem;
}

.weather-display {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.weather-icon {
  font-size: 3.75rem;
}

.current-temp {
  font-family: var(--font-heading);
  font-size: clamp(3rem, 8vw, 4rem);
  font-weight: 700;
  line-height: 1;
}

.weather-condition {
  color: hsla(0, 0%, 100%, 0.8);
  font-size: 1.25rem;
  margin-top: 0.5rem;
}

/* Weather Metrics */
.weather-metrics {
  border-radius: 1rem;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
}

.metric-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background-color: var(--secondary);
  border-radius: 0.75rem;
  transition: var(--transition);
}

.metric-card:hover {
  transform: translateY(-0.125rem);
  box-shadow: var(--shadow-md);
}

.metric-icon {
  font-size: 1.5rem;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-primary);
  border-radius: 0.5rem;
}

.metric-label {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  margin-bottom: 0.25rem;
}

.metric-value {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--foreground);
}

/* Daily Forecast */
.daily-forecast {
  border-radius: 1rem;
}

.forecast-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: 1rem;
}

.daily-forecast-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.75rem;
}

@media (min-width: 1024px) {
  .daily-forecast-grid {
    grid-template-columns: repeat(7, 1fr);
  }
}

.daily-forecast-item {
  padding: 1rem;
  background-color: var(--secondary);
  border: 2px solid transparent;
  border-radius: 0.75rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}

.daily-forecast-item:hover {
  background-color: var(--muted);
}

.daily-forecast-item.active {
  border-color: var(--primary);
  background-color: hsla(233, 67%, 56%, 0.2);
}

.daily-day {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  margin-bottom: 0.75rem;
}

.daily-icon {
  font-size: 1.875rem;
  margin-bottom: 0.75rem;
}

.daily-high {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: 0.25rem;
}

.daily-low {
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

/* Hourly Forecast */
.hourly-forecast {
  background-color: var(--card);
  border-radius: 1rem;
  padding: 1.5rem;
  height: fit-content;
}

.hourly-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.day-selector {
  background-color: var(--secondary);
  color: var(--foreground);
  border: none;
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  cursor: pointer;
}

.hourly-forecast-list {
  max-height: 24rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  scrollbar-width: thin;
  scrollbar-color: var(--muted) var(--card);
  scrollbar-gutter: stable;
}

.hourly-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem;
  background-color: var(--secondary);
  border-radius: 0.5rem;
  transition: var(--transition);
}

.hourly-item:hover {
  background-color: var(--muted);
}

.hourly-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.hourly-icon {
  font-size: 1.5rem;
}

.hourly-time {
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

.hourly-temp {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--foreground);
}

/* Loading States */
.loading {
  opacity: 0.7;
  pointer-events: none;
}

.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

.loading-indicator {
  text-align: center;
  color: var(--neutral-0);
}

.loading-dots {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 1rem;
}

.dot {
  width: 0.5rem;
  height: 0.5rem;
  background-color: var(--neutral-0);
  border-radius: 50%;
  animation: loading-pulse 1.4s ease-in-out infinite both;
}

.dot:nth-child(1) { animation-delay: -0.32s; }
.dot:nth-child(2) { animation-delay: -0.16s; }
.dot:nth-child(3) { animation-delay: 0s; }

@keyframes loading-pulse {
  0%, 80%, 100% { 
    transform: scale(0.8);
    opacity: 0.5;
  } 
  40% { 
    transform: scale(1);
    opacity: 1;
  }
}

.loading-text {
  font-size: 1.125rem;
  color: var(--neutral-0);
  margin: 0;
}

.loading-value {
  font-size: 1.5rem;
  color: var(--muted-foreground);
}

.skeleton {
  background-color: var(--secondary);
  animation: skeleton-pulse 2s ease-in-out infinite;
  min-height: 80px;
}

.attribution {
  width: 100%;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem;
  font-size: 1rem;
  color: var(--muted-foreground);
}
.attribution img {
  width: 20px;
  height: 20px;
}
.attribution a {
  color: var(--primary);
  text-decoration: none;
}
.attribution a:hover {
  text-decoration: underline;
  transition: var(--transition);
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    padding: 0 1rem;
  }
  
  .header {
    padding: 1rem 0;
  }
  
  .main-title {
    font-size: 2rem;
  }
  
  .current-weather {
    padding: 1.5rem;
  }
  
  .weather-display {
    flex-direction: column;
    text-align: center;
    gap: 1rem;
  }
  
  .weather-temp-info {
    text-align: center;
  }
  
  .metrics-grid {
    grid-template-columns: 1fr;
  }
  
  .daily-forecast-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@keyframes skeleton-pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}