* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --bg: #080d17;
    --bg2: #0d1422;
    --card: #111a2a;
    --card2: #162136;
    --border: rgba(255, 255, 255, 0.07);
    --text: #f4f7fb;
    --muted: #8d9ab0;
    --accent: #62a8ff;
    --accent2: #8fc5ff;
}

html {
    width: 100%;
    min-height: 100%;
    background: var(--bg);
}

body {
    width: 100%;
    min-height: 100vh;
    background:
        radial-gradient(
            circle at 50% -10%,
            #19304e 0%,
            transparent 42%
        ),
        var(--bg);

    color: var(--text);

    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Arial,
        sans-serif;

    overflow-x: hidden;
}

button,
input {
    font: inherit;
}

button {
    border: 0;
    cursor: pointer;
}

/* =========================
   APPLICATION
========================= */

.app {
    width: 100%;
    max-width: 430px;
    min-height: 100vh;

    margin: 0 auto;

    padding-bottom: 30px;

    background:
        radial-gradient(
            circle at 50% -10%,
            #19304e 0%,
            transparent 42%
        ),
        var(--bg);
}

/* =========================
   TOP BAR
========================= */

.topbar {
    height: 76px;

    padding: 18px 18px 12px;

    display: flex;
    align-items: center;
    justify-content: space-between;
}

.app-title {
    font-size: 20px;
    font-weight: 800;

    letter-spacing: 2px;
}

.updated {
    color: var(--muted);

    font-size: 11px;

    margin-top: 4px;
}

.refresh-btn {
    width: 44px;
    height: 44px;

    border-radius: 14px;

    background: rgba(255, 255, 255, 0.06);

    color: white;

    font-size: 25px;

    transition:
        transform 0.2s ease,
        background 0.2s ease;
}

.refresh-btn:active {
    transform: rotate(180deg) scale(0.94);

    background: rgba(255, 255, 255, 0.12);
}

/* =========================
   MAIN
========================= */

main {
    padding: 0 14px;
}

/* =========================
   RECHERCHE
========================= */

.search-section {
    margin-bottom: 14px;
}

.search-box {
    display: flex;

    gap: 8px;

    background: var(--card);

    border: 1px solid var(--border);

    padding: 7px;

    border-radius: 16px;
}

.search-box input {
    min-width: 0;

    flex: 1;

    background: transparent;

    border: 0;

    outline: none;

    color: white;

    padding: 10px;

    font-size: 15px;
}

.search-box input::placeholder {
    color: #718097;
}

.search-box button {
    background: var(--accent);

    color: #06101e;

    border-radius: 11px;

    padding: 0 13px;

    font-weight: 700;

    font-size: 13px;

    white-space: nowrap;
}

.search-box button:active {
    transform: scale(0.97);
}

.location-btn {
    width: 100%;

    margin-top: 8px;

    height: 43px;

    border-radius: 13px;

    background: rgba(98, 168, 255, 0.11);

    color: var(--accent2);

    border: 1px solid rgba(98, 168, 255, 0.16);

    font-weight: 650;

    transition:
        background 0.2s ease,
        transform 0.2s ease;
}

.location-btn:active {
    transform: scale(0.98);

    background: rgba(98, 168, 255, 0.18);
}

/* =========================
   RESULTATS RECHERCHE
========================= */

.search-results {
    display: none;

    margin-top: 8px;

    overflow: hidden;

    border-radius: 15px;

    background: var(--card);

    border: 1px solid var(--border);
}

.result {
    padding: 13px 14px;

    border-bottom: 1px solid var(--border);

    cursor: pointer;

    transition: background 0.15s ease;
}

.result:last-child {
    border-bottom: 0;
}

.result:active {
    background: var(--card2);
}

.result-name {
    font-weight: 700;

    font-size: 14px;
}

.result-details {
    margin-top: 3px;

    color: var(--muted);

    font-size: 11px;
}

/* =========================
   METEO ACTUELLE
========================= */

