/* ============================================
   WEATHER APP — style.css
   Aesthetic: Dark cosmic / atmospheric
   Fonts: Outfit (display), Space Mono (data)
   ============================================ */

/* ── CSS Variables ── */
:root {
  --card-bg: rgba(30, 15, 60, 0.72);
  --card-border: rgba(180, 140, 255, 0.25);
  --accent: #b97eff;
  --accent-glow: rgba(185, 126, 255, 0.45);
  --text-primary: #f0eaff;
  --text-secondary: rgba(220, 200, 255, 0.7);
  --input-bg: rgba(255, 255, 255, 0.08);
  --btn-bg: linear-gradient(135deg, #7c3aed, #a855f7);
  --btn-hover: linear-gradient(135deg, #9333ea, #c084fc);
  --shadow-card: 0 25px 60px rgba(0,0,0,0.5), 0 0 40px rgba(140, 80, 255, 0.2);
  --radius: 24px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Outfit', sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
  transition: background 1s ease;
  position: relative;
}

/* ── Day / Night backgrounds ── */
/* ── Day / Night backgrounds ── */
body.day-mode {
  background: linear-gradient(160deg, #60a5fa 0%, #a78bfa 45%, #f9a8d4 100%);
}
/* Yağışlı day modları için override — JS ile body'e class eklenir */
body.day-mode.weather-rain {
  background: linear-gradient(160deg, #374151 0%, #4b5563 40%, #6b7280 100%);
}
body.day-mode.weather-thunderstorm {
  background: linear-gradient(160deg, #1f2937 0%, #374151 40%, #4c1d95 100%);
}
body.day-mode.weather-clouds {
  background: linear-gradient(160deg, #4b5563 0%, #6b7280 45%, #9ca3af 100%);
}
body.day-mode.weather-drizzle {
  background: linear-gradient(160deg, #475569 0%, #64748b 45%, #7c8fa3 100%);
}
body.day-mode.weather-snow {
  background: linear-gradient(160deg, #93c5fd 0%, #bfdbfe 45%, #e0f2fe 100%);
}
body.day-mode.weather-mist {
  background: linear-gradient(160deg, #6b7280 0%, #9ca3af 45%, #d1d5db 100%);
}
body.night-mode {
  background: linear-gradient(160deg, #0a0014 0%, #150030 50%, #0d001a 100%);
}

/* ── Background animation layer ── */
.bg-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

/* ── Star layer (night) ── */
.star-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
  opacity: 0;
  transition: opacity 1s ease;
}
body.night-mode .star-layer { opacity: 1; }

/* ── Mode toggle ── */
.mode-toggle {
  position: fixed;
  top: 20px;
  right: 24px;
  z-index: 100;
  font-size: 1.6rem;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 50%;
  width: 52px;
  height: 52px;
  cursor: pointer;
  transition: var(--transition);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.mode-toggle:hover {
  transform: scale(1.12) rotate(15deg);
  background: rgba(255,255,255,0.25);
}

/* ── Weather Card ── */
.weather-card {
  position: relative;
  z-index: 10;
  width: min(480px, 92vw);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 2.5rem 2rem 2rem;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

/* ── App Title ── */
.app-title {
  font-family: 'Space Mono', monospace;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.25em;
  color: var(--accent);
  text-shadow: 0 0 20px var(--accent-glow);
  user-select: none;
}

/* ── Search Area ── */
.search-area {
  display: flex;
  width: 100%;
  gap: 0.6rem;
}

#city-input {
  flex: 1;
  padding: 0.8rem 1.2rem;
  border-radius: 14px;
  border: 1px solid rgba(180,140,255,0.3);
  background: var(--input-bg);
  color: var(--text-primary);
  font-family: 'Outfit', sans-serif;
  font-size: 1rem;
  outline: none;
  backdrop-filter: blur(8px);
  transition: var(--transition);
}
#city-input::placeholder { color: var(--text-secondary); }
#city-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(185, 126, 255, 0.2);
}

.search-btn {
  padding: 0.8rem 1.4rem;
  border-radius: 14px;
  border: none;
  background: var(--btn-bg);
  color: #fff;
  font-family: 'Outfit', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 15px rgba(124, 58, 237, 0.4);
  white-space: nowrap;
}
.search-btn:hover {
  background: var(--btn-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(168, 85, 247, 0.5);
}
.search-btn:active { transform: translateY(0); }

/* ── Weather Display ── */
.weather-display {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  animation: fadeSlideUp 0.5s ease;
}
.weather-display.hidden { display: none; }

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

.weather-icon {
  width: 96px;
  height: 96px;
  object-fit: contain;
  filter: drop-shadow(0 0 12px var(--accent-glow));
  animation: float 4s ease-in-out infinite;
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-8px); }
}

.city-name {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 0.3rem;
  letter-spacing: 0.04em;
}

.temperature {
  font-family: 'Space Mono', monospace;
  font-size: 3.2rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 0 30px rgba(255,255,255,0.3);
  line-height: 1;
}

.description {
  font-size: 1rem;
  color: var(--accent);
  text-transform: capitalize;
  letter-spacing: 0.06em;
  margin-bottom: 0.6rem;
}

/* ── Details Grid ── */
.details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
  width: 100%;
  margin-top: 0.4rem;
}
.detail-item {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(180,140,255,0.15);
  border-radius: 14px;
  padding: 0.8rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.detail-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-secondary);
}
.detail-value {
  font-family: 'Space Mono', monospace;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* ── Loading ── */
.loading {
  display: flex;
  justify-content: center;
  padding: 1rem;
}
.loading.hidden { display: none; }
.spinner {
  width: 36px; height: 36px;
  border: 3px solid rgba(185,126,255,0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Error Message ── */
.error-msg {
  color: #f87171;
  font-size: 0.95rem;
  text-align: center;
  padding: 0.5rem 1rem;
  background: rgba(248,113,113,0.1);
  border-radius: 10px;
  border: 1px solid rgba(248,113,113,0.25);
  width: 100%;
}
.error-msg.hidden { display: none; }

/* ── Test Panel ── */
.test-panel {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  gap: 0.6rem;
}
.test-btn, .stop-btn {
  padding: 0.55rem 1.2rem;
  border-radius: 50px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(30,15,60,0.75);
  color: #e0d0ff;
  font-family: 'Outfit', sans-serif;
  font-size: 0.85rem;
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: var(--transition);
}
.test-btn:hover { background: rgba(100,50,200,0.6); }
.stop-btn { color: #f87171; }
.stop-btn:hover { background: rgba(200,50,50,0.4); }
.stop-btn.hidden { display: none; }

/* ============================================
   BACKGROUND ANIMATION ELEMENTS
   ============================================ */

/* ── SUN ── */
.anim-sun {
  position: absolute;
  top: 6%;
  right: 10%;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff9c4, #fde047, #f59e0b);
  box-shadow: 0 0 60px 20px rgba(253,224,71,0.5), 0 0 120px 40px rgba(245,158,11,0.25);
  animation: sunPulse 4s ease-in-out infinite;
}
@keyframes sunPulse {
  0%,100% { box-shadow: 0 0 60px 20px rgba(253,224,71,0.5), 0 0 120px 40px rgba(245,158,11,0.25); }
  50%      { box-shadow: 0 0 80px 30px rgba(253,224,71,0.7), 0 0 160px 60px rgba(245,158,11,0.35); }
}

/* ── CLOUD (generic drifting) ── */
.anim-cloud {
  position: absolute;
  background: rgba(255,255,255,0.75);
  border-radius: 50px;
  filter: blur(2px);
  animation: driftCloud linear infinite;
}
.anim-cloud::before, .anim-cloud::after {
  content: '';
  position: absolute;
  background: inherit;
  border-radius: 50%;
}
@keyframes driftCloud {
  from { transform: translateX(-20vw); }
  to   { transform: translateX(120vw); }
}

/* ── RAIN DROP ── */
.anim-rain {
  position: absolute;
  top: -20px;
  width: 2px;
  border-radius: 2px;
  background: linear-gradient(to bottom, transparent, rgba(147,197,253,0.8));
  animation: fallRain linear infinite;
}
@keyframes fallRain {
  from { transform: translateY(-20px); opacity: 0.8; }
  to   { transform: translateY(105vh); opacity: 0; }
}

/* ── SNOW FLAKE ── */
.anim-snow {
  position: absolute;
  top: -20px;
  border-radius: 50%;
  background: rgba(255,255,255,0.85);
  animation: fallSnow linear infinite;
}
@keyframes fallSnow {
  0%   { transform: translateY(-20px) rotate(0deg) translateX(0); opacity: 0.9; }
  50%  { transform: translateY(50vh) rotate(180deg) translateX(15px); }
  100% { transform: translateY(105vh) rotate(360deg) translateX(-10px); opacity: 0; }
}

/* ── LIGHTNING ── */
.anim-lightning {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.18);
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  animation: lightning 6s ease-in-out infinite;
}
@keyframes lightning {
  0%,94%,100% { opacity: 0; }
  95%,97%     { opacity: 1; }
  96%,98%     { opacity: 0; }
}

/* ── STARS ── */
.star {
  position: absolute;
  background: #fff;
  border-radius: 50%;
  animation: twinkle ease-in-out infinite;
}
@keyframes twinkle {
  0%,100% { opacity: 0.2; transform: scale(1); }
  50%     { opacity: 1;   transform: scale(1.4); }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 480px) {
  .weather-card { padding: 2rem 1.4rem 1.6rem; }
  .temperature  { font-size: 2.5rem; }
  .app-title    { font-size: 1.3rem; }
  .weather-icon { width: 76px; height: 76px; }
}