/*WeatherWave */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

/* ---------- CSS Variables / Design Tokens ---------- */
:root {
  --glass-bg: rgba(255, 255, 255, 0.10);
  --glass-border: rgba(255, 255, 255, 0.22);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  --glass-inner-bg: rgba(255, 255, 255, 0.07);
  --text-primary: #f0f4ff;
  --text-secondary: rgba(240, 244, 255, 0.70);
  --text-accent: #a5c8ff;
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 10px;
  --transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- Resets ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ---------- Dynamic Backgrounds ---------- */
body {
  font-family: 'Outfit', sans-serif;
  min-height: 100vh;
  color: var(--text-primary);
  overflow-x: hidden;
  transition: background 1.2s ease;
  position: relative;
}

/* Default – clear sky */
body.weather-default {
  background: linear-gradient(135deg, #0f2027 0%, #203a43 45%, #2c5364 100%);
}
/* Clear / Sunny */
body.weather-clear {
  background: linear-gradient(135deg, #f7971e 0%, #ffd200 40%, #ff6b35 100%);
}
/* Cloudy */
body.weather-clouds {
  background: linear-gradient(135deg, #4b6cb7 0%, #6a85b6 50%, #bac8e0 100%);
}
/* Rain / Drizzle */
body.weather-rain, body.weather-drizzle {
  background: linear-gradient(135deg, #1c3144 0%, #2c5f8a 50%, #4a90b8 100%);
}
/* Thunderstorm */
body.weather-thunderstorm {
  background: linear-gradient(135deg, #0d0d0d 0%, #1a1a2e 40%, #16213e 100%);
}
/* Snow */
body.weather-snow {
  background: linear-gradient(135deg, #83a4d4 0%, #b6c8e8 50%, #e8f0fb 100%);
}
/* Mist / Fog / Haze */
body.weather-mist, body.weather-fog, body.weather-haze, body.weather-smoke, body.weather-dust {
  background: linear-gradient(135deg, #606c88 0%, #8a9eb5 50%, #c0cedb 100%);
}
/* Evening / Night hint */
body.weather-night {
  background: linear-gradient(135deg, #0a0a23 0%, #1a1a4e 50%, #0d1b4b 100%);
}

/* ---------- Animated Particles ---------- */
.bg-particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.particle {
  position: absolute;
  border-radius: 50%;
  animation: floatUp linear infinite;
  opacity: 0;
}

@keyframes floatUp {
  0%   { transform: translateY(110vh) scale(0.5); opacity: 0; }
  10%  { opacity: 0.35; }
  90%  { opacity: 0.15; }
  100% { transform: translateY(-10vh) scale(1.2);  opacity: 0; }
}

/* ---------- App Wrapper ---------- */
.app-wrapper {
  position: relative;
  z-index: 1;
  max-width: 680px;
  margin: 0 auto;
  padding: 28px 20px 48px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: 100vh;
}

/* ---------- Header ---------- */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon { font-size: 2rem; animation: spin 18s linear infinite; display: inline-block; }

@keyframes spin {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.logo-text {
  font-size: 1.6rem;
  font-weight: 800;
  background: linear-gradient(90deg, #a5c8ff, #ffffff, #c3e0ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

.geo-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  padding: 9px 18px;
  border-radius: 50px;
  font-family: 'Outfit', sans-serif;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: var(--transition);
}

.geo-btn:hover {
  background: rgba(255,255,255,0.20);
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(0,0,0,0.25);
}

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

/* ---------- Search ---------- */
.search-section { width: 100%; }

.search-container {
  display: flex;
  gap: 12px;
  align-items: center;
}

.search-box {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 50px;
  padding: 0 16px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: var(--transition);
  box-shadow: var(--glass-shadow);
}

.search-box:focus-within {
  border-color: rgba(255,255,255,0.5);
  background: rgba(255,255,255,0.16);
  box-shadow: 0 0 0 3px rgba(165, 200, 255, 0.25), var(--glass-shadow);
}

.search-icon { flex-shrink: 0; opacity: 0.7; }

#cityInput {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: 'Outfit', sans-serif;
  font-size: 1rem;
  padding: 14px 0;
}

#cityInput::placeholder { color: rgba(240,244,255,0.45); }

.clear-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 4px 6px;
  border-radius: 50%;
  transition: var(--transition);
  display: none;
}

.clear-btn:hover { background: rgba(255,255,255,0.15); color: var(--text-primary); }
.clear-btn.visible { display: block; }

.search-btn {
  background: linear-gradient(135deg, #4f8ef7, #6faeff);
  border: none;
  color: #fff;
  font-family: 'Outfit', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 14px 28px;
  border-radius: 50px;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 20px rgba(79,142,247,0.5);
  flex-shrink: 0;
}

.search-btn:hover {
  background: linear-gradient(135deg, #3a78eb, #5a9eff);
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(79,142,247,0.6);
}

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

/* ---------- Error Card ---------- */
.error-card {
  display: none;
  align-items: center;
  gap: 14px;
  background: rgba(255, 80, 80, 0.15);
  border: 1px solid rgba(255, 120, 120, 0.35);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  animation: slideDown 0.3s ease;
}

.error-card.visible { display: flex; }

.error-icon { font-size: 1.6rem; }

.error-card p {
  font-size: 0.95rem;
  color: rgba(255, 200, 200, 0.95);
}

/* ---------- Loader ---------- */
.loader {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 32px;
}

.loader.visible { display: flex; }

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255,255,255,0.15);
  border-top-color: #a5c8ff;
  border-radius: 50%;
  animation: rotate 0.85s linear infinite;
}

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

.loader p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 400;
}

/* ---------- Glass Utility ---------- */
.glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--glass-shadow), inset 0 1px 0 rgba(255,255,255,0.12);
}

.glass-inner {
  background: var(--glass-inner-bg);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: var(--radius-sm);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* ---------- Weather Card ---------- */
.weather-card {
  padding: 32px;
  display: none;
  flex-direction: column;
  gap: 24px;
  animation: slideDown 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.weather-card.visible { display: flex; }

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Card Header */
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.location-info h1 {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
  background: linear-gradient(90deg, #ffffff, #c3e0ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.country {
  margin-top: 4px;
  font-size: 0.95rem;
  color: var(--text-secondary);
  font-weight: 400;
}

.date-time {
  text-align: right;
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* Main Weather */
.main-weather {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.weather-icon-big {
  font-size: 6rem;
  line-height: 1;
  animation: iconBounce 3s ease-in-out infinite;
  filter: drop-shadow(0 6px 20px rgba(0,0,0,0.3));
}

@keyframes iconBounce {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-8px); }
}

.temp-block {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.temperature {
  font-size: 5rem;
  font-weight: 800;
  line-height: 1;
  background: linear-gradient(145deg, #ffffff, #a5c8ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.unit-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.unit-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: 'Outfit', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  padding: 3px 8px;
  border-radius: 6px;
  transition: var(--transition);
}

.unit-btn.active {
  background: rgba(165,200,255,0.25);
  color: #a5c8ff;
}

.unit-btn:hover:not(.active) { color: var(--text-primary); }

/* Weather Description */
.weather-desc {
  text-align: center;
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: capitalize;
  letter-spacing: 0.3px;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.stat-card {
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: var(--transition);
}

.stat-card:hover {
  background: rgba(255,255,255,0.12);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

.stat-icon { font-size: 1.6rem; flex-shrink: 0; }

.stat-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-label {
  font-size: 0.72rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 500;
}

.stat-value {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* Sunrise / Sunset */
.sun-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  background: var(--glass-inner-bg);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: var(--radius-md);
  padding: 16px 24px;
}

.sun-item {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 1.8rem;
}

.sun-item > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sun-label {
  font-size: 0.72rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.sun-val {
  font-size: 1rem;
  font-weight: 600;
  display: block;
}

.sun-divider {
  width: 1px;
  height: 40px;
  background: rgba(255,255,255,0.2);
  margin: 0 16px;
}

/* ---------- API Notice ---------- */
.api-notice {
  padding: 32px;
  display: flex;
  align-items: flex-start;
  gap: 20px;
  animation: slideDown 0.4s ease;
}

.api-notice.hidden { display: none; }

.notice-icon { font-size: 2.4rem; flex-shrink: 0; margin-top: 2px; }

.notice-body { flex: 1; }

.notice-body h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 8px;
  background: linear-gradient(90deg, #ffffff, #a5c8ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.notice-body p {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

.notice-body strong { color: var(--text-primary); }

.api-input-row {
  display: flex;
  gap: 10px;
  margin: 16px 0 10px;
}

.api-input-row input {
  flex: 1;
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: 'Outfit', sans-serif;
  font-size: 0.9rem;
  outline: none;
  transition: var(--transition);
}

.api-input-row input:focus {
  border-color: rgba(165,200,255,0.6);
  background: rgba(255,255,255,0.13);
}

.api-input-row input::placeholder { color: rgba(240,244,255,0.35); }

.api-input-row button, #saveApiKey {
  background: linear-gradient(135deg, #4f8ef7, #6faeff);
  border: none;
  color: #fff;
  font-family: 'Outfit', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.api-input-row button:hover, #saveApiKey:hover {
  background: linear-gradient(135deg, #3a78eb, #5a9eff);
  transform: translateY(-1px);
}

.notice-hint {
  font-size: 0.82rem !important;
  color: rgba(240,244,255,0.45) !important;
}

.notice-hint a { color: #a5c8ff; text-decoration: none; }
.notice-hint a:hover { text-decoration: underline; }

/* ---------- Powered Badge ---------- */
.powered-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 13px 22px;
  font-size: 0.88rem;
  color: var(--text-secondary);
  text-align: center;
}

.powered-badge a { color: var(--text-accent); text-decoration: none; }
.powered-badge a:hover { text-decoration: underline; }
.powered-badge strong { color: var(--text-primary); }

/* ---------- Footer ---------- */
.app-footer {
  margin-top: auto;
  text-align: center;
  font-size: 0.8rem;
  color: rgba(240,244,255,0.35);
}

.app-footer a { color: var(--text-accent); text-decoration: none; }
.app-footer a:hover { text-decoration: underline; }

/* ---------- Responsive ---------- */
@media (max-width: 520px) {
  .app-wrapper { padding: 20px 14px 40px; }
  .logo-text { font-size: 1.3rem; }
  .geo-btn span { display: none; }
  .geo-btn { padding: 9px 12px; }
  .weather-card { padding: 22px; }
  .weather-icon-big { font-size: 4.5rem; }
  .temperature { font-size: 3.8rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .location-info h1 { font-size: 1.6rem; }
  .api-notice { flex-direction: column; }
  .api-input-row { flex-direction: column; }
  .search-container { flex-direction: column; }
  .search-btn { width: 100%; }
}
