/* =========================================
   WEATHERLY
   Desenvolvido por Jonas Sousa
========================================= */

:root {

    --background: #f5f7fb;

    --surface: #ffffff;

    --surface-soft: #f8fafc;

    --text: #111827;

    --text-secondary: #64748b;

    --text-muted: #94a3b8;

    --primary: #2563eb;

    --primary-dark: #1d4ed8;

    --primary-soft: #eff6ff;

    --border: #e5e7eb;

    --danger: #ef4444;

    --shadow-sm:
        0 4px 14px rgba(15, 23, 42, 0.04);

    --shadow-md:
        0 15px 40px rgba(15, 23, 42, 0.07);

    --shadow-lg:
        0 25px 60px rgba(15, 23, 42, 0.10);

    --radius-sm: 12px;

    --radius-md: 18px;

    --radius-lg: 26px;

    --transition: 0.25s ease;
}


/* =========================================
   RESET
========================================= */

* {

    margin: 0;

    padding: 0;

    box-sizing: border-box;

}


html {

    scroll-behavior: smooth;

}


body {

    min-height: 100vh;

    font-family:
        "Inter",
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    color: var(--text);

    background:
        radial-gradient(
            circle at 85% 0%,
            rgba(37, 99, 235, 0.10),
            transparent 30%
        ),
        var(--background);

    transition:
        background var(--transition),
        color var(--transition);

}


button,
input {

    font: inherit;

}


/* =========================================
   APP
========================================= */

.app {

    width:
        min(
            1120px,
            calc(100% - 40px)
        );

    margin: 0 auto;

    padding:
        28px 0 20px;

}


/* =========================================
   HEADER
========================================= */

.header {

    display: flex;

    align-items: center;

    justify-content: space-between;

    margin-bottom: 65px;

}


.brand {

    display: flex;

    align-items: center;

    gap: 12px;

    color: var(--text);

    text-decoration: none;

}


.brand-icon {

    width: 46px;

    height: 46px;

    display: grid;

    place-items: center;

    border-radius: 14px;

    color: white;

    background:
        linear-gradient(
            135deg,
            #3b82f6,
            #1d4ed8
        );

    font-size: 20px;

    box-shadow:
        0 8px 22px
        rgba(37, 99, 235, 0.22);

}


.brand-info strong {

    display: block;

    font-size: 1rem;

    font-weight: 800;

}


.brand-info span {

    display: block;

    margin-top: 2px;

    color: var(--text-muted);

    font-size: 0.68rem;

}


.theme-button {

    width: 44px;

    height: 44px;

    display: grid;

    place-items: center;

    border:
        1px solid var(--border);

    border-radius: 13px;

    background: var(--surface);

    color: var(--text);

    cursor: pointer;

    box-shadow: var(--shadow-sm);

    transition: var(--transition);

}


.theme-button:hover {

    color: var(--primary);

    transform: translateY(-2px);

    box-shadow: var(--shadow-md);

}


#theme-icon {

    font-size: 21px;

}


/* =========================================
   INTRO
========================================= */

.intro {

    max-width: 700px;

    margin:
        0 auto 34px;

    text-align: center;

}


.intro-badge {

    display: inline-flex;

    align-items: center;

    gap: 7px;

    padding:
        7px 11px;

    border:
        1px solid #bfdbfe;

    border-radius: 999px;

    color: var(--primary);

    background: var(--primary-soft);

    font-size: 0.63rem;

    font-weight: 800;

    letter-spacing: 0.08em;

}


.intro h1 {

    margin-top: 18px;

    font-size:
        clamp(
            2.2rem,
            6vw,
            4rem
        );

    line-height: 1.05;

    letter-spacing: -2.5px;

    font-weight: 800;

}


.intro h1 span {

    color: var(--primary);

}


.intro p {

    max-width: 560px;

    margin:
        17px auto 0;

    color: var(--text-secondary);

    font-size: 0.95rem;

    line-height: 1.7;

}


/* =========================================
   SEARCH
========================================= */

.search-section {

    max-width: 760px;

    margin:
        0 auto 45px;

}


