/* =========================================================
   SkyCast — Weather App Stylesheet
   Dark, premium, glassmorphism theme
   ========================================================= */

:root {
  --bg-deep: #0b1120;
  --bg-navy: #101a30;
  --accent-cyan: #5eead4;
  --accent-blue: #60a5fa;
  --accent-amber: #fbbf24;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --glass-bg: rgba(255, 255, 255, 0.06);
  --glass-border: rgba(255, 255, 255, 0.14);
  --error-red: #f87171;

  --font-display: "Poppins", sans-serif;
  --font-body: "Poppins", sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* --- Animated Gradient Background --- */
.background-gradient {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(135deg, var(--bg-deep) 0%, var(--bg-navy) 45%, #1e2a4a 100%);
  background-size: 200% 200%;
  animation: gradientShift 18s ease infinite;
}

.background-gradient::before,
.background-gradient::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.35;
}

.background-gradient::before {
  width: 420px;
  height: 420px;
  background: var(--accent-blue);
  top: -100px;
  left: -100px;
}

.background-gradient::after {
  width: 380px;
  height: 380px;
  background: var(--accent-cyan);
  bottom: -120px;
  right: -80px;
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* --- Layout --- */
.app-container {
  max-width: 480px;
  margin: 0 auto;
  padding: 48px 20px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.app-header {
  text-align: center;
  animation: fadeInDown 0.7s ease both;
}

.app-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2.1rem;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.app-title-icon {
  font-size: 1.8rem;
}

.app-subtitle {
  color: var(--text-secondary);
  font-size: 0.92rem;
  margin-top: 6px;
  font-weight: 300;
}

/* --- Glassmorphism base --- */
.glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

/* --- Search --- */
.search-card {
  width: 100%;
  padding: 10px;
  animation: fadeInUp 0.7s ease 0.1s both;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 12px 14px;
}

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

.search-btn {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-cyan));
  border: none;
  color: #0b1120;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  flex-shrink: 0;
}

.search-btn:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 6px 18px rgba(96, 165, 250, 0.4);
}

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

/* --- State cards (loading / error) --- */
.state-card {
  width: 100%;
  padding: 32px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
  color: var(--text-secondary);
  animation: fadeIn 0.4s ease both;
}

.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.error-card {
  border-color: rgba(248, 113, 113, 0.35);
}

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

#errorMessage {
  color: #fecaca;
  font-size: 0.95rem;
  max-width: 320px;
}

/* --- Weather Card --- */
.weather-card {
  width: 100%;
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  animation: fadeInUp 0.5s ease both;
}

.weather-main {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.location-block .city-name {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
}

.date-time {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-top: 4px;
}

.weather-icon {
  width: 64px;
  height: 64px;
  filter: drop-shadow(0 4px 10px rgba(96, 165, 250, 0.3));
}

.temp-block {
  text-align: center;
  padding: 8px 0;
}

.temperature {
  font-family: var(--font-display);
  font-size: 3.6rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1;
}

.description {
  text-transform: capitalize;
  color: var(--text-primary);
  font-size: 1rem;
  margin-top: 8px;
}

.feels-like {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-top: 4px;
}

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

.detail-item {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
  transition: transform 0.2s ease, background 0.2s ease;
}

.detail-item:hover {
  transform: translateY(-3px);
  background: rgba(255, 255, 255, 0.08);
}

.detail-label {
  font-size: 0.7rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.detail-value {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent-cyan);
}

/* --- Footer --- */
.app-footer {
  color: var(--text-secondary);
  font-size: 0.75rem;
  text-align: center;
  margin-top: 12px;
  opacity: 0.7;
}

/* --- Utility --- */
.hidden {
  display: none !important;
}

/* --- Animations --- */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

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

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

/* --- Responsive --- */
@media (max-width: 420px) {
  .temperature {
    font-size: 3rem;
  }

  .details-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

@media (min-width: 700px) {
  .app-container {
    max-width: 560px;
    padding-top: 64px;
  }
}
