/* Beautiful Morphed Background with Glowing Orbs */
@keyframes morph {
  0% { border-radius: 40% 60% 70% 30% / 40% 40% 60% 50%; transform: rotate(0deg); }
  34% { border-radius: 70% 30% 50% 50% / 30% 30% 70% 70%; transform: rotate(45deg); }
  67% { border-radius: 100% 60% 60% 100% / 100% 100% 60% 60%; transform: rotate(90deg); }
  100% { border-radius: 40% 60% 70% 30% / 40% 40% 60% 50%; transform: rotate(0deg); }
}

:root {
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.15);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  color: white;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  /* Deep dark rich background as base */
  background: #0d1117;
  overflow-x: hidden;
  position: relative;
}

/* Base Body Morph Elements (Behind content) */
body::before, body::after {
  content: "";
  position: fixed;
  width: 60vw;
  height: 60vw;
  max-width: 800px;
  max-height: 800px;
  transform-origin: center;
  z-index: -1;
  filter: blur(80px); /* Heavy blur to create atmospheric soft lighting */
  opacity: 0.6;
}

body::before {
  top: -10%;
  left: -10%;
  background: linear-gradient(135deg, #FF6B6B, #4ECDC4);
  animation: morph 20s ease-in-out infinite alternate;
}

body::after {
  bottom: -10%;
  right: -10%;
  background: linear-gradient(135deg, #1A2980, #26D0CE);
  animation: morph 25s ease-in-out infinite alternate-reverse;
  animation-delay: -5s;
}

/* Base Layout Container */
.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}

.page-title {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  text-align: center;
  margin: 0;
  letter-spacing: 2px;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.header-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  margin-bottom: 0.5rem;
}

.brand-logo {
  width: 60px;
  height: 60px;
  filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.2));
  transition: transform 0.3s ease;
}

.header-logo:hover .brand-logo {
  transform: rotate(10deg) scale(1.1);
}

.location-info {
  text-align: center;
}

#city {
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  font-weight: bold;
  margin: 0;
  text-transform: capitalize;
}

#place {
  font-size: clamp(1rem, 2vw, 1.2rem);
  margin: 0.5rem 0 0;
  opacity: 0.8;
}

/* Glassmorphism Utilities */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  box-shadow: var(--glass-shadow);
}

/* Main Weather Card */
.main-weather-card {
  width: 100%;
  max-width: 600px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 30px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem;
  box-sizing: border-box;
}

#temp {
  font-size: clamp(5rem, 15vw, 9rem);
  font-weight: 200;
  line-height: 1;
  margin: 0;
}

.condition {
  font-size: clamp(1.2rem, 3vw, 1.5rem);
  color: #e0e0e0;
  margin: 1rem 0;
  text-transform: capitalize;
}

.aqi-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(0, 0, 0, 0.2);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 1.1rem;
}

.aqi-badge img {
  width: 24px;
  height: auto;
}

/* Grid Layout for details */
.weather-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  width: 100%;
  max-width: 1000px;
}

/* Hover Scale Animation */
.zoom-hover {
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
}

.zoom-hover:hover {
  transform: translateY(-5px) scale(1.02);
  box-shadow: 0 15px 45px rgba(0, 0, 0, 0.3);
}

/* Individual Grid Cards */
.grid-card {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  box-shadow: var(--glass-shadow);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  min-height: 200px;
}

/* Forecast Card - occupies full width on larger screens if desired, but 100% of auto-fit otherwise */
.forecast {
  grid-column: 1 / -1;
  min-height: auto;
  padding: 1rem;
}

.forecast table {
  width: 100%;
  border-collapse: collapse;
  text-align: center;
  font-size: clamp(1rem, 2.5vw, 1.2rem);
}

.forecast td {
  padding: 0.8rem 0;
  vertical-align: middle;
}

.forecast img {
  width: 40px;
  height: auto;
  vertical-align: middle;
}

.gradient-bar {
  width: 100%;
  min-width: 50px;
  height: 6px;
  background: linear-gradient(to right, #34d399, #fbbf24, #ef4444);
  border-radius: 10px;
  margin: 0 auto;
}

/* Card Typography */
.card-title {
  font-size: 1.2rem;
  color: #d1d5db;
  margin: 0 0 1rem 0;
  font-weight: 500;
  z-index: 2;
}

.card-value {
  font-size: 3rem;
  margin: 0;
  font-weight: bold;
  font-family: 'Impact', 'Arial Black', sans-serif;
  letter-spacing: 1px;
  z-index: 2;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.card-value.time {
  font-size: 2.2rem;
}

.unit {
  font-size: 1.2rem;
  font-weight: normal;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  opacity: 0.8;
  text-shadow: none;
}

/* Card Icons */
.card-icon {
  position: absolute;
  right: -20px;
  bottom: -20px;
  width: 140px;
  height: 140px;
  opacity: 0.3;
  z-index: 1;
  transition: opacity 0.3s ease, transform 0.3s ease;
  object-fit: contain;
}

.grid-card:hover .card-icon {
  opacity: 0.6;
  transform: scale(1.1);
}

/* UV Specific Styles */
.uv-status {
  font-size: 2.2rem;
  margin: 0;
  font-weight: bold;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.uv-value {
  position: absolute;
  right: 1.5rem;
  bottom: 1.5rem;
  font-size: 4rem;
  font-weight: bold;
  opacity: 0.5;
  font-family: 'Impact', 'Arial Black', sans-serif;
}

/* UV Status Colors */
.text-green { color: #a3e635; }
.text-yellow { color: #facc15; }
.text-orange { color: #fb923c; }
.text-red { color: #f87171; }
.text-purple { color: #c084fc; }

/* Search Section */
.search-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  width: 100%;
  max-width: 500px;
  margin-top: 1rem;
  margin-bottom: 2rem;
}

.search-section form {
  display: flex;
  width: 100%;
  gap: 0.5rem;
}

#cityInput {
  flex-grow: 1;
  padding: 1rem 1.5rem;
  border: none;
  border-radius: 30px;
  font-size: 1rem;
  background: rgba(255, 255, 255, 0.9);
  color: #333;
  outline: none;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  transition: box-shadow 0.3s ease, background 0.3s ease;
}

#cityInput:focus {
  box-shadow: 0 4px 20px rgba(255, 255, 255, 0.4);
  background: white;
}

.primary-btn {
  padding: 0 1.5rem;
  border: none;
  border-radius: 30px;
  background: linear-gradient(135deg, #0ea5e9, #2563eb);
  color: white;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  white-space: nowrap;
}

.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.primary-btn:active {
  transform: translateY(0);
}

/* Location Button (Modern UI) */
.location-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0.8rem 1.5rem;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 30px;
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 100%;
}

.location-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.svgIcon {
  width: 20px;
  height: 20px;
  fill: white;
  transition: transform 0.5s ease;
}

.location-btn:hover .svgIcon {
  transform: rotate(360deg);
}

/* Fallback for error messages */
.error-msg {
  background: rgba(239, 68, 68, 0.2);
  padding: 1rem 2rem;
  border-radius: 10px;
  border: 1px solid rgba(239, 68, 68, 0.5);
  margin: 1rem 0;
  font-weight: bold;
}

/* Responsive adjustments for smaller mobile devices */
@media (max-width: 480px) {
  .search-section form {
    flex-direction: column;
  }
  
  .primary-btn {
    padding: 1rem;
  }
}