.search-box {

    display: flex;

    align-items: center;

    gap: 10px;

    padding: 7px;

    border:
        1px solid var(--border);

    border-radius: 18px;

    background: var(--surface);

    box-shadow: var(--shadow-lg);

}


.search-icon {

    width: 25px;

    margin-left: 13px;

    color: var(--text-muted);

    font-size: 25px;

    line-height: 1;

}


#city-input {

    flex: 1;

    min-width: 0;

    height: 48px;

    border: none;

    outline: none;

    background: transparent;

    color: var(--text);

    font-size: 0.9rem;

}


#city-input::placeholder {

    color: var(--text-muted);

}


#search-button {

    height: 48px;

    padding:
        0 25px;

    border: none;

    border-radius: 13px;

    color: white;

    background:
        linear-gradient(
            135deg,
            var(--primary),
            var(--primary-dark)
        );

    font-size: 0.82rem;

    font-weight: 700;

    cursor: pointer;

    box-shadow:
        0 7px 18px
        rgba(37, 99, 235, 0.20);

    transition: var(--transition);

}


#search-button:hover {

    transform: translateY(-1px);

    box-shadow:
        0 11px 25px
        rgba(37, 99, 235, 0.28);

}


#search-button:disabled {

    opacity: 0.65;

    cursor: wait;

}


.search-hint {

    display: flex;

    align-items: center;

    gap: 6px;

    margin:
        10px 5px;

    color: var(--text-muted);

    font-size: 0.68rem;

}


/* =========================================
   LOADING
========================================= */

.loading-card {

    display: flex;

    align-items: center;

    gap: 14px;

    padding: 18px;

    margin-bottom: 20px;

    border:
        1px solid var(--border);

    border-radius: var(--radius-md);

    background: var(--surface);

    box-shadow: var(--shadow-sm);

}


.loading-card strong {

    display: block;

    font-size: 0.85rem;

}


.loading-card span {

    display: block;

    margin-top: 3px;

    color: var(--text-secondary);

    font-size: 0.7rem;

}


.spinner {

    width: 28px;

    height: 28px;

    flex-shrink: 0;

    border:
        3px solid #dbeafe;

    border-top-color:
        var(--primary);

    border-radius: 50%;

    animation:
        spin 0.8s linear infinite;

}


/* =========================================
   ERROR
========================================= */

.error-card {

    display: flex;

    align-items: center;

    gap: 14px;

    padding: 18px;

    margin-bottom: 20px;

    border:
        1px solid #fecaca;

    border-radius: var(--radius-md);

    background: #fff7f7;

}


.error-icon {

    width: 42px;

    height: 42px;

    display: grid;

    place-items: center;

    flex-shrink: 0;

    border-radius: 12px;

    color: var(--danger);

    background: #fee2e2;

    font-weight: 800;

}


.error-card strong {

    display: block;

    font-size: 0.85rem;

}


.error-card p {

    margin-top: 3px;

    color: #b91c1c;

    font-size: 0.72rem;

}


/* =========================================
   LOCATION
========================================= */

.location-section {

    display: flex;

    align-items: flex-end;

    justify-content: space-between;

    margin-bottom: 18px;

}


.location-label {

    margin-bottom: 7px;

    color: var(--primary);

    font-size: 0.62rem;

    font-weight: 800;

    letter-spacing: 0.1em;

}


.location-section h2 {

    font-size:
        clamp(
            1.7rem,
            5vw,
            2.4rem
        );

    font-weight: 800;

    letter-spacing: -1px;

}


.location-section p {

    margin-top: 3px;

    color: var(--text-secondary);

    font-size: 0.8rem;

}


.date-box {

    display: flex;

    flex-direction: column;

    align-items: flex-end;

    gap: 3px;

    color: var(--text-secondary);

    font-size: 0.72rem;

}


.date-box span {

    color: var(--text-muted);

    font-size: 0.68rem;

}


/* =========================================
   WEATHER HERO
========================================= */

.weather-hero {

    position: relative;

    display: flex;

    align-items: center;

    justify-content: space-between;

    min-height: 250px;

    padding: 38px;

    margin-bottom: 16px;

    overflow: hidden;

    border-radius:
        var(--radius-lg);

    color: white;

    background:
        radial-gradient(
            circle at 85% 20%,
            rgba(255,255,255,0.18),
            transparent 28%
        ),
        linear-gradient(
            135deg,
            #2563eb,
            #1e3a8a
        );

    box-shadow:
        0 25px 55px
        rgba(37, 99, 235, 0.22);

}


