/* RESET SIMPLE */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-gradient-start: #4f46e5;
  --bg-gradient-end: #0ea5e9;
  --card-bg: rgba(255, 255, 255, 0.98);
  --card-border: rgba(148, 163, 184, 0.4);
  --primary: #3b82f6;
  --primary-soft: rgba(59, 130, 246, 0.1);
  --danger: #ef4444;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --shadow-soft: 0 18px 40px rgba(15, 23, 42, 0.25);
  --radius-lg: 18px;
  --radius-md: 12px;
  --transition-fast: 0.18s ease-out;
  --transition-med: 0.25s ease;
  --font-main: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

html,
body {
  height: 100%;
}

body {
  font-family: var(--font-main);
  background: radial-gradient(
    circle at top left,
    var(--bg-gradient-start),
    var(--bg-gradient-end)
  );
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
}

/* LAYOUT DE BASE */

.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.main {
  padding-top: 80px;
}

/* TOPBAR */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(14px);
  background: linear-gradient(
    to right,
    rgba(15, 23, 42, 0.75),
    rgba(15, 23, 42, 0.55)
  );
  border-bottom: 1px solid rgba(148, 163, 184, 0.35);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: #e5e7eb;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.logo-icon {
  font-size: 1.3rem;
}

.logo-text {
  font-size: 1.05rem;
}

.nav-links {
  display: flex;
  gap: 1.2rem;
}

.nav-links a {
  color: #cbd5f5;
  font-size: 0.92rem;
  text-decoration: none;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  transition: background-color var(--transition-fast),
    color var(--transition-fast), transform var(--transition-fast);
}

.nav-links a:hover {
  background-color: rgba(148, 163, 184, 0.25);
  color: #f9fafb;
  transform: translateY(-1px);
}

/* HERO */

.hero {
  padding: 2.8rem 0 1.5rem;
}

.hero-card {
  background: rgba(15, 23, 42, 0.85);
  border-radius: 24px;
  padding: 2.1rem;
  box-shadow: 0 22px 45px rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.5);
  color: #e5e7eb;
}

.hero-card h1 {
  font-size: clamp(1.6rem, 2.1vw, 2rem);
  margin-bottom: 0.4rem;
}

.hero-subtitle {
  color: #cbd5f5;
  font-size: 0.98rem;
  margin-bottom: 1.3rem;
}

.search-row {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.input-wrapper {
  flex: 1 1 220px;
}

#city-input {
  width: 100%;
  padding: 0.78rem 0.95rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.7);
  background: rgba(15, 23, 42, 0.75);
  color: #e5e7eb;
  font-size: 0.96rem;
  outline: none;
  transition: border-color var(--transition-fast),
    box-shadow var(--transition-fast), background var(--transition-fast);
}

#city-input::placeholder {
  color: #9ca3af;
}

#city-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.85);
  background: rgba(15, 23, 42, 0.95);
}

/* BOUTONS */

.btn {
  border-radius: 999px;
  padding: 0.72rem 1.1rem;
  border: 1px solid transparent;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  transition: background-color var(--transition-fast),
    border-color var(--transition-fast), color var(--transition-fast),
    transform var(--transition-fast), box-shadow var(--transition-fast);
  white-space: nowrap;
}

.btn.primary {
  background-color: var(--primary);
  color: white;
  box-shadow: 0 14px 30px rgba(37, 99, 235, 0.55);
}

.btn.primary:hover {
  background-color: #2563eb;
  transform: translateY(-1px);
  box-shadow: 0 18px 40px rgba(37, 99, 235, 0.7);
}

.btn.ghost {
  border-color: rgba(148, 163, 184, 0.7);
  color: #e5e7eb;
  background: rgba(15, 23, 42, 0.55);
}

.btn.ghost:hover {
  background: rgba(15, 23, 42, 0.9);
  border-color: #e5e7eb;
}

/* ALERTES */

.alert {
  border-radius: var(--radius-md);
  padding: 0.8rem 1rem;
  font-size: 0.9rem;
}

