/* Estilos CSS */
:root {
    --bg-color: #f8f9fa;
    --text-color: #212529;
    --text-color-rgb: 33, 37, 41;
    --card-bg: #ffffff;
    --accent-color: #2196f3;
    --border-radius: 20px;
    --shadow: 0 6px 12px rgba(0, 0, 0, 0.08);
    --transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --font-header: 'Poppins', system-ui;
    --font-body: 'Manrope', system-ui;
    --font-mono: 'Space Mono', monospace;
    --icon-size: 10.8rem;
    --icon-size-mobile: 8.1rem;
}

[data-theme="dark"] {
    --bg-color: #0a0a0a;
    --text-color: #f8f9fa;
    --text-color-rgb: 248, 249, 250;
    --card-bg: #1a1a1a;
    --accent-color: #64ffda;
}

* {
    -webkit-tap-highlight-color: transparent;
}

button:focus,
.logo:focus {
    outline: none !important;
    box-shadow: none !important;
}

.logo {
    height: 60px;
    margin-right: 1rem;
    cursor: pointer;
    user-select: none;
}

.gradient-title {
    font-family: var(--font-header);
    font-size: clamp(2rem, 6vw, 3.2rem);
    font-weight: 600;
    line-height: 1.05;
    letter-spacing: -0.015em;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    text-align: center;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

.temperature-words {
    display: inline-flex;
    align-items: baseline;
    gap: 0.15rem;
    font-size: 0.95em;
}

.hot {
    color: #ff6b6b;
    text-shadow: 0 2px 4px rgba(255, 107, 107, 0.1);
    transition: color 0.3s ease;
}

.cold {
    color: #4dabf7;
    text-shadow: 0 2px 4px rgba(77, 171, 247, 0.1);
    transition: color 0.3s ease, text-shadow 0.3s ease;
}

[data-theme="dark"] .cold {
    color: var(--accent-color);
}

.separator {
    color: var(--text-color);
    opacity: 0.6;
    font-weight: 300;
}

.weather-word {
    background-image: linear-gradient(45deg, #2f9e44 15%, #4dabf7 50%, #748ffc 85%);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    font-weight: 500;
    letter-spacing: 0.01em;
    padding: 0 0.3rem;
    position: relative;
}

.weather-word::after {
    content: "";
    position: absolute;
    bottom: -3px;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #2f9e44 0%, #4dabf7 50%, #748ffc 100%);
    border-radius: 2px;
}

[data-theme="dark"] {
    .hot { color: #ff8787; }
    .weather-word {
        background-image: linear-gradient(45deg, #69db7c 15%, var(--accent-color) 50%, #91a7ff 85%);
    }
    .weather-word::after {
        background: linear-gradient(90deg, #69db7c 0%, var(--accent-color) 50%, #91a7ff 100%);
    }
}

.wi {
    font-size: 1em !important;
    line-height: 1 !important;
}

body {
    font-family: var(--font-body);
    background: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 1.5rem;
    min-height: 100vh;
    line-height: 1.6;
    transition: var(--transition);
}

main {
    max-width: 1200px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

.header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-bottom: 3rem;
    padding: 1rem 0;
    position: relative;
}

.theme-toggle {
    position: absolute;
    right: 0;
    top: 0;
    background: none;
    border: 2px solid var(--accent-color);
    border-radius: 50%;
    padding: 0.8rem;
    cursor: pointer;
    transition: var(--transition);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:active {
    transform: scale(0.95);
}

.theme-icon {
    font-size: 1.5rem;
    color: var(--accent-color);
    display: none;
}

.theme-icon.active {
    display: block;
}

.location {
    text-align: center;
    margin-bottom: 2rem;
}

.location h1 {
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    margin: 0 0 0.5rem 0;
    font-family: var(--font-header);
}

.location-warning {
    font-size: 0.9em;
    color: #ff6b6b;
    margin: 0.5rem auto 1rem;
    padding: 0.8rem 1.5rem;
    background: rgba(255, 107, 107, 0.1);
    border-radius: var(--border-radius);
    text-align: center;
    max-width: fit-content;
    font-family: var(--font-mono);
    display: none;
    gap: 0.6rem;
    align-items: center;
    justify-content: center;
    line-height: 1.4;
    border: 1px solid rgba(255, 107, 107, 0.2);
}

.location-warning.show {
    display: flex;
}

[data-theme="dark"] .location-warning {
    background: rgba(255, 107, 107, 0.05);
    border-color: rgba(255, 107, 107, 0.15);
}

.weather-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 2.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
    text-align: center;
    position: relative;
    min-height: 500px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    max-width: 1200px;
    width: 100%;
    box-sizing: border-box;
    margin-left: auto;
    margin-right: auto;
}

.weather-icon {
    font-size: var(--icon-size) !important;
    margin: 0 0 2rem 0;
    line-height: 1;
    display: inline-block !important;
    vertical-align: middle !important;
    position: relative;
    z-index: 1;
    top: 0.2em;
}

.temperature {
    font-family: var(--font-mono);
    font-size: 4rem;
    font-weight: 700;
    letter-spacing: -0.05em;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    position: relative;
    z-index: 2;
    padding: 1rem 0;
}

.condition {
    font-size: 1.2rem;
    margin-top: 1rem;
    position: relative;
    z-index: 1;
}

.aqi,
.uv,
.humidity,
.feels-like {
    position: absolute;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-mono);
    padding: 0;
    margin: 0;
    z-index: 3;
    transition: var(--transition);
}

.aqi {
    top: 2rem;
    left: 2rem;
}

.uv {
    bottom: 2rem;
    left: 2rem;
}

.humidity {
    top: 2rem;
    right: 2rem;
}

.feels-like {
    bottom: 2rem;
    right: 2rem;
}

.aqi i,
.uv i,
.humidity i,
.feels-like i {
    font-size: 1.2rem;
    color: var(--accent-color);
    margin-top: 2px;
}

.aqi-info,
.uv-info,
.humidity-info,
.feels-like-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
}

.aqi .label,
.uv .label,
.humidity .label,
.feels-like .label {
    font-size: 0.9em;
    opacity: 0.8;
}

.aqi .value,
.uv .value,
.humidity .value,
.feels-like .value {
    font-size: 1em;
    font-weight: 500;
}

#alertsContainer.alerts {
    background: rgba(255, 243, 224, 0.6);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
    max-width: 1200px;
    width: 100%;
    box-sizing: border-box;
    margin-left: auto;
    margin-right: auto;
}

[data-theme="dark"] #alertsContainer.alerts {
    background: rgba(41, 98, 117, 0.15);
}

.alerts h2 {
    font-family: var(--font-header);
    font-size: 1.5rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-color);
}