.current-card {
    position: relative;

    overflow: hidden;

    border-radius: 24px;

    padding: 23px 20px 25px;

    background:
        linear-gradient(
            145deg,
            rgba(43, 83, 128, 0.75),
            rgba(16, 27, 45, 0.95)
        );

    border: 1px solid rgba(255, 255, 255, 0.08);

    box-shadow:
        0 15px 45px rgba(0, 0, 0, 0.22);
}

.current-card::after {
    content: "";

    position: absolute;

    width: 180px;
    height: 180px;

    border-radius: 50%;

    right: -80px;
    top: -80px;

    background: rgba(123, 190, 255, 0.13);

    filter: blur(2px);

    pointer-events: none;
}

.location-name {
    font-size: 22px;

    font-weight: 750;

    position: relative;

    z-index: 1;
}

.date-now {
    color: #b4c4d9;

    font-size: 12px;

    margin-top: 5px;

    position: relative;

    z-index: 1;
}

.weather-main {
    margin-top: 18px;

    display: flex;

    align-items: center;

    gap: 17px;

    position: relative;

    z-index: 1;
}

.weather-symbol {
    width: 70px;
    height: 70px;

    flex-shrink: 0;

    border-radius: 21px;

    display: flex;

    align-items: center;

    justify-content: center;

    font-size: 39px;

    background: rgba(255, 255, 255, 0.08);
}

.temperature {
    font-size: 70px;

    line-height: 0.9;

    font-weight: 300;

    letter-spacing: -4px;

    white-space: nowrap;
}

.degree {
    font-size: 35px;

    vertical-align: top;

    margin-left: 2px;

    letter-spacing: 0;
}

.weather-description {
    font-size: 16px;

    font-weight: 650;

    margin-top: 15px;

    position: relative;

    z-index: 1;
}

.feels {
    color: #b7c6d8;

    font-size: 12px;

    margin-top: 6px;

    position: relative;

    z-index: 1;
}

.feels strong {
    color: white;

    font-weight: 650;
}

/* =========================
   SECTIONS
========================= */

.section {
    margin-top: 20px;
}

.section-title {
    color: #8290a5;

    font-size: 10px;

    font-weight: 800;

    letter-spacing: 1.7px;

    margin: 0 4px 9px;
}

/* =========================
   CONDITIONS
========================= */

.stats-grid {
    display: grid;

    grid-template-columns: repeat(2, 1fr);

    gap: 8px;
}

.stat-card {
    min-height: 76px;

    padding: 13px;

    background: rgba(17, 26, 42, 0.9);

    border: 1px solid var(--border);

    border-radius: 16px;

    transition:
        transform 0.2s ease,
        background 0.2s ease;
}

.stat-card:active {
    transform: scale(0.98);

    background: var(--card2);
}

.stat-label {
    color: var(--muted);

    font-size: 11px;
}

.stat-value {
    margin-top: 7px;

    font-size: 18px;

    font-weight: 700;
}

/* =========================
   PREVISIONS HORAIRES
========================= */

.hourly-container {
    display: flex;

    gap: 8px;

    overflow-x: auto;

    padding-bottom: 5px;

    scrollbar-width: none;

    -webkit-overflow-scrolling: touch;
}

.hourly-container::-webkit-scrollbar {
    display: none;
}

.hour-card {
    flex: 0 0 72px;

    padding: 11px 8px;

    border-radius: 16px;

    background: var(--card);

    border: 1px solid var(--border);

    text-align: center;
}

.hour-card.current-hour {
    background: rgba(98, 168, 255, 0.14);

    border-color: rgba(98, 168, 255, 0.27);
}

.hour-time {
    font-size: 11px;

    color: var(--muted);
}

.hour-symbol {
    font-size: 22px;

    margin: 9px 0;
}

.hour-temp {
    font-size: 15px;

    font-weight: 700;
}

.hour-rain {
    margin-top: 5px;

    color: var(--accent2);

    font-size: 10px;
}

/* =========================
   PREVISIONS JOURS
========================= */

.forecast-list {
    display: flex;

    flex-direction: column;

    gap: 8px;
}

