
/* ========================================
   CLIMA — ESTILIZAÇÃO PRINCIPAL
   Identidade visual DEVLAB
======================================== */

:root {
    color-scheme: dark;

    --background: #0b1014;
    --surface: #111a20;
    --surface-hover: #1d2b34;
    --border: #2a3942;

    --primary: #65d6c4;
    --primary-strong: #8ae4d6;
    --secondary: #38bdf8;

    --text: #f1f5f7;
    --text-muted: #9aaab3;

    --success: #4ade80;
    --danger: #f87171;

    --button-bg: #32b8a5;
    --button-hover: #65d6c4;
    --button-text: #071411;

    --shadow: 0 12px 35px rgba(0, 0, 0, 0.18);

    --radius: 18px;
    --transition: 180ms ease;
}

[data-theme="light"] {
    color-scheme: light;

    --background: #f5f7f8;
    --surface: #ffffff;
    --surface-hover: #e7efef;
    --border: #d5dfe2;

    --primary: #087f70;
    --primary-strong: #066b5e;
    --secondary: #0284c7;

    --text: #182329;
    --text-muted: #52646d;

    --success: #15803d;
    --danger: #dc2626;

    --button-bg: #087f70;
    --button-hover: #066b5e;
    --button-text: #ffffff;

    --shadow: 0 12px 35px rgba(30, 41, 59, 0.06);
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: 24px;
}

body {
    min-height: 100vh;
    background: var(--background);
    color: var(--text);
    font-family: Inter, -apple-system, BlinkMacSystemFont,
        "Segoe UI", sans-serif;
    font-size: 16px;
    line-height: 1.6;
    transition: background var(--transition), color var(--transition);
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
    outline: 3px solid var(--secondary);
    outline-offset: 4px;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

[hidden] {
    display: none !important;
}

.app-container {
    width: min(100% - 40px, 1050px);
    margin: 0 auto;
}

/* ========================================
   CABEÇALHO
======================================== */

.header {
    min-height: 88px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-size: 25px;
    font-weight: 750;
    letter-spacing: -1px;
}

.brand:hover {
    text-decoration: none;
}

.brand-icon {
    width: 35px;
    height: 35px;
    color: var(--primary);
}

.brand-icon svg {
    width: 100%;
    height: 100%;
}

.brand-dot {
    color: var(--primary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.icon-button {
    width: 43px;
    height: 43px;
    display: grid;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text);
    font-weight: 700;
    transition: background var(--transition), border-color var(--transition);
}

.icon-button:hover {
    background: var(--surface-hover);
    border-color: var(--primary);
}

.icon-button svg {
    width: 20px;
    height: 20px;
}

/* ========================================
   PESQUISA
======================================== */

.search-section {
    max-width: 760px;
    margin: 65px auto 55px;
    text-align: center;
}

.section-heading {
    margin-bottom: 28px;
}

.eyebrow {
    display: block;
    margin-bottom: 9px;
    color: var(--primary);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.7px;
}

.section-heading h1 {
    font-size: clamp(29px, 5vw, 44px);
    line-height: 1.2;
    letter-spacing: -1.6px;
}

.section-heading h1 span {
    color: var(--primary);
}

.section-heading p {
    max-width: 560px;
    margin: 14px auto 0;
    color: var(--text-muted);
    font-size: 15px;
}

.search-form {
    display: flex;
    gap: 10px;
}

.search-input-wrapper {
    flex: 1;
    min-width: 0;
    height: 54px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: var(--surface);
    transition: border-color var(--transition);
}

.search-input-wrapper:focus-within {
    border-color: var(--primary);
}

.search-input-wrapper svg {
    width: 21px;
    height: 21px;
    flex-shrink: 0;
    color: var(--text-muted);
}

.search-input-wrapper input {
    width: 100%;
    min-width: 0;
    height: 100%;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text);
    font-size: 15px;
}

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

.search-input-wrapper input:focus-visible {
    outline: none;
}

.search-button {
    min-width: 125px;
    padding: 0 22px;
    border: none;
    border-radius: 13px;
    background: var(--button-bg);
    color: var(--button-text);
    font-size: 14px;
    font-weight: 750;
    transition: background var(--transition), transform var(--transition);
}

.search-button:hover {
    background: var(--button-hover);
    color: var(--button-text);
}

.search-button:active {
    transform: scale(0.97);
}

.search-button:disabled {
    cursor: not-allowed;
    opacity: 0.65;
}

.location-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
    padding: 8px 12px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--primary);
    font-size: 13px;
    font-weight: 650;
    transition: background var(--transition);
}

.location-button:hover {
    background: var(--surface-hover);
}