.alert-item {
    background: rgba(255, 243, 224, 0.15);
    border-radius: 12px;
    padding: 1rem;
    margin: 1rem 0;
    display: flex;
    align-items: center;
    gap: 1rem;
    font-family: var(--font-mono);
    font-size: 0.95rem;
    transition: var(--transition);
}

.alert-item.yellow {
    background: rgba(255, 235, 59, 0.2);
    color: #f57f17;
    border-left: 5px solid #fbc02d;
}

.alert-item.yellow i {
    content: "\f00a";
}

.alert-item.orange {
    background: rgba(255, 152, 0, 0.2);
    color: #e65100;
    border-left: 5px solid #ff9800;
}

.alert-item.orange i {
    content: "\f0b1";
}

.alert-item.red {
    background: rgba(244, 67, 54, 0.2);
    color: #b71c1c;
    border-left: 5px solid #f44336;
}

.alert-item.red i {
    content: "\f0e7";
}

.alert-item.darkred {
    background: rgba(183, 28, 28, 0.2);
    color: #7f0000;
    border-left: 5px solid #b71c1c;
}

.alert-item.darkred i {
    content: "\f781";
}

.alert-item.black {
    background: rgba(33, 33, 33, 0.2);
    color: #000000;
    border-left: 5px solid #212121;
}

.alert-item.black i {
    content: "\f185";
}

.alert-item.gray {
    background: rgba(189, 189, 189, 0.2);
    color: #424242;
    border-left: 5px solid #757575;
}

.alert-item.gray i {
    content: "\f0c2";
}

.alert-item.info {
    background: rgba(76, 175, 80, 0.2);
    color: #1b5e20;
    border-left: 5px solid #4caf50;
}

.alert-item.info i {
    content: "\f043";
}

[data-theme="dark"] .alert-item.yellow {
    background: rgba(255, 235, 59, 0.15);
    color: #ffeb3b;
    border-left: 5px solid #ffee58;
}

[data-theme="dark"] .alert-item.orange {
    background: rgba(255, 152, 0, 0.15);
    color: #ff9800;
    border-left: 5px solid #ffa726;
}

