/* =============================================================
   SWC — Ecrã de login (variante C4b · Grafite claro)
   CARMIM · Departamento de Informática
   ============================================================= */

:root {
    --gold: #d7a24a;
    --gold-ink: #1a1409;
    --gold-muted: #4d3a17;
    --gold-dark: #9b6a1e;
    --ink: #1b1b1b;
    --ink-hover: #333333;
    --text: #1b1b1b;
    --text-2: #555555;
    --text-3: #6b6b6b;
    --line: #dcdcdc;
    --line-soft: #ececec;
    --field: #f5f5f5;
    --white: #ffffff;
    --bg-top: #8a8a8a;
    --bg-bottom: #525252;
    --danger-bg: #fdecea;
    --danger-line: #f3c3bd;
    --danger-text: #8a1c1c;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--bg-bottom);
}

body {
    margin: 0;
}

body {
    min-height: 100vh;
    font-family: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
    color: var(--text);
    background: linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

[hidden] {
    display: none !important;
}

/* ---------- Barra superior ---------- */
.topbar {
    height: 64px;
    flex-shrink: 0;
    padding: 0 clamp(20px, 4vw, 56px);
    background: var(--ink);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-name {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: var(--white);
}

.brand-tag {
    padding: 2px 10px;
    border: 1px solid var(--gold);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--gold);
}

.topbar-title {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.3px;
    color: var(--white);
    text-align: right;
}

/* ---------- Conteúdo ---------- */
.page {
    flex-grow: 1;
    width: 100%;
    max-width: 1320px;
    margin: 0 auto;
    padding: clamp(24px, 5vw, 56px);
    display: flex;
    align-items: center;
    gap: 64px;
}

.hero {
    flex-grow: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 36px;
}

.hero-head {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.date-pill {
    align-self: flex-start;
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--ink);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.3px;
    color: var(--gold);
}

.hero h1 {
    margin: 0;
    font-size: clamp(38px, 4.2vw, 58px);
    line-height: 1.05;
    font-weight: 600;
    letter-spacing: -1.5px;
    color: var(--ink);
}

.h1-light {
    color: var(--white);
}

/* ---------- Cartões do tempo ---------- */
.weather-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.weather-card {
    padding: 22px;
    background: var(--white);
    border-radius: 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.wc-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.wc-day {
    font-size: 14px;
    font-weight: 600;
}

.wc-icon {
    display: inline-flex;
    color: var(--gold-dark);
}

.weather-card:nth-child(3) .wc-icon {
    color: var(--text-2);
}

.wc-temp {
    font-size: 44px;
    line-height: 1;
    font-weight: 600;
}

.wc-min {
    font-size: 20px;
    color: #7a7a7a;
}

.wc-desc {
    font-size: 13px;
    color: var(--text-2);
}

.weather-card.is-today {
    background: var(--gold);
    color: var(--gold-ink);
}

.weather-card.is-today .wc-icon {
    color: var(--gold-ink);
}

.weather-card.is-today .wc-min,
.weather-card.is-today .wc-desc {
    color: var(--gold-muted);
}

.ipma-note,
.weather-empty {
    font-size: 12px;
    font-weight: 500;
    color: #f0f0f0;
}

.weather-empty {
    font-size: 15px;
}

/* ---------- Cartão de login ---------- */
.login-card {
    width: 400px;
    flex-shrink: 0;
    padding: 36px;
    background: var(--white);
    border-radius: 22px;
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.login-head {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.login-head h2 {
    margin: 0;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text);
}

.login-head p {
    margin: 0;
    font-size: 14px;
    color: var(--text-2);
}

.fields {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.field label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.field input {
    height: 50px;
    width: 100%;
    padding: 0 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--field);
    font-family: inherit;
    font-size: 16px;
    color: var(--text);
    transition: border-color .2s ease, box-shadow .2s ease, background-color .2s ease;
}

.field input:focus {
    outline: none;
    border-color: var(--gold);
    background-color: var(--white);
    box-shadow: 0 0 0 4px rgba(215, 162, 74, .22);
}

.otp-input {
    font-size: 26px !important;
    font-weight: 600;
    letter-spacing: 12px;
    text-align: center;
    height: 60px !important;
}

.alert {
    padding: 12px 14px;
    border: 1px solid var(--danger-line);
    border-radius: 12px;
    background: var(--danger-bg);
    font-size: 14px;
    line-height: 1.45;
    color: var(--danger-text);
}

.actions {
    display: flex;
    gap: 12px;
}

.btn-primary,
.btn-secondary {
    height: 52px;
    border-radius: 12px;
    font-family: inherit;
    font-size: 16px;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
}

.btn-primary {
    flex-grow: 1;
    border: 0;
    background: var(--ink);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-primary svg {
    color: var(--gold);
}

.btn-secondary {
    padding: 0 22px;
    border: 1px solid var(--line);
    background: transparent;
    color: var(--text);
    transition: background-color .2s ease;
}

.btn-secondary:hover {
    background: var(--field);
}

.btn-primary:focus-visible,
.btn-secondary:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px rgba(215, 162, 74, .35);
}

.btn-primary:disabled {
    opacity: .7;
    cursor: wait;
}

.notice {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-size: 13px;
    line-height: 1.45;
    color: var(--text-2);
}

.notice svg {
    flex-shrink: 0;
    color: var(--gold-dark);
}

.login-foot {
    border-top: 1px solid var(--line-soft);
    padding-top: 16px;
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-3);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* ---------- A carregar ---------- */
.loading {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(27, 27, 27, .55);
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-box {
    padding: 22px 28px;
    background: var(--white);
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 15px;
    font-weight: 600;
}

.spinner {
    width: 26px;
    height: 26px;
    border: 3px solid var(--line-soft);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: fxSpin .8s linear infinite;
}

/* ---------- Efeitos ---------- */
@keyframes fxDown { from { opacity: 0; transform: translateY(-16px); } to { opacity: 1; transform: none; } }
@keyframes fxUp { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes fxLeft { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: none; } }
@keyframes fxSpin { to { transform: rotate(360deg); } }
@keyframes fxPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(215, 162, 74, 0); }
    50% { box-shadow: 0 0 0 6px rgba(215, 162, 74, .22); }
}
@keyframes fxShake {
    0%, 100% { transform: none; }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

.fx-bar { animation: fxDown .6s ease-out both; }
.fx-up { animation: fxUp .7s ease-out .15s both; }
.fx-login { animation: fxLeft .75s ease-out .25s both; }
.fx-note { animation: fxUp .6s ease-out .8s both; }

.fx-grid > .weather-card {
    animation: fxUp .6s ease-out both;
    transition: transform .25s ease, box-shadow .25s ease;
}
.fx-grid > .weather-card:nth-child(1) { animation: fxUp .6s ease-out .35s both, fxPulse 3.5s ease-in-out 1.5s infinite; }
.fx-grid > .weather-card:nth-child(2) { animation-delay: .47s; }
.fx-grid > .weather-card:nth-child(3) { animation-delay: .59s; }
.fx-grid > .weather-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 14px 30px rgba(0, 0, 0, .22);
}

.fx-spin-soft svg { animation: fxSpin 24s linear infinite; }

.fx-btn { transition: background-color .2s ease, transform .1s ease; }
.fx-btn svg { transition: transform .25s ease; }
.fx-btn:hover:not(:disabled) { background: var(--ink-hover); }
.fx-btn:hover:not(:disabled) svg { transform: translateX(5px); }
.fx-btn:active:not(:disabled) { transform: scale(.98); }

.shake { animation: fxShake .4s ease; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation: none !important;
        transition: none !important;
    }
}

/* ---------- Responsivo ---------- */
@media (max-width: 1100px) {
    .page {
        flex-direction: column;
        align-items: stretch;
        gap: 40px;
    }

    .login-card {
        order: -1;
        width: 100%;
        max-width: 440px;
        margin: 0 auto;
    }

    .fx-login { animation-name: fxUp; }
}

@media (max-width: 640px) {
    .topbar-title {
        font-size: 13px;
    }

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

    .wc-temp {
        font-size: 36px;
    }

    .login-card {
        padding: 26px;
    }
}

@media (max-width: 420px) {
    .topbar-title {
        display: none;
    }
}