.location-button svg {
    width: 17px;
    height: 17px;
}

.location-button:disabled {
    opacity: 0.6;
    cursor: wait;
}

.search-feedback {
    min-height: 20px;
    margin-top: 10px;
    color: var(--text-muted);
    font-size: 13px;
}

.search-results {
    display: grid;
    gap: 8px;
    margin-top: 8px;
    text-align: left;
}

.search-result {
    width: 100%;
    padding: 13px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--surface);
    color: var(--text);
    text-align: left;
    transition: background var(--transition), border-color var(--transition);
}

.search-result:hover {
    background: var(--surface-hover);
    border-color: var(--primary);
}

.search-result strong {
    font-size: 14px;
}

.search-result span {
    color: var(--text-muted);
    font-size: 12px;
}

/* ========================================
   CARTÕES
======================================== */

.card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    transition: background var(--transition), border-color var(--transition);
}

/* ========================================
   CLIMA ATUAL
======================================== */

.weather-section {
    display: grid;
    gap: 35px;
    padding-bottom: 45px;
}

.current-weather {
    padding: 30px;
    background:
        radial-gradient(
            ellipse at 90% 10%,
            rgba(101, 214, 196, 0.12),
            transparent 45%
        ),
        var(--surface);
}

.current-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.current-top h2 {
    font-size: 25px;
    line-height: 1.3;
    letter-spacing: -0.5px;
}

.muted-text {
    color: var(--text-muted);
    font-size: 13px;
}

.current-condition-icon {
    font-size: 53px;
    line-height: 1.2;
}

.current-temperature {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 22px;
    margin-top: 18px;
}

.current-temperature > span {
    font-size: clamp(65px, 12vw, 92px);
    font-weight: 750;
    line-height: 1.1;
    letter-spacing: -5px;
}

.temperature-description {
    display: grid;
    gap: 4px;
}

.temperature-description strong {
    font-size: 17px;
}

.temperature-description span {
    color: var(--text-muted);
    font-size: 13px;
}

.temperature-range {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    margin-top: 12px;
    color: var(--text-muted);
    font-size: 13px;
}

.sun-times {
    display: flex;
    flex-wrap: wrap;
    gap: 32px;
    margin-top: 28px;
    padding-top: 22px;
    border-top: 1px solid var(--border);
}

.sun-times > div {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sun-times > div > div {
    display: grid;
    gap: 2px;
}

.sun-times strong {
    font-size: 15px;
}

.sun-icon {
    color: #fbbf24;
    font-size: 27px;
}

.sunset {
    color: #fb923c;
}

/* ========================================
   TÍTULOS DAS SEÇÕES
======================================== */

.section-title {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 16px;
}

.section-title h2 {
    font-size: 21px;
    line-height: 1.3;
    letter-spacing: -0.5px;
}

/* ========================================
   DETALHES METEOROLÓGICOS
======================================== */

.details-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.detail-card {
    min-width: 0;
    padding: 19px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 7px;
}

.detail-icon {
    margin-bottom: 5px;
    font-size: 22px;
}

.detail-label {
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.4;
}

.detail-card strong {
    font-size: 25px;
    line-height: 1.3;
    letter-spacing: -0.6px;
}

.detail-description {
    color: var(--text-muted);
    font-size: 11px;
}

/* ========================================
   PREVISÃO POR HORA
======================================== */

.hourly-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
    padding: 20px 12px;
}

.hourly-item {
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 8px 2px;
    border-radius: 12px;
    text-align: center;
}

.hourly-item:first-child {
    background: var(--surface-hover);
}

.hourly-time {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 650;
}

.hourly-icon {
    font-size: 25px;
    line-height: 1.3;
}

.hourly-temperature {
    font-size: 17px;
    font-weight: 750;
}

.hourly-rain {
    color: var(--secondary);
    font-size: 11px;
}

/* ========================================
   PREVISÃO DIÁRIA
======================================== */

.daily-list {
    padding: 8px 20px;
}

.daily-item {
    min-height: 68px;
    display: grid;
    grid-template-columns: 1.2fr 0.6fr 0.7fr 1fr;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border);
}

.daily-item:last-child {
    border-bottom: none;
}

.daily-day {
    font-size: 13px;
    font-weight: 650;
}

.daily-condition {
    display: flex;
    align-items: center;
    gap: 7px;
}

.daily-condition span:first-child {
    font-size: 21px;
}

.daily-condition span:last-child {
    color: var(--text-muted);
    font-size: 11px;
}

.daily-rain {
    color: var(--secondary);
    font-size: 12px;
    text-align: center;
}