.alert-error {
  background-color: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.65);
  color: #fecaca;
}

.hidden {
  display: none !important;
}

/* SECTIONS */

.section {
  padding: 1.5rem 0 2rem;
}

.section-light {
  background-color: rgba(248, 250, 252, 0.92);
}

.section-title {
  color: #f9fafb;
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.section-light .section-title {
  color: var(--text-main);
}

/* LOADING */

.loading {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.9rem 1rem;
  width: fit-content;
  background: rgba(15, 23, 42, 0.78);
  border-radius: 999px;
  color: #e5e7eb;
  margin-bottom: 1.2rem;
  border: 1px solid rgba(148, 163, 184, 0.6);
}

.spinner {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 2px solid rgba(148, 163, 184, 0.4);
  border-top-color: #f9fafb;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* CARTES METEO */

.weather-wrapper {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 1.2rem;
}

.card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 1.4rem 1.5rem;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(10px);
  transition: transform var(--transition-med), box-shadow var(--transition-med),
    border-color var(--transition-med);
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 24px 55px rgba(15, 23, 42, 0.35);
  border-color: rgba(59, 130, 246, 0.55);
}

.card-main .card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.1rem;
}

.card-main h2 {
  font-size: 1.4rem;
  margin-bottom: 0.1rem;
}

.city-country {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.date-text {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.card-body-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.current-temp {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.weather-icon {
  font-size: 2.6rem;
}

.temp-main {
  font-size: 2.7rem;
  font-weight: 600;
}

.temp-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
}

.temp-feels {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

/* DETAILS */

.card-details h3 {
  font-size: 1rem;
  margin-bottom: 0.9rem;
}

.details-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.detail-item {
  padding: 0.7rem 0.85rem;
  background-color: var(--primary-soft);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.detail-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.detail-value {
  font-size: 0.95rem;
  font-weight: 500;
}

/* PREVISIONS */

.forecast-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.9rem;
}

.forecast-card {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  padding: 0.9rem 0.95rem;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--card-border);
  text-align: center;
  transition: transform var(--transition-fast),
    box-shadow var(--transition-fast), border-color var(--transition-fast),
    background-color var(--transition-fast);
}

.forecast-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.3);
  border-color: rgba(59, 130, 246, 0.6);
  background-color: #eff6ff;
}

.forecast-day {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.forecast-date {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.forecast-icon {
  font-size: 1.6rem;
  margin-bottom: 0.3rem;
}

.forecast-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.forecast-temps {
  font-size: 0.9rem;
}

.forecast-temps span {
  display: block;
}

/* ABOUT */

.about-text {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}

.about-list {
  list-style: disc;
  padding-left: 1.2rem;
  color: var(--text-main);
  font-size: 0.92rem;
}

/* FOOTER */

.footer {
  padding: 1.3rem 0 1.4rem;
  background: rgba(15, 23, 42, 0.95);
  color: #e5e7eb;
  margin-top: 1.5rem;
  border-top: 1px solid rgba(148, 163, 184, 0.4);
}

.footer-inner {
  text-align: center;
  font-size: 0.9rem;
}

.footer-sub {
  font-size: 0.8rem;
  color: #9ca3af;
}

/* RESPONSIVE */

@media (max-width: 820px) {
  .weather-wrapper {
    grid-template-columns: minmax(0, 1fr);
  }

  .card-main {
    order: 0;
  }

  .card-details {
    order: 1;
  }

  .card-main .card-header {
    flex-direction: column;
    gap: 0.3rem;
  }

  .card-body-main {
    margin-top: 0.4rem;
  }
}

@media (max-width: 640px) {
  .topbar-inner {
    gap: 0.8rem;
  }

  .nav-links {
    display: none;
  }

  .hero-card {
    padding: 1.6rem 1.4rem;
  }

  .search-row {
    flex-direction: column;
    align-items: stretch;
  }

  .btn,
  #city-input {
    width: 100%;
  }

  .details-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
