/* ============================================
   Weather App - Visual Effects & Styles
   Features: Glassmorphism, smooth transitions, responsive layout
   ============================================ */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  min-height: 100vh;
}

/* ============================================
   APP CONTAINER & BACKGROUND
   ============================================ */

.app-container {
  min-height: 100vh;
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  position: relative;
  display: flex;
  flex-direction: column;
  /* Fallback background color in case image fails to load */
  background-color: #1e3a5f;
  background-image: url('https://images.unsplash.com/photo-1513635269975-59663e0ac1ad?w=1920&q=80');
  /* Smooth cross-fade transition for background changes */
  transition: background-image 0.5s ease-in-out;
}

/* ============================================
   OVERLAY EFFECTS
   ============================================ */

.overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* Sky-blue tint gradient overlay */
.overlay-tint {
  background: linear-gradient(to bottom, 
    rgba(56, 189, 248, 0.2),   /* sky-400/20 at top */
    rgba(125, 211, 252, 0.1),  /* sky-300/10 in middle */
    rgba(254, 243, 199, 0.05)  /* amber-200/05 at bottom */
  );
}

/* Brightness overlay for sunny effect */
.overlay-bright {
  background-color: rgba(255, 255, 255, 0.05);
}

/* ============================================
   HEADER
   ============================================ */

.header {
  position: relative;
  z-index: 10;
  width: 100%;
  padding: 1rem 1.5rem;
}

.header-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: white;
  text-align: center;
  text-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

/* ============================================
   MAIN CONTENT LAYOUT
   ============================================ */

.main-content {
  position: relative;
  z-index: 10;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.content-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  width: 100%;
  max-width: 28rem;
}

/* ============================================
   SEARCH FORM (Glassmorphism)
   ============================================ */

.search-form {
  width: 100%;
  max-width: 220px;
  position: relative;
}

.search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1rem;
  height: 1rem;
  color: rgba(255, 255, 255, 0.7);
}

.search-input {
  width: 100%;
  padding: 0.5rem 0.75rem 0.5rem 2.25rem;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0.5rem;
  color: white;
  font-size: 0.875rem;
  outline: none;
  transition: all 0.2s ease;
}

.search-input::placeholder {
  color: rgba(255, 255, 255, 0.8);
}

.search-input:focus {
  border-color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.15);
}

/* ============================================
   LOADING STATE
   ============================================ */

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 3rem 0;
}

.spinner {
  width: 2.5rem;
  height: 2.5rem;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.loading-text {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.875rem;
}

/* ============================================
   ERROR STATE
   ============================================ */

.error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  background: rgba(239, 68, 68, 0.2);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(248, 113, 113, 0.3);
  border-radius: 0.75rem;
  padding: 1.5rem;
  text-align: center;
  max-width: 100%;
}

.error-icon {
  width: 2rem;
  height: 2rem;
  color: rgba(252, 165, 165, 0.9);
}

.error-message {
  color: white;
  font-size: 0.875rem;
  line-height: 1.5;
}

/* ============================================
   WEATHER DISPLAY
   ============================================ */

.weather-display {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.weather-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  text-align: center;
  padding: 1rem 0;
}

.weather-main-icon {
  color: white;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.3));
}

.weather-main-icon svg {
  width: 4rem;
  height: 4rem;
}

.location-name {
  font-size: 1.25rem;
  font-weight: 500;
  color: white;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.temperature {
  font-size: 6rem;
  font-weight: 300;
  color: white;
  text-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
  letter-spacing: -0.05em;
  line-height: 1;
}

.condition {
  font-size: 1.25rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* ============================================
   GLASSMORPHISM PANELS
   ============================================ */

.panels-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.panel {
  padding: 1rem;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* ============================================
   METRICS PANEL
   ============================================ */

.metrics-panel {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}

.metric-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.metric-icon {
  width: 1.5rem;
  height: 1.5rem;
  color: white;
}

.metric-label {
  font-size: 0.625rem;
  color: rgba(255, 255, 255, 0.9);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.metric-value {
  font-size: 0.875rem;
  font-weight: 600;
  color: white;
}

/* ============================================
   FORECAST PANEL
   ============================================ */

.forecast-panel {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.forecast-title {
  font-size: 0.6875rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  text-align: center;
}

.forecast-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}

.forecast-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.375rem;
  padding: 0.625rem 0.5rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 0.75rem;
}

.forecast-day {
  font-size: 0.75rem;
  font-weight: 500;
  color: white;
}

.forecast-icon {
  color: white;
}

.forecast-icon svg {
  width: 1.5rem;
  height: 1.5rem;
}

.forecast-temp {
  font-size: 0.875rem;
  font-weight: 600;
  color: white;
}

/* ============================================
   INITIAL STATE
   ============================================ */

.initial-state {
  text-align: center;
  padding: 3rem 0;
}

.initial-icon {
  color: rgba(255, 255, 255, 0.8);
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.3));
  margin-bottom: 1rem;
}

.initial-icon svg {
  width: 5rem;
  height: 5rem;
  margin: 0 auto;
}

.initial-text {
  color: rgba(255, 255, 255, 0.7);
  font-size: 1.125rem;
}

/* ============================================
   FOOTER
   ============================================ */

.footer {
  position: relative;
  z-index: 10;
  width: 100%;
  padding: 1rem 1.5rem;
}

.footer-text {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.6);
  text-align: center;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.hidden {
  display: none !important;
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

@media (max-width: 480px) {
  .temperature {
    font-size: 4.5rem;
  }
  
  .metrics-panel {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }
  
  .forecast-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }
}