.daily-temperatures {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    font-size: 13px;
    font-weight: 700;
}

.daily-temperatures span:last-child {
    color: var(--text-muted);
    font-weight: 500;
}

/* ========================================
   TELA INICIAL
======================================== */

.welcome-section {
    max-width: 440px;
    margin: 0 auto 70px;
    padding: 25px;
    text-align: center;
}

.welcome-icon {
    margin-bottom: 15px;
    font-size: 60px;
}

.welcome-section h2 {
    font-size: 22px;
    letter-spacing: -0.5px;
}

.welcome-section p {
    margin-top: 9px;
    color: var(--text-muted);
    font-size: 14px;
}

/* ========================================
   CARREGAMENTO
======================================== */

.loading-section {
    padding: 45px 15px;
    text-align: center;
}

.loading-spinner {
    width: 35px;
    height: 35px;
    display: inline-block;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 800ms linear infinite;
}

.loading-section p {
    margin-top: 13px;
    color: var(--text-muted);
    font-size: 14px;
}

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

/* ========================================
   ERROS
======================================== */

.error-section {
    max-width: 500px;
    margin: 0 auto 55px;
    padding: 22px;
    border: 1px solid rgba(248, 113, 113, 0.3);
    border-radius: var(--radius);
    background: var(--surface);
    text-align: center;
}

.error-section > span {
    font-size: 30px;
}

.error-section p {
    margin: 9px 0 16px;
    color: var(--text-muted);
    font-size: 14px;
}

.error-section button {
    padding: 9px 17px;
    border: none;
    border-radius: 9px;
    background: var(--button-bg);
    color: var(--button-text);
    font-weight: 700;
    transition: background var(--transition);
}

.error-section button:hover {
    background: var(--button-hover);
    color: var(--button-text);
}

/* ========================================
   RODAPÉ
======================================== */

.footer {
    padding: 25px 0 30px;
    border-top: 1px solid var(--border);
    text-align: center;
}

.footer p {
    color: var(--text-muted);
    font-size: 12px;
}

.footer p + p {
    margin-top: 5px;
}

.footer a {
    font-weight: 700;
}

/* ========================================
   ACESSIBILIDADE
======================================== */

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ========================================
   RESPONSIVIDADE
======================================== */

@media (max-width: 760px) {
    .app-container {
        width: min(100% - 30px, 600px);
    }

    .search-section {
        margin-top: 48px;
        margin-bottom: 40px;
    }

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

    .hourly-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        row-gap: 15px;
    }

    .current-weather {
        padding: 23px;
    }

    .weather-section {
        gap: 29px;
    }
}

@media (max-width: 480px) {
    .app-container {
        width: calc(100% - 28px);
    }

    .header {
        min-height: 72px;
    }

    .brand {
        font-size: 23px;
    }

    .brand-icon {
        width: 30px;
        height: 30px;
    }

    .icon-button {
        width: 40px;
        height: 40px;
    }

    .search-section {
        margin-top: 38px;
        margin-bottom: 35px;
    }

    .section-heading h1 {
        font-size: 31px;
    }

    .section-heading p {
        font-size: 14px;
    }

    .search-form {
        gap: 8px;
    }

    .search-input-wrapper {
        height: 50px;
        padding: 0 11px;
        gap: 8px;
    }

    .search-input-wrapper input {
        font-size: 13px;
    }

    .search-button {
        min-width: 94px;
        padding: 0 12px;
        font-size: 13px;
    }

    .current-weather {
        padding: 19px;
    }

    .current-top h2 {
        font-size: 21px;
    }

    .current-condition-icon {
        font-size: 43px;
    }

    .current-temperature {
        gap: 12px;
    }

    .current-temperature > span {
        font-size: 70px;
    }

    .temperature-description strong {
        font-size: 14px;
    }

    .temperature-description span {
        font-size: 12px;
    }

    .sun-times {
        gap: 22px;
    }

    .details-grid {
        gap: 10px;
    }

    .detail-card {
        padding: 15px;
    }

    .detail-card strong {
        font-size: 23px;
    }

    .section-title h2 {
        font-size: 19px;
    }

    .hourly-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        padding: 14px 8px;
    }

    .daily-list {
        padding: 7px 12px;
    }

    .daily-item {
        grid-template-columns: 1fr 0.8fr 0.55fr;
        gap: 5px;
    }

    .daily-condition {
        justify-content: center;
    }

    .daily-condition span:last-child {
        display: none;
    }

    .daily-temperatures {
        gap: 7px;
        font-size: 12px;
    }

    .daily-rain {
        display: none;
    }

    .daily-day {
        font-size: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