.weather-hero::after {

    content: "";

    position: absolute;

    width: 260px;

    height: 260px;

    right: -100px;

    bottom: -160px;

    border-radius: 50%;

    background:
        rgba(255,255,255,0.07);

}


.weather-main {

    position: relative;

    z-index: 1;

    display: flex;

    align-items: center;

    gap: 25px;

}


.weather-icon {

    width: 100px;

    height: 100px;

    display: grid;

    place-items: center;

    border-radius: 28px;

    background:
        rgba(255,255,255,0.13);

    backdrop-filter: blur(10px);

    font-size: 50px;

}


.temperature {

    display: flex;

    align-items: flex-start;

}


.temperature strong {

    font-size:
        clamp(
            4rem,
            9vw,
            6rem
        );

    line-height: 0.9;

    letter-spacing: -6px;

    font-weight: 800;

}


.temperature span {

    margin-top: 6px;

    font-size: 1.5rem;

    font-weight: 600;

}


.temperature-area p {

    margin-top: 12px;

    font-size: 0.95rem;

    font-weight: 600;

}


.temperature-area small {

    display: block;

    margin-top: 5px;

    color:
        rgba(255,255,255,0.70);

    font-size: 0.7rem;

}


.temperature-area small strong {

    color: white;

}


.favorite-button {

    position: relative;

    z-index: 2;

    display: flex;

    align-items: center;

    gap: 7px;

    padding:
        11px 15px;

    border:
        1px solid
        rgba(255,255,255,0.22);

    border-radius: 12px;

    background:
        rgba(255,255,255,0.10);

    color: white;

    font-size: 0.72rem;

    font-weight: 700;

    cursor: pointer;

    backdrop-filter: blur(8px);

    transition: var(--transition);

}


.favorite-button:hover {

    background:
        rgba(255,255,255,0.18);

    transform: translateY(-2px);

}


.favorite-button.active {

    color: var(--primary);

    background: white;

}


/* =========================================
   METRICS
========================================= */

.metrics {

    display: grid;

    grid-template-columns:
        repeat(4, 1fr);

    gap: 12px;

    margin-bottom: 16px;

}


.metric-card {

    display: flex;

    align-items: center;

    gap: 12px;

    padding: 19px;

    border:
        1px solid var(--border);

    border-radius: 17px;

    background: var(--surface);

    box-shadow: var(--shadow-sm);

    transition: var(--transition);

}


.metric-card:hover {

    transform: translateY(-3px);

    box-shadow: var(--shadow-md);

}


.metric-icon {

    width: 43px;

    height: 43px;

    display: grid;

    place-items: center;

    flex-shrink: 0;

    border-radius: 12px;

    font-size: 18px;

}


.metric-icon.blue {

    color: #0284c7;

    background: #e0f2fe;

}


.metric-icon.purple {

    color: #7c3aed;

    background: #ede9fe;

}


.metric-icon.orange {

    color: #ea580c;

    background: #ffedd5;

}


.metric-icon.green {

    color: #059669;

    background: #d1fae5;

}


.metric-card span {

    display: block;

    color: var(--text-muted);

    font-size: 0.65rem;

}


.metric-card strong {

    display: block;

    margin-top: 3px;

    font-size: 0.95rem;

}


/* =========================================
   PANELS
========================================= */

.panel {

    padding: 25px;

    margin-bottom: 16px;

    border:
        1px solid var(--border);

    border-radius:
        var(--radius-lg);

    background:
        var(--surface);

    box-shadow:
        var(--shadow-sm);

}


.panel-header {

    display: flex;

    align-items: center;

    justify-content: space-between;

    margin-bottom: 22px;

}


.panel-header h3 {

    margin-top: 4px;

    font-size: 1.05rem;

    font-weight: 800;

}


.panel-icon {

    width: 39px;

    height: 39px;

    display: grid;

    place-items: center;

    border-radius: 11px;

    color: var(--primary);

    background:
        var(--primary-soft);

    font-weight: 800;

}


