/* ===== CSS VARIABLES & GLOBAL STYLES ===== */
:root {
  --primary-color: #6c63ff;
  --secondary-color: #4a44b5;
  --background-color: #121212;
  --surface-color: #1e1e1e;
  --card-background: #252525;
  --text-primary: #ffffff;
  --text-secondary: #b0b0b0;
  --border-radius: 16px;
}

/* Base styles and typography */
body {
  background-color: var(--background-color);
  color: var(--text-primary);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
}

.app-title {
  color: var(--primary-color);
  font-weight: 700;
  margin-bottom: 0.5rem;
  font-size: 2.5rem;
}

.section-title {
  color: var(--text-primary);
  font-weight: 600;
  border-bottom: 2px solid var(--primary-color);
  padding-bottom: 0.5rem;
  display: inline-block;
}

/* ===== SEARCH COMPONENT STYLES ===== */
.search-wrapper {
  margin-bottom: 20px;
}

.search-container {
  position: relative;
  background: var(--surface-color);
  border-radius: var(--border-radius);
  padding: 15px 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  border: 2px solid transparent;
}

.search-container:focus-within {
  border-color: var(--primary-color);
  box-shadow: 0 4px 25px rgba(108, 99, 255, 0.3);
}

.search-input {
  background: transparent;
  border: none;
  color: var(--text-primary);
  padding: 0 0 0 40px;
  font-size: 18px;
  width: 100%;
  transition: color 0.3s ease;
  outline: none;
}

.search-input::placeholder {
  color: var(--text-secondary);
}

.search-input:-webkit-autofill,
.search-input:-webkit-autofill:hover,
.search-input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text-primary) !important;
  -webkit-box-shadow: 0 0 0px 1000px var(--surface-color) inset !important;
  transition: background-color 5000s ease-in-out 0s;
}

.search-icon {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  font-size: 18px;
}

/* ===== CURRENT WEATHER COMPONENT STYLES ===== */
.weather-card {
  border: none;
  border-radius: var(--border-radius);
  background: var(--card-background);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  overflow: hidden;
}

.weather-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.4);
}

.current-weather {
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--secondary-color)
  );
  color: white;
}

.current-weather .weather-details {
  background: rgba(255, 255, 255, 0.1);
  padding: 20px;
  border-radius: var(--border-radius);
  margin-top: 20px;
}

.weather-icon-img {
  width: 80px;
  height: 80px;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
}

.temperature {
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.condition {
  font-size: 1.2rem;
  opacity: 0.9;
}

.city-name {
  font-size: 1.8rem;
  font-weight: 700;
}

.last-updated {
  opacity: 0.8;
  font-size: 0.9rem;
}

.detail-item {
  display: flex;
  align-items: center;
  font-size: 0.95rem;
}

/* ===== FORECAST COMPONENT STYLES ===== */
.forecast-container {
  display: flex;
  gap: 15px;
  align-items: stretch;
}

.forecast-card {
  background: var(--card-background);
  border-radius: var(--border-radius);
  padding: 20px;
  transition: flex 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
    transform 0.3s ease, border-color 0.3s ease, background-color 0.3s ease;
  cursor: pointer;
  border: 2px solid transparent;
  flex: 1;
  min-height: 280px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.forecast-card:hover {
  border-color: var(--primary-color);
  transform: translateY(-3px);
}

.forecast-card.active {
  flex: 2;
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--secondary-color)
  );
  color: white;
  border-color: var(--primary-color);
}

.forecast-card .weather-icon-img {
  width: 60px;
  height: 60px;
  transition: transform 0.3s ease;
}

.forecast-card.active .weather-icon-img {
  transform: scale(1.1);
}

.forecast-day {
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 10px;
  font-size: 1.1rem;
  transition: color 0.3s ease;
}

.forecast-card.active .forecast-day {
  color: white;
}

.forecast-temp {
  font-size: 1.8rem;
  font-weight: 700;
  margin: 5px 0;
  transition: font-size 0.3s ease;
}

.forecast-card.active .forecast-temp {
  font-size: 2rem;
}

.forecast-condition {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 10px;
  transition: color 0.3s ease;
}

.forecast-card.active .forecast-condition {
  color: rgba(255, 255, 255, 0.9);
}

.forecast-details {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.4s ease, opacity 0.4s ease, margin-top 0.3s ease,
    padding-top 0.3s ease;
}

.forecast-card.active .forecast-details {
  max-height: 300px;
  opacity: 1;
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

/* Rain probability styles */
.rain-bar-container {
  height: 8px;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  overflow: hidden;
  margin: 10px 0;
}

.rain-bar {
  height: 100%;
  background: linear-gradient(to right, #4facfe, #00f2fe);
  border-radius: 10px;
  transition: width 0.5s ease;
}

.rain-chance {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.forecast-card.active .rain-chance {
  color: rgba(255, 255, 255, 0.9);
}

/* ===== RECENT SEARCHES COMPONENT STYLES ===== */
.recent-search-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--border-radius);
  height: 350px;
  cursor: pointer;
  transition: transform 0.3s ease;
  margin-bottom: 15px;
}

.recent-search-card:hover {
  transform: scale(1.03);
}

.recent-search-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.recent-search-card:hover img {
  transform: scale(1.1);
}

.recent-search-card .city-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));
  color: white;
  padding: 20px 15px;
  transition: background 0.3s ease;
}

.recent-search-card:hover .city-overlay {
  background: linear-gradient(
    to top,
    rgba(108, 99, 255, 0.8),
    rgba(108, 99, 255, 0)
  );
}

.btn-clear {
  background: rgba(255, 107, 107, 0.1);
  color: #ff6b6b;
  border: 1px solid rgba(255, 107, 107, 0.3);
  padding: 8px 15px;
  border-radius: 8px;
  font-size: 0.9rem;
  transition: background 0.3s ease, color 0.3s ease, transform 0.3s ease;
}

.btn-clear:hover {
  background: rgba(255, 107, 107, 0.2);
  color: #ff6b6b;
  transform: translateY(-2px);
}

/* ===== UTILITY COMPONENT STYLES ===== */
/* Loading spinner */
.spinner-border {
  width: 3rem;
  height: 3rem;
}

/* ===== RESPONSIVE STYLES ===== */
@media (max-width: 768px) {
  .container {
    padding: 15px;
  }

  .app-title {
    font-size: 2rem;
  }

  .weather-icon-img {
    width: 60px;
    height: 60px;
  }

  .temperature {
    font-size: 2.5rem;
  }

  .city-name {
    font-size: 1.5rem;
  }

  .recent-search-card {
    height: 180px;
  }

  .forecast-container {
    flex-direction: column;
    gap: 10px;
  }

  .forecast-card {
    min-height: 200px;
  }

  .forecast-card.active {
    flex: 1;
  }
}