[data-theme="dark"] .alert-item.red {
    background: rgba(244, 67, 54, 0.15);
    color: #ef5350;
    border-left: 5px solid #ef5350;
}

[data-theme="dark"] .alert-item.darkred {
    background: rgba(183, 28, 28, 0.15);
    color: #ef5350;
    border-left: 5px solid #d32f2f;
}

[data-theme="dark"] .alert-item.black {
    background: rgba(33, 33, 33, 0.15);
    color: #212121;
    border-left: 5px solid #424242;
}

[data-theme="dark"] .alert-item.gray {
    background: rgba(189, 189, 189, 0.15);
    color: #bdbdbd;
    border-left: 5px solid #9e9e9e;
}

[data-theme="dark"] .alert-item.info {
    background: rgba(76, 175, 80, 0.15);
    color: #4caf50;
    border-left: 5px solid #66bb6a;
}

.alert-item i {
    font-size: 1.2rem;
    color: inherit;
    margin-top: 0.2rem;
}

.alert-content {
    flex: 1;
}

.alert-header {
    font-family: var(--font-header);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.8rem;
    color: inherit;
}

.alert-details {
    font-family: var(--font-body);
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text-color);
}

.alert-details p {
    margin: 0.5rem 0;
}

.alert-details strong {
    color: var(--text-color);
    font-weight: 600;
}

/* Novos estilos para expandir/recolher */
.alert-details {
    position: relative;
}

.alert-visible {
    margin-bottom: 10px;
}

.alert-hidden {
    transition: all 0.3s ease;
}

.alert-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: var(--text-color);
    position: absolute;
    right: 0;
    top: 0;
    padding: 5px;
}

.alert-toggle:hover {
    color: var(--accent-color);
}

.alert-toggle i {
    transition: transform 0.3s ease;
}

.forecast-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.forecast-item {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    text-align: center;
    transition: var(--transition);
}

.precipitation-info {
    margin-top: 1rem;
    font-size: 0.9em;
    display: grid;
    gap: 0.5rem;
}

#backToTopBtn {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99;
    font-size: 1.5rem;
    border: none;
    outline: none;
    background-color: var(--accent-color);
    color: var(--card-bg);
    cursor: pointer;
    padding: 15px;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    align-items: center;
    justify-content: center;
}

#backToTopBtn:hover {
    background-color: var(--text-color);
    color: var(--card-bg);
}

#backToTopBtn:active {
    transform: scale(0.9);
}

.footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-color);
    font-family: var(--font-body);
    font-size: 0.9em;
    opacity: 0.8;
    margin-top: 3rem;
    border-top: 1px solid rgba(var(--text-color-rgb), 0.1);
}

.footer p {
    margin: 0;
}

@media (max-width: 768px) {
    .weather-card {
        padding: 2rem;
        min-height: 400px;
    }

    .weather-icon {
        font-size: var(--icon-size-mobile) !important;
        margin-bottom: 1.5rem;
        top: 0.15em;
    }

    .temperature {
        font-size: 3rem;
        gap: 1rem;
        padding: 0.5rem 0;
    }

    .condition {
        font-size: 1rem;
        margin-top: 0.5rem;
    }

    .aqi,
    .uv,
    .humidity,
    .feels-like {
        font-size: 0.8rem;
        gap: 0.3rem;
    }

    .aqi { top: 1rem; left: 1rem; }
    .uv { bottom: 1rem; left: 1rem; }
    .humidity { top: 1rem; right: 1rem; }
    .feels-like { bottom: 1rem; right: 1rem; }

    .aqi i,
    .uv i,
    .humidity i,
    .feels-like i {
        font-size: 0.9rem;
    }

    .location-warning {
        width: 90%;
        padding: 0.6rem;
        margin: 0.5rem auto;
    }

    .alert-item {
        padding: 1rem;
        margin: 1rem 0;
        font-family: var(--font-mono);
    }

    /* Ajustes para mobile no recurso de expandir/recolher */
    .alert-item {
        padding: 10px;
        font-size: 12px;
    }

    .alert-header {
        font-size: 14px;
    }

    .alert-details p {
        font-size: 12px;
    }

    .alert-toggle {
        font-size: 14px;
        padding: 3px;
    }

    #backToTopBtn {
        bottom: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }

    .footer {
        font-size: 0.8em;
        padding: 1rem;
    }
}