.panel-symbol {

    color: var(--text-muted);

    font-size: 22px;

}


.eyebrow {

    color: var(--primary);

    font-size: 0.6rem;

    font-weight: 800;

    letter-spacing: 0.1em;

}


/* =========================================
   CHART
========================================= */

.chart-wrapper {

    position: relative;

    width: 100%;

    height: 280px;

}


.chart-fallback {

    position: absolute;

    inset: 0;

    display: grid;

    place-items: center;

    color: var(--text-muted);

    font-size: 0.75rem;

}


.chart-fallback.hidden {

    display: none;

}


/* =========================================
   FORECAST
========================================= */

.forecast {

    display: grid;

    grid-template-columns:
        repeat(5, 1fr);

    gap: 10px;

}


.forecast-card {

    padding:
        18px 10px;

    border:
        1px solid var(--border);

    border-radius: 15px;

    background:
        var(--surface-soft);

    text-align: center;

    transition: var(--transition);

}


.forecast-card:hover {

    transform: translateY(-3px);

    border-color:
        #bfdbfe;

    background:
        var(--primary-soft);

}


.forecast-card .day {

    color: var(--text-secondary);

    font-size: 0.68rem;

    font-weight: 600;

}


.forecast-icon {

    height: 54px;

    display: grid;

    place-items: center;

    color: var(--primary);

    font-size: 28px;

}


.forecast-card strong {

    display: block;

    font-size: 0.95rem;

}


.forecast-card .min {

    display: block;

    margin-top: 3px;

    color: var(--text-muted);

    font-size: 0.65rem;

}


/* =========================================
   FAVORITES
========================================= */

.favorites-list {

    display: flex;

    flex-wrap: wrap;

    gap: 10px;

}


.favorite-city {

    display: flex;

    align-items: center;

    gap: 9px;

    padding:
        10px 12px;

    border:
        1px solid var(--border);

    border-radius: 12px;

    background:
        var(--surface-soft);

    cursor: pointer;

    transition: var(--transition);

}


.favorite-city:hover {

    transform: translateY(-2px);

    border-color:
        #93c5fd;

    background:
        var(--primary-soft);

}


.favorite-pin {

    color: var(--primary);

}


.city-info strong {

    display: block;

    font-size: 0.75rem;

}


.city-info span {

    display: block;

    margin-top: 2px;

    color: var(--text-muted);

    font-size: 0.62rem;

}


.remove-favorite {

    width: 24px;

    height: 24px;

    display: grid;

    place-items: center;

    margin-left: 4px;

    border: none;

    border-radius: 7px;

    background: transparent;

    color: var(--text-muted);

    cursor: pointer;

}


.remove-favorite:hover {

    color: var(--danger);

    background: #fee2e2;

}


.empty-favorites {

    width: 100%;

    padding: 25px;

    text-align: center;

}


.empty-favorites-icon {

    display: block;

    margin-bottom: 8px;

    color: var(--text-muted);

    font-size: 25px;

}


.empty-favorites p {

    color: var(--text-secondary);

    font-size: 0.78rem;

}


.empty-favorites span {

    display: block;

    margin-top: 4px;

    color: var(--text-muted);

    font-size: 0.66rem;

}


/* =========================================
   FOOTER
========================================= */

footer {

    padding:
        25px 0 10px;

}


.footer-line {

    width: 100%;

    height: 1px;

    margin-bottom: 24px;

    background:
        var(--border);

}


.footer-content {

    display: flex;

    align-items: center;

    justify-content: space-between;

}


.footer-logo {

    display: flex;

    align-items: center;

    gap: 9px;

}


.footer-icon {

    width: 34px;

    height: 34px;

    display: grid;

    place-items: center;

    border-radius: 10px;

    color: white;

    background:
        var(--primary);

}


.footer-logo strong {

    display: block;

    font-size: 0.75rem;

}


.footer-logo span {

    display: block;

    margin-top: 2px;

    color: var(--text-muted);

    font-size: 0.6rem;

}


.developer {

    display: flex;

    align-items: center;

    gap: 5px;

    color: var(--text-muted);

    font-size: 0.68rem;

}


