/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --success-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  --warm-gradient: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
  --cool-gradient: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
  --card-bg: rgba(255, 255, 255, 0.1);
  --card-border: rgba(255, 255, 255, 0.2);
  --text-light: rgba(255, 255, 255, 0.9);
  --text-muted: rgba(255, 255, 255, 0.7);
  --shadow: 0 8px 32px rgba(31, 38, 135, 0.37);
  --border-radius: 16px;
}

body {
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
  background: var(--primary-gradient);
  min-height: 100vh;
  color: var(--text-light);
  overflow-x: hidden;
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(
      circle at 20% 80%,
      rgba(120, 119, 198, 0.3) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 80% 20%,
      rgba(255, 119, 198, 0.3) 0%,
      transparent 50%
    );
  pointer-events: none;
  z-index: -1;
}

.dashboard {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
  position: relative;
  z-index: 1;
}

header {
  text-align: center;
  margin-bottom: 40px;
  animation: slideDown 0.8s ease-out;
}

h1 {
  font-size: 3.5rem;
  font-weight: 800;
  margin-bottom: 10px;
  background: linear-gradient(45deg, #fff, rgba(255, 255, 255, 0.8));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.subtitle {
  font-size: 1.2rem;
  color: var(--text-muted);
  margin-bottom: 30px;
}

/* Enhanced search container */
.search-container {
  display: flex;
  gap: 15px;
  margin-bottom: 40px;
  justify-content: center;
  flex-wrap: wrap;
  align-items: center;
}

.search-wrapper {
  position: relative;
  flex-grow: 1;
  max-width: 400px;
}

.search-input {
  width: 100%;
  padding: 16px 20px;
  border: none;
  border-radius: var(--border-radius);
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--card-border);
  color: white;
  font-size: 16px;
  transition: all 0.3s ease;
  box-shadow: var(--shadow);
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-input:focus {
  outline: none;
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(31, 38, 135, 0.5);
  border-color: rgba(255, 255, 255, 0.4);
}

.btn {
  padding: 16px 24px;
  border: none;
  border-radius: var(--border-radius);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
  color: white;
}

.btn-primary {
  background: var(--secondary-gradient);
}

.btn-secondary {
  background: var(--success-gradient);
}

.btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 45px rgba(31, 38, 135, 0.6);
}

.btn:active {
  transform: translateY(-1px);
}

/* Loading animation */
.loading {
  display: none;
  text-align: center;
  padding: 40px;
  animation: pulse 2s infinite;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--card-border);
  border-top: 4px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

/* Current weather card */
.current-weather {
  margin-bottom: 40px;
  animation: slideUp 0.8s ease-out 0.2s both;
}

.current-card {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--card-border);
  border-radius: var(--border-radius);
  padding: 40px;
  text-align: center;
  box-shadow: var(--shadow);
  transition: transform 0.3s ease;
  position: relative;
  overflow: hidden;
}

.current-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    45deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
  transform: translateX(-100%);
  transition: transform 0.6s ease;
}

.current-card:hover::before {
  transform: translateX(100%);
}

.current-location {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 20px;
  color: white;
}

.current-main {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 30px;
  margin: 30px 0;
  flex-wrap: wrap;
}

.weather-icon {
  width: 120px;
  height: 120px;
  filter: drop-shadow(0 4px 20px rgba(0, 0, 0, 0.3));
  animation: float 3s ease-in-out infinite;
}

.current-temp {
  font-size: 4.5rem;
  font-weight: 800;
  color: white;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.weather-description {
  font-size: 1.3rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  text-transform: capitalize;
}

.current-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 20px;
  margin-top: 30px;
}

.detail-item {
  background: rgba(255, 255, 255, 0.1);
  padding: 15px;
  border-radius: 12px;
  text-align: center;
  backdrop-filter: blur(10px);
  transition: transform 0.3s ease;
}

.detail-item:hover {
  transform: translateY(-5px);
}

.detail-label {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 5px;
}

.detail-value {
  color: white;
  font-weight: 600;
  font-size: 1.1rem;
}

/* Forecast section */
.forecast {
  margin-bottom: 40px;
  animation: slideUp 0.8s ease-out 0.4s both;
}

.section-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 25px;
  color: white;
  text-align: center;
}

.forecast-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}

.forecast-card {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--card-border);
  border-radius: var(--border-radius);
  padding: 25px;
  text-align: center;
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.forecast-card::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    45deg,
    transparent,
    rgba(255, 255, 255, 0.05),
    transparent
  );
  transform: rotate(45deg);
  transition: all 0.5s ease;
}

.forecast-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 60px rgba(31, 38, 135, 0.5);
}

.forecast-card:hover::before {
  animation: shimmer 0.8s ease-out;
}

.forecast-day {
  font-weight: 600;
  margin-bottom: 15px;
  color: white;
  font-size: 1.1rem;
}

.forecast-icon {
  width: 60px;
  height: 60px;
  margin: 15px auto;
  filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.3));
}

.forecast-temp {
  font-size: 1.5rem;
  font-weight: 700;
  color: white;
  margin-top: 10px;
}

.forecast-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  text-transform: capitalize;
}

/* Cities list */
.cities-list {
  animation: slideUp 0.8s ease-out 0.6s both;
}

.cities-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
}

.city-card {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--card-border);
  border-radius: var(--border-radius);
  padding: 25px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.city-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(45deg, rgba(255, 255, 255, 0.1), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.city-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 60px rgba(31, 38, 135, 0.5);
}

.city-card:hover::before {
  opacity: 1;
}

.city-name {
  font-size: 1.3rem;
  font-weight: 600;
  color: white;
  margin-bottom: 15px;
}

.city-temp {
  font-size: 2rem;
  font-weight: 800;
  color: white;
  margin-bottom: 5px;
}

.city-condition {
  color: var(--text-muted);
  text-transform: capitalize;
}

/* Error message */
.error-message {
  background: linear-gradient(135deg, #ff6b6b, #ee5a52);
  color: white;
  padding: 15px 25px;
  border-radius: var(--border-radius);
  margin: 20px 0;
  text-align: center;
  box-shadow: var(--shadow);
  animation: shake 0.5s ease-in-out;
}

/* Animations */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%) rotate(45deg);
  }
  100% {
    transform: translateX(200%) rotate(45deg);
  }
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-10px);
  }
  75% {
    transform: translateX(10px);
  }
}

/* Responsive design */
@media (max-width: 768px) {
  .dashboard {
    padding: 15px;
  }

  h1 {
    font-size: 2.5rem;
  }

  .search-container {
    flex-direction: column;
    align-items: stretch;
  }

  .current-main {
    flex-direction: column;
    gap: 20px;
  }

  .current-temp {
    font-size: 3.5rem;
  }

  .current-details {
    grid-template-columns: repeat(2, 1fr);
  }

  .forecast-container {
    grid-template-columns: 1fr;
  }

  .cities-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 2rem;
  }

  .current-card {
    padding: 25px;
  }

  .current-temp {
    font-size: 3rem;
  }

  .current-details {
    grid-template-columns: 1fr;
  }
}
