:root {
  --glass: rgba(255, 255, 255, .14);
  --glass-strong: rgba(255, 255, 255, .22);
  --glass-border: rgba(255, 255, 255, .25);
  --text: #fff;
  --muted: rgba(255, 255, 255, .75);
  --radius: 22px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Outfit', system-ui, sans-serif;
  color: var(--text);
  min-height: 100vh;
  background: var(--sky);
  background-attachment: fixed;
  transition: background .8s;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .12);
}
/* Fond selon la météo */
body[data-sky="clear-day"]   { --sky: linear-gradient(160deg, #2f80ed 0%, #56ccf2 60%, #a8e0ff 100%); }
body[data-sky="clear-night"] { --sky: linear-gradient(160deg, #0f2027 0%, #203a43 50%, #2c5364 100%); }
body[data-sky="cloudy"]      { --sky: linear-gradient(160deg, #4b5d73 0%, #7f8fa6 60%, #a4b0be 100%); }
body[data-sky="rain"]        { --sky: linear-gradient(160deg, #283e51 0%, #4b6584 60%, #778ca3 100%); }
body[data-sky="storm"]       { --sky: linear-gradient(160deg, #141e30 0%, #2d2a4a 55%, #4a4466 100%); }
body[data-sky="snow"]        { --sky: linear-gradient(160deg, #5f7f9f 0%, #86a3bf 60%, #a9bfd4 100%); }
body[data-sky="fog"]         { --sky: linear-gradient(160deg, #606c76 0%, #8a959e 60%, #a9b2b9 100%); }

a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
.container { width: min(1040px, 100% - 32px); margin-inline: auto; }
.muted { color: var(--muted); }
.glass {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .12);
}
h2 { font-size: .95rem; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: 1.5px; margin-bottom: 16px; }

/* ===== Header ===== */
.top { display: flex; align-items: center; gap: 16px; padding: 22px 0; flex-wrap: wrap; }
.logo { font-size: 1.5rem; font-weight: 700; text-decoration: none; }
.search { position: relative; flex: 1; min-width: 220px; }
.search input {
  width: 100%; padding: 13px 44px; border-radius: 999px; border: 1px solid var(--glass-border);
  background: var(--glass); backdrop-filter: blur(18px); color: #fff; font: inherit; font-size: 1rem; outline: none;
}
.search input::placeholder { color: var(--muted); }
.search input:focus { background: var(--glass-strong); border-color: rgba(255, 255, 255, .5); }
.search__icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); font-size: .95rem; }
.spinner { position: absolute; right: 16px; top: 50%; width: 18px; height: 18px; margin-top: -9px; border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.suggestions {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 20; list-style: none;
  background: rgba(20, 30, 45, .92); backdrop-filter: blur(18px); border: 1px solid var(--glass-border); border-radius: 16px; overflow: hidden;
}
.suggestions li { padding: 12px 18px; cursor: pointer; display: flex; justify-content: space-between; gap: 12px; }
.suggestions li small { color: var(--muted); text-align: right; }
.suggestions li:hover, .suggestions li.active { background: rgba(255, 255, 255, .12); }
.suggestions .empty { cursor: default; color: var(--muted); }
.top__actions { display: flex; gap: 10px; }
.pill { padding: 11px 18px; border-radius: 999px; border: 1px solid var(--glass-border); background: var(--glass); backdrop-filter: blur(18px); }
.pill:hover { background: var(--glass-strong); }
.units { display: flex; border: 1px solid var(--glass-border); background: var(--glass); border-radius: 999px; padding: 3px; }
.units button { border: 0; background: none; padding: 8px 14px; border-radius: 999px; font-weight: 600; }
.units button.active { background: #fff; color: #1d3557; text-shadow: none; }

/* ===== Favoris & erreurs ===== */
.error { background: rgba(220, 38, 38, .85); padding: 12px 18px; border-radius: 14px; margin-bottom: 16px; }
.favs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.fav { display: inline-flex; align-items: center; border: 1px solid var(--glass-border); background: var(--glass); border-radius: 999px; overflow: hidden; }
.fav button { border: 0; background: none; padding: 7px 6px 7px 14px; }
.fav button + button { padding: 7px 12px 7px 6px; opacity: .6; }
.fav button + button:hover { opacity: 1; }
.fav:hover { background: var(--glass-strong); }

/* ===== Layout ===== */
.layout { display: grid; grid-template-columns: 1.1fr 1fr; grid-template-areas: "current details" "hourly hourly" "daily daily"; gap: 18px; transition: opacity .3s; }
#app.loading .layout { opacity: .45; pointer-events: none; }

.current { grid-area: current; padding: 28px; display: flex; flex-direction: column; justify-content: space-between; gap: 18px; }
.current__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.current h1 { font-size: 2rem; font-weight: 600; line-height: 1.15; }
.fav-btn { border: 1px solid var(--glass-border); background: var(--glass); width: 44px; height: 44px; border-radius: 50%; font-size: 1.3rem; flex-shrink: 0; transition: transform .2s; }
.fav-btn:hover { transform: scale(1.1); }
.fav-btn.on { color: #ffd166; }
.current__main { display: flex; align-items: center; gap: 18px; }
.current__icon { font-size: 5.5rem; line-height: 1; filter: drop-shadow(0 8px 16px rgba(0, 0, 0, .2)); animation: float 4s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-8px); } }
.current__temp { font-size: 5rem; font-weight: 300; line-height: 1; letter-spacing: -3px; }
.current__label { font-size: 1.2rem; font-weight: 500; margin-top: 6px; }

.details { grid-area: details; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.tile { padding: 16px; display: flex; flex-direction: column; justify-content: space-between; gap: 8px; min-height: 92px; }
.tile span { font-size: .85rem; color: var(--muted); }
.tile b { font-size: 1.35rem; font-weight: 600; }
.tile--wide { grid-column: span 3; }
.uv-bar { position: relative; height: 6px; border-radius: 99px; background: linear-gradient(90deg, #4ade80, #facc15, #fb923c, #ef4444, #a855f7); }
.uv-bar i { position: absolute; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: #fff; border: 2px solid rgba(0, 0, 0, .25); transition: left .6s; }

.hourly-wrap { grid-area: hourly; padding: 22px 22px 14px; }
.hourly { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 10px; scroll-snap-type: x mandatory; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .3) transparent; }
.hour { flex: 0 0 72px; scroll-snap-align: start; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 6px; border-radius: 16px; }
.hour.now { background: var(--glass-strong); }
.hour small { color: var(--muted); font-size: .85rem; }
.hour span { font-size: 1.7rem; }
.hour b { font-weight: 600; }

.daily-wrap { grid-area: daily; padding: 22px; }
.daily { list-style: none; }
.day { display: grid; grid-template-columns: 120px 44px 56px 44px 1fr 44px; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid rgba(255, 255, 255, .14); }
.day:first-child { border-top: 0; }
.day__name { font-weight: 500; }
.day__icon { font-size: 1.6rem; text-align: center; }
.day__rain { font-size: .82rem; color: #bde0fe; }
.day__min { color: var(--muted); text-align: right; }
.day__max { font-weight: 600; }
.range { position: relative; height: 6px; border-radius: 99px; background: rgba(0, 0, 0, .15); }
.range i { position: absolute; top: 0; bottom: 0; border-radius: 99px; background: linear-gradient(90deg, #8ecae6, #ffd166, #f4845f); }

.footer { padding: 30px 0; text-align: center; font-size: .88rem; color: var(--muted); }

/* ===== Responsive ===== */
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; grid-template-areas: "current" "details" "hourly" "daily"; }
}
@media (max-width: 560px) {
  .top { gap: 12px; }
  .search { order: 3; flex-basis: 100%; }
  .top__actions { margin-left: auto; }
  .pill span { display: none; }
  .current__icon { font-size: 4.2rem; }
  .current__temp { font-size: 4rem; }
  .details { grid-template-columns: repeat(2, 1fr); }
  .tile--wide { grid-column: span 2; }
  .day { grid-template-columns: 1fr 34px 44px 36px 1fr 36px; gap: 8px; font-size: .92rem; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