.developer strong {

    color: var(--text);

    font-weight: 700;

}


.copyright {

    margin-top: 18px;

    color: var(--text-muted);

    font-size: 0.62rem;

}


.credits {

    margin-top: 4px;

    color: var(--text-muted);

    font-size: 0.6rem;

}


.credits strong {

    color: var(--text-secondary);

}


/* =========================================
   DARK MODE
========================================= */

body.dark {

    --background: #080d18;

    --surface: #111827;

    --surface-soft: #172033;

    --text: #f8fafc;

    --text-secondary: #94a3b8;

    --text-muted: #64748b;

    --border: #263247;

    background:
        radial-gradient(
            circle at 85% 0%,
            rgba(37, 99, 235, 0.13),
            transparent 30%
        ),
        var(--background);

}


body.dark .metric-icon.blue {

    background:
        rgba(14,165,233,0.12);

}


body.dark .metric-icon.purple {

    background:
        rgba(124,58,237,0.12);

}


body.dark .metric-icon.orange {

    background:
        rgba(234,88,12,0.12);

}


body.dark .metric-icon.green {

    background:
        rgba(5,150,105,0.12);

}


body.dark .error-card {

    background:
        rgba(127,29,29,0.15);

    border-color:
        rgba(248,113,113,0.2);

}


/* =========================================
   HIDDEN
========================================= */

.hidden {

    display: none !important;

}


/* =========================================
   ANIMATION
========================================= */

@keyframes spin {

    to {

        transform:
            rotate(360deg);

    }

}


@keyframes appear {

    from {

        opacity: 0;

        transform:
            translateY(10px);

    }

    to {

        opacity: 1;

        transform:
            translateY(0);

    }

}


.intro,
.search-section,
.location-section,
.weather-hero,
.metric-card,
.panel {

    animation:
        appear 0.5s ease both;

}


.weather-hero {

    animation-delay: 0.08s;

}


.metric-card:nth-child(2) {

    animation-delay: 0.04s;

}


.metric-card:nth-child(3) {

    animation-delay: 0.08s;

}


.metric-card:nth-child(4) {

    animation-delay: 0.12s;

}


/* =========================================
   RESPONSIVE
========================================= */

@media (max-width: 900px) {

    .metrics {

        grid-template-columns:
            repeat(2, 1fr);

    }


    .forecast {

        grid-template-columns:
            repeat(3, 1fr);

    }

}


@media (max-width: 650px) {

    .app {

        width:
            calc(100% - 24px);

        padding-top: 20px;

    }


    .header {

        margin-bottom: 45px;

    }


    .intro {

        margin-bottom: 25px;

    }


    .intro h1 {

        letter-spacing: -1.5px;

    }


    .search-box {

        flex-wrap: wrap;

    }


    #city-input {

        flex-basis:
            calc(100% - 50px);

        height: 42px;

    }


    #search-button {

        width: 100%;

    }


    .location-section {

        align-items: flex-start;

        flex-direction: column;

        gap: 10px;

    }


    .date-box {

        align-items: flex-start;

    }


    .weather-hero {

        align-items: flex-start;

        flex-direction: column;

        padding: 28px;

    }


    .weather-main {

        gap: 16px;

    }


    .weather-icon {

        width: 72px;

        height: 72px;

        font-size: 38px;

    }


    .temperature strong {

        font-size: 3.6rem;

        letter-spacing: -4px;

    }


    .favorite-button {

        width: 100%;

        justify-content: center;

    }


    .metrics {

        grid-template-columns:
            repeat(2, 1fr);

    }


    .metric-card {

        padding: 15px;

    }


    .panel {

        padding: 20px;

    }


    .chart-wrapper {

        height: 230px;

    }


    .forecast {

        grid-template-columns:
            repeat(2, 1fr);

    }


    .footer-content {

        align-items: flex-start;

        flex-direction: column;

        gap: 15px;

    }

}


@media (max-width: 400px) {

    .brand-info span {

        display: none;

    }


    .metrics {

        grid-template-columns: 1fr;

    }


    .temperature strong {

        font-size: 3rem;

    }

}