.forecast-card {
    min-height: 73px;

    padding: 12px 13px;

    border-radius: 16px;

    background: var(--card);

    border: 1px solid var(--border);

    display: grid;

    grid-template-columns: 1.2fr 0.7fr 1fr;

    align-items: center;
}

.forecast-day {
    font-size: 13px;

    font-weight: 700;
}

.forecast-date {
    color: var(--muted);

    font-size: 10px;

    margin-top: 3px;
}

.forecast-symbol {
    text-align: center;

    font-size: 25px;
}

.forecast-temp {
    text-align: right;

    font-size: 14px;

    font-weight: 700;
}

.forecast-temp span {
    color: var(--muted);

    font-weight: 500;
}

/* =========================
   SOLEIL
========================= */

.sun-card {
    display: flex;

    align-items: center;

    justify-content: space-around;

    min-height: 92px;

    border-radius: 18px;

    background: var(--card);

    border: 1px solid var(--border);
}

.sun-item {
    text-align: center;
}

.sun-label {
    color: var(--muted);

    font-size: 11px;
}

.sun-value {
    margin-top: 6px;

    font-size: 21px;

    font-weight: 700;
}

.sun-line {
    width: 1px;

    height: 42px;

    background: var(--border);
}

/* =========================
   SOURCE
========================= */

.source {
    text-align: center;

    color: #56657b;

    font-size: 9px;

    line-height: 1.5;

    margin: 25px 15px 5px;
}

/* =========================
   CHARGEMENT
========================= */

.loading {
    position: fixed;

    inset: 0;

    background: rgba(6, 10, 17, 0.82);

    backdrop-filter: blur(8px);

    -webkit-backdrop-filter: blur(8px);

    display: none;

    flex-direction: column;

    align-items: center;

    justify-content: center;

    gap: 12px;

    color: #b9c7d9;

    font-size: 12px;

    z-index: 50;
}

.loader {
    width: 30px;
    height: 30px;

    border: 3px solid rgba(255, 255, 255, 0.12);

    border-top-color: var(--accent);

    border-radius: 50%;

    animation: spin 0.8s linear infinite;
}

@keyframes spin {

    to {
        transform: rotate(360deg);
    }

}

/* =========================
   ERREUR
========================= */

.error-box {
    position: fixed;

    left: 14px;
    right: 14px;

    bottom: 18px;

    max-width: 402px;

    margin: auto;

    padding: 15px;

    border-radius: 17px;

    background: #351b22;

    border: 1px solid rgba(255, 100, 120, 0.25);

    display: none;

    z-index: 60;
}

#errorText {
    font-size: 13px;

    line-height: 1.4;
}

#errorClose {
    margin-top: 11px;

    background: rgba(255, 255, 255, 0.09);

    color: white;

    padding: 8px 12px;

    border-radius: 9px;
}

/* =========================
   MOBILE
========================= */

@media (max-width: 430px) {

    .app {
        max-width: 100%;
    }

    .temperature {
        font-size: 64px;
    }

    .weather-symbol {
        width: 64px;
        height: 64px;
    }

}

/* =========================
   PC / LIVE SERVER
   On garde une vraie largeur
   de téléphone au centre.
========================= */

@media (min-width: 431px) {

    body {
        display: flex;

        justify-content: center;

        align-items: flex-start;

        background: #050912;
    }

    .app {
        width: 430px;

        max-width: 430px;

        min-height: 100vh;

        margin: 0 auto;

        box-shadow:
            0 0 60px rgba(0, 0, 0, 0.45);
    }

}

/* =========================
   ECRANS TRES PETITS
========================= */

@media (max-width: 360px) {

    .topbar {
        padding-left: 14px;
        padding-right: 14px;
    }

    main {
        padding-left: 10px;
        padding-right: 10px;
    }

    .current-card {
        padding-left: 16px;
        padding-right: 16px;
    }

    .temperature {
        font-size: 57px;

        letter-spacing: -3px;
    }

    .weather-main {
        gap: 12px;
    }

    .weather-symbol {
        width: 58px;
        height: 58px;

        font-size: 32px;
    }

}