/* =============================================
   VARIABLES — dark (default) y light themes
   Basado en weather.vizuete.org
   ============================================= */
:root {
    --bg-from: #0a0f2c;
    --bg-to: #0a1628;
    --text: #fff;
    --text-muted: rgba(255,255,255,.50);
    --text-dim: rgba(255,255,255,.35);
    --card-bg: rgba(0, 0, 0, 0.22);
    --card-border: rgba(255, 255, 255, 0.12);
    --card-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.1), 0 8px 24px rgba(0, 0, 0, 0.2);
    --input-bg: rgba(255,255,255,.08);
    --input-border: rgba(255,255,255,.15);
    --suggestions-bg: #0d1b3e;
    --nav-bg: rgba(0,0,0,.20);
    --nav-border: rgba(255,255,255,.08);
    --fav-item-bg: rgba(255,255,255,.06);
    --fav-item-border: rgba(255,255,255,.08);
    --forecast-row-border: rgba(255,255,255,.06);
    --show-more-bg: rgba(255,255,255,.07);
    --show-more-border: rgba(255,255,255,.12);
    --show-more-color: rgba(255,255,255,.6);
    --bar-track: rgba(255,255,255,.12);
    --hourly-now-bg: rgba(255,183,77,.12);
    --hourly-now-color: #ffb74d;
    --temp-glow: rgba(255, 255, 255, 0.35);
}

[data-theme="light"] {
    --bg-from: #e8f4fd;
    --bg-to: #ddeeff;
    --text: #0a1628;
    --text-muted: rgba(10,22,40,.55);
    --text-dim: rgba(10,22,40,.40);
    --card-bg: rgba(255, 255, 255, 0.45);
    --card-border: rgba(255, 255, 255, 0.60);
    --card-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.8), 0 8px 24px rgba(0, 0, 0, 0.08);
    --input-bg: rgba(255,255,255,.60);
    --input-border: rgba(0,0,0,.15);
    --suggestions-bg: #fff;
    --nav-bg: rgba(255,255,255,.65);
    --nav-border: rgba(0,0,0,.08);
    --fav-item-bg: rgba(255,255,255,.70);
    --fav-item-border: rgba(0,0,0,.07);
    --forecast-row-border: rgba(0,0,0,.06);
    --show-more-bg: rgba(0,0,0,.06);
    --show-more-border: rgba(0,0,0,.10);
    --show-more-color: rgba(10,22,40,.60);
    --bar-track: rgba(0,0,0,.10);
    --hourly-now-bg: rgba(255,160,0,.15);
    --hourly-now-color: #d97706;
    --temp-glow: rgba(255, 255, 255, 0.8);
}

/* =============================================
   DYNAMIC WEATHER BACKGROUNDS
   ============================================= */
/* Sol / Despejado (Día) - Azulado */
[data-theme="dark"][data-weather="clear-day"] { --bg-from: #1e3a8a; --bg-to: #0f172a; }
[data-theme="light"][data-weather="clear-day"] { --bg-from: #87ceeb; --bg-to: #e0f6ff; }
/* Despejado (Noche) - Oscuro */
[data-theme="dark"][data-weather="clear-night"] { --bg-from: #080c17; --bg-to: #111827; }
[data-theme="light"][data-weather="clear-night"] { --bg-from: #1e293b; --bg-to: #334155; }
/* Nublado */
[data-theme="dark"][data-weather="clouds"] { --bg-from: #1e2530; --bg-to: #0d1117; }
[data-theme="light"][data-weather="clouds"] { --bg-from: #e2e8f0; --bg-to: #cfd8dc; }
/* Lluvia */
[data-theme="dark"][data-weather="rain"] { --bg-from: #061c3a; --bg-to: #010a17; }
[data-theme="light"][data-weather="rain"] { --bg-from: #e1f5fe; --bg-to: #81d4fa; }
/* Nieve */
[data-theme="dark"][data-weather="snow"] { --bg-from: #132238; --bg-to: #080f1a; }
[data-theme="light"][data-weather="snow"] { --bg-from: #f4f8fb; --bg-to: #e1eaf0; }
/* Tormenta */
[data-theme="dark"][data-weather="storm"] { --bg-from: #220f3a; --bg-to: #0d0417; }
[data-theme="light"][data-weather="storm"] { --bg-from: #ede7f6; --bg-to: #d1c4e9; }
/* Intervalos Nubosos / Nubes y Claros */
[data-theme="dark"][data-weather="partly-cloudy"] { --bg-from: #14244b; --bg-to: #0f172a; }
[data-theme="light"][data-weather="partly-cloudy"] { --bg-from: #a0d8ef; --bg-to: #e0f6ff; }
[data-theme="dark"][data-weather="partly-cloudy-night"] { --bg-from: #101830; --bg-to: #0b1120; }
[data-theme="light"][data-weather="partly-cloudy-night"] { --bg-from: #1e293b; --bg-to: #334155; }
/* Llovizna / Lluvia Ligera */
[data-theme="dark"][data-weather="drizzle"] { --bg-from: #0f172a; --bg-to: #0b1120; }
[data-theme="light"][data-weather="drizzle"] { --bg-from: #f1f5f9; --bg-to: #cbd5e1; }
/* Niebla / Bruma */
[data-theme="dark"][data-weather="fog"] { --bg-from: #334155; --bg-to: #1e293b; }
[data-theme="light"][data-weather="fog"] { --bg-from: #e2e8f0; --bg-to: #94a3b8; }
/* Calima / Polvo */
[data-theme="dark"][data-weather="dust"] { --bg-from: #45270a; --bg-to: #1c1917; }
[data-theme="light"][data-weather="dust"] { --bg-from: #fef08a; --bg-to: #d6d3d1; }

/* =============================================
   RESET & BODY
   ============================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: linear-gradient(180deg, var(--bg-from) 0%, var(--bg-to) 100%);
    background-size: 200% 200%;
    animation: gradient-shift 15s ease infinite;
    background-attachment: fixed;
    min-height: 100vh;
    color: var(--text);
    transition: background .8s ease, color .3s;
    overflow-x: hidden;
}

@keyframes gradient-shift {
    0% { background-position: 0% 0%; }
    50% { background-position: 0% 100%; }
    100% { background-position: 0% 0%; }
}

/* =============================================
   APP WRAPPER
   ============================================= */
.app {
    max-width: 480px;
    margin: 0 auto;
    padding: 0 1.1rem 1.5rem;
    position: relative;
    overflow-x: hidden;
    z-index: 1; /* Se asegura de estar encima de los efectos de fondo */
}

/* =============================================
   TOP BAR
   ============================================= */
.top-bar {
    display: flex;
    align-items: center;
    gap: .65rem;
    margin: 0 -1.1rem 1.4rem;
    padding: calc(1.4rem + env(safe-area-inset-top)) 1.1rem 1rem;
    position: sticky;
    top: 0;
    z-index: 1000;
    background: transparent;
    border-bottom: none;
    transition: padding 0.3s ease, margin 0.3s ease;
}

.top-bar::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: -20px;
    z-index: -1;
    backdrop-filter: blur(25px) saturate(150%);
    -webkit-backdrop-filter: blur(25px) saturate(150%);
    -webkit-mask-image: linear-gradient(to bottom, black calc(100% - 20px), transparent 100%);
    mask-image: linear-gradient(to bottom, black calc(100% - 20px), transparent 100%);
    pointer-events: none;
}

.top-bar.compact {
    padding: calc(.5rem + env(safe-area-inset-top)) 1.1rem .6rem;
    margin-bottom: .8rem;
}

.top-bar .search-wrapper { flex: 1; margin-bottom: 0; }

.search-wrapper { margin-bottom: 1.2rem; position: relative; }

.search-row {
    display: flex;
    align-items: center;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 50px;
    padding: 0 .6rem 0 1.1rem;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text);
    font-size: .95rem;
    padding: .75rem 0;
    font-family: inherit;
    width: 100%;
    transition: padding 0.3s ease, font-size 0.3s ease;
}
.top-bar.compact .search-input {
    padding: .45rem 0;
    font-size: .88rem;
}

.search-input::-webkit-search-cancel-button {
    display: none;
    -webkit-appearance: none;
}

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

.icon-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    padding: .4rem .3rem;
    line-height: 1;
    color: var(--text-muted);
    transition: color .2s, transform .2s;
    flex-shrink: 0;
}
.icon-btn:hover { color: var(--text); transform: scale(1.15); }

.auth-icon-btn {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
    overflow: hidden;
    padding: 0;
    transition: width 0.3s ease, height 0.3s ease;
}

.auth-icon-btn img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.auth-initial {
    background: #0d6efd;
    color: white;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.1rem;
}

.top-bar.compact .auth-icon-btn {
    width: 32px;
    height: 32px;
}

/* =============================================
   AUTOCOMPLETE
   ============================================= */
.suggestions {
    background: var(--suggestions-bg);
    z-index: 100;
    border: 1px solid var(--card-border);
    border-radius: 16px;
    width: 100%;
    list-style: none;
    position: absolute;
    top: 110%;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,.5);
    /* sin max-height ni overflow-y → no scrollbar */
}
.suggestions li {
    cursor: pointer;
    padding: .85rem 1.4rem;
    border-bottom: 1px solid var(--forecast-row-border);
    transition: background .15s;
    line-height: 1.4;
    display: flex;
    align-items: center;
    text-align: left;
    gap: .8rem;
}
.suggestions li:last-child { border-bottom: none; }
.suggestions li:hover { background: var(--input-bg); }
.suggestions li .sug-main { font-size: 1rem; font-weight: 700; color: var(--text); }
.suggestions li .sug-sub { color: var(--text-muted); font-size: .88rem; }
.sug-icon { font-size: 1.4rem; flex-shrink: 0; width: 30px; text-align: center; }
.sug-text { flex: 1; display: flex; flex-direction: column; }

/* =============================================
   LOADER
   ============================================= */
.status { text-align: center; color: var(--text-muted); padding: 3rem 1rem; }
.geo-spinner { font-size: 2.5rem; margin-bottom: .75rem; animation: pulse 1.5s ease-in-out infinite; display: block; }
.status p { font-size: .95rem; letter-spacing: .5px; }
@keyframes pulse {
    0%, 100% { opacity: .6; transform: scale(1); }
    50%       { opacity: 1; transform: scale(1.15); }
}

/* =============================================
   WEATHER EMOJI ANIMATIONS
   ============================================= */
@keyframes spin-slow    { from { transform: rotate(0deg);   } to { transform: rotate(360deg); } }
@keyframes float-cloud  { 0%,100% { transform: translateX(0);      } 50% { transform: translateX(6px);  } }
@keyframes float-rain   { 0%,100% { transform: translateY(0);      } 50% { transform: translateY(5px);  } }
@keyframes pulse-thunder{ 0%,100% { opacity: 1; transform: scale(1);    } 50% { opacity: .75; transform: scale(1.08); } }
@keyframes drift-snow   { 0%,100% { transform: translateX(0) rotate(0deg);   } 50% { transform: translateX(-5px) rotate(-8deg); } }
@keyframes drift-fog    { 0%,100% { opacity: .9; transform: translateX(0);   } 50% { opacity: .6; transform: translateX(4px); } }

.emoji-sun      { display: inline-block; animation: spin-slow    18s linear infinite; }
.emoji-cloud    { display: inline-block; animation: float-cloud  4s ease-in-out infinite; }
.emoji-rain     { display: inline-block; animation: float-rain   2s ease-in-out infinite; }
.emoji-thunder  { display: inline-block; animation: pulse-thunder 1.8s ease-in-out infinite; }
.emoji-snow     { display: inline-block; animation: drift-snow   5s ease-in-out infinite; }
.emoji-fog      { display: inline-block; animation: drift-fog    4s ease-in-out infinite; }

@keyframes float-emoji {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-12px); }
    100% { transform: translateY(0px); }
}

.pulse-location {
    animation: pulse-blue 2.5s infinite cubic-bezier(0.66, 0, 0, 1);
    border-radius: 50%;
}
@keyframes pulse-blue {
    0% { box-shadow: 0 0 0 0 rgba(13, 110, 253, 0.6); }
    70% { box-shadow: 0 0 0 10px rgba(13, 110, 253, 0); }
    100% { box-shadow: 0 0 0 0 rgba(13, 110, 253, 0); }
}

/* Animación de latido para Viento Fuerte */
@keyframes wind-pulse-anim {
    0% { transform: scale(1); filter: drop-shadow(0 0 2px rgba(239, 68, 68, 0.4)); }
    50% { transform: scale(1.15); filter: drop-shadow(0 0 10px rgba(239, 68, 68, 0.8)); }
    100% { transform: scale(1); filter: drop-shadow(0 0 2px rgba(239, 68, 68, 0.4)); }
}
.wind-pulse {
    animation: wind-pulse-anim 1.2s infinite ease-in-out;
    transform-origin: center;
}

/* Animaciones para las nuevas tarjetas detalladas */
@keyframes uv-danger-pulse {
    0%, 100% { filter: drop-shadow(0 0 5px rgba(239, 68, 68, 0.4)); transform: scale(1); }
    50% { filter: drop-shadow(0 0 15px rgba(239, 68, 68, 0.9)); transform: scale(1.05); }
}
.uv-danger-pulse { animation: uv-danger-pulse 2s infinite ease-in-out; }
@keyframes leaf-sway {
    0%, 100% { transform: rotate(-10deg); }
    50% { transform: rotate(10deg); }
}

/* Animación de brújula viva */
@keyframes wind-wobble {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-4deg); }
    75% { transform: rotate(3deg); }
}
.wind-arrow-animate { animation: wind-wobble 3s ease-in-out infinite; }

/* =============================================
   WEATHER FX BACKGROUND ANIMATIONS
   ============================================= */
.weather-fx-container {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.fx-drop {
    position: absolute;
    background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,0.7));
    width: 1.5px;
    height: 25px;
    top: -30px;
    animation: fall-rain linear infinite;
}
@keyframes fall-rain {
    0% { transform: translateY(0); }
    100% { transform: translateY(110vh); }
}

.fx-flake {
    position: absolute;
    background: #fff;
    border-radius: 50%;
    top: -10px;
    animation: fall-snow linear infinite;
}
@keyframes fall-snow {
    0% { transform: translateY(0) translateX(0); }
    50% { transform: translateY(55vh) translateX(25px); }
    100% { transform: translateY(110vh) translateX(-15px); }
}

.fx-hail {
    position: absolute;
    background: #fff;
    border-radius: 50%;
    top: -10px;
    animation: fall-hail linear infinite;
    box-shadow: inset -1px -1px 3px rgba(0,0,0,0.3);
}
@keyframes fall-hail {
    0% { transform: translateY(0) translateX(0); }
    100% { transform: translateY(110vh) translateX(10px); }
}

.fx-star {
    position: absolute;
    background: #fff;
    border-radius: 50%;
    animation: twinkle ease-in-out infinite alternate;
}
@keyframes twinkle {
    0% { opacity: 0.1; transform: scale(0.6); box-shadow: none; }
    100% { opacity: 0.9; transform: scale(1.2); box-shadow: 0 0 6px rgba(255,255,255,0.8); }
}

.fx-sun-core {
    position: absolute;
    top: -10vh; right: -15vw;
    width: 400px; height: 400px;
    background: radial-gradient(circle at 40% 40%, rgba(255,255,255,1) 0%, rgba(255,255,220,0.9) 10%, rgba(255,180,50,0.4) 30%, transparent 65%);
    border-radius: 50%;
    filter: blur(25px);
    animation: sun-organic-pulse 5s infinite alternate ease-in-out;
}
.fx-sun-glare {
    position: absolute;
    top: 5vh; right: -20vw;
    width: 100vw; height: 80px;
    background: radial-gradient(ellipse at center, rgba(255,255,255,0.5) 0%, rgba(255,200,100,0.2) 30%, transparent 70%);
    border-radius: 50%;
    transform: rotate(-20deg);
    filter: blur(10px);
    animation: sun-glare-pulse 7s infinite alternate ease-in-out;
}
.fx-sun-glare::before {
    content: ''; position: absolute;
    top: 15vh; right: 60vw;
    width: 60px; height: 60px; border-radius: 50%;
    background: rgba(150, 220, 255, 0.08);
    border: 1px solid rgba(150, 220, 255, 0.04);
}
.fx-sun-glare::after {
    content: ''; position: absolute;
    top: 30vh; right: 85vw;
    width: 30px; height: 30px; border-radius: 50%;
    background: rgba(100, 255, 150, 0.06);
    border: 1px solid rgba(100, 255, 150, 0.03);
}
@keyframes sun-organic-pulse {
    0% { transform: scale(0.95); opacity: 0.8; }
    100% { transform: scale(1.05); opacity: 1; }
}
@keyframes sun-glare-pulse {
    0% { transform: scaleX(0.9) rotate(-20deg); opacity: 0.6; }
    100% { transform: scaleX(1.1) rotate(-20deg); opacity: 0.9; }
}

.fx-floating-cloud {
    position: absolute;
    background: rgba(255,255,255,0.25);
    border-radius: 50%;
    filter: blur(12px);
    animation: float-bg-cloud linear infinite;
    left: -400px;
    box-shadow: 120px 40px 0 20px rgba(255,255,255,0.15), -80px 20px 0 10px rgba(255,255,255,0.2);
}
[data-theme="light"] .fx-floating-cloud { 
    background: rgba(255,255,255,0.6); 
    box-shadow: 120px 40px 0 20px rgba(255,255,255,0.4), -80px 20px 0 10px rgba(255,255,255,0.5); 
}

@keyframes float-bg-cloud {
    0% { transform: translateX(0); }
    100% { transform: translateX(calc(100vw + 300px)); }
}

.storm-flash {
    animation: lightning-flash 7s infinite;
}
@keyframes lightning-flash {
    0%, 93%, 100% { background-color: transparent; }
    94%, 96% { background-color: rgba(255,255,255,0.25); }
    95% { background-color: transparent; }
}

.fx-shooting-star {
    position: absolute;
    width: 100px;
    height: 2px;
    background: linear-gradient(to right, rgba(255,255,255,1), rgba(255,255,255,0));
    left: 120vw;
    transform: rotate(-30deg);
    opacity: 0;
    animation: shooting-star 15s infinite linear;
}
@keyframes shooting-star {
    0% { left: 120vw; opacity: 0; transform: translateY(0) rotate(-30deg); }
    1% { opacity: 1; }
    5% { left: -20vw; opacity: 0; transform: translateY(50vh) rotate(-30deg); }
    100% { left: -20vw; opacity: 0; }
}

.fx-fog-layer {
    position: absolute;
    bottom: 0;
    width: 300vw;
    height: 50vh;
    background: linear-gradient(to top, rgba(255,255,255,0.4), transparent);
    filter: blur(20px);
    animation: fog-drift 25s infinite linear;
}
[data-theme="dark"] .fx-fog-layer { background: linear-gradient(to top, rgba(200,200,255,0.08), transparent); }
@keyframes fog-drift {
    0% { transform: translateX(-50vw); }
    100% { transform: translateX(0); }
}

.fx-dust-particle {
    position: absolute;
    background: rgba(139, 69, 19, 0.4);
    border-radius: 50%;
    filter: blur(1px);
    animation: dust-float 5s infinite ease-in-out alternate;
}
[data-theme="light"] .fx-dust-particle { background: rgba(200, 150, 50, 0.5); }
@keyframes dust-float {
    0% { transform: translate(0, 0); }
    100% { transform: translate(20px, -20px); }
}

.fx-leaf {
    position: absolute;
    font-size: 1.2rem;
    opacity: 0;
    animation: leaf-blow 4s infinite linear;
    filter: drop-shadow(0 2px 2px rgba(0,0,0,0.3));
}
@keyframes leaf-blow {
    0% { left: -10vw; transform: translateY(0) rotate(0deg); opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { left: 110vw; transform: translateY(30vh) rotate(360deg); opacity: 0; }
}

/* =============================================
   ANIMACIÓN
   ============================================= */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.animate-fade-in { animation: fadeIn .5s ease-out forwards; }

@keyframes moon-wipe {
    0% { clip-path: polygon(0 0, 0 100%, 0 100%, 0 0); }
    100% { clip-path: polygon(0 0, 0 100%, 100% 100%, 100% 0); }
}
.d-none-user { display: none !important; }

/* =============================================
   ALERT BANNERS
   ============================================= */
.alert-banner {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fca5a5;
    border-radius: 16px;
    padding: 0.8rem 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.alert-banner.rain {
    background: rgba(14, 165, 233, 0.15);
    border-color: rgba(14, 165, 233, 0.4);
    color: #7dd3fc;
}

/* =============================================
   SWIPE DOTS (Carousel Pagination)
   ============================================= */
.swipe-dots-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 7px;
    margin-bottom: 1rem;
    min-height: 12px;
}
.swipe-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--text-dim);
    transition: all 0.3s ease;
    cursor: pointer;
}
.swipe-dot.active {
    width: 20px;
    border-radius: 4px;
    background-color: var(--text);
}
.swipe-dot-location {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

/* =============================================
   MAIN CARD (ciudad + temperatura)
   ============================================= */
.main-card {
    background: var(--card-bg);
    backdrop-filter: blur(35px) saturate(150%);
    -webkit-backdrop-filter: blur(35px) saturate(150%);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    box-shadow: var(--card-shadow);
    text-align: center;
    padding: 1.5rem .5rem 2rem;
    margin-bottom: 1rem;
}
.card-top {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: .75rem;
    margin-bottom: .25rem;
    width: 100%;
}
.city-info { display: flex; flex-direction: column; align-items: center; gap: .15rem; max-width: 100%; }
.city-name { 
    font-size: 1.8rem; 
    font-weight: 600; 
    letter-spacing: .5px; 
    color: var(--text); 
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis; 
    max-width: 55vw; 
    display: inline-block; 
    vertical-align: middle; 
}
.city-geo-label { color: var(--text-muted); font-size: .75rem; letter-spacing: .5px; }
.fav-btn {
    cursor: pointer;
    background: none;
    border: none;
    font-size: 1.6rem;
    line-height: 1;
    opacity: .7;
    transition: opacity .2s, transform .2s;
}
.fav-btn:hover { opacity: 1; transform: scale(1.2); }

.fav-btn.is-fav {
    color: #ffd700;
    opacity: 1;
}

@keyframes spin-star {
    0% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.4) rotate(180deg); }
    100% { transform: scale(1) rotate(360deg); }
}

.spin-anim {
    animation: spin-star 0.4s ease-in-out;
}

.weather-emoji-big { 
    font-size: 3.5rem; 
    line-height: 1; 
    margin: .5rem 0 .2rem; 
    display: inline-block;
    animation: float-emoji 6s ease-in-out infinite; 
}
.weather-emoji-big .emoji-sun     { filter: drop-shadow(0 0 25px rgba(255, 183, 77, 0.6)); }
.weather-emoji-big .emoji-cloud   { filter: drop-shadow(0 0 25px rgba(255, 255, 255, 0.3)); }
.weather-emoji-big .emoji-rain    { filter: drop-shadow(0 0 25px rgba(56, 189, 248, 0.6)); }
.weather-emoji-big .emoji-thunder { filter: drop-shadow(0 0 25px rgba(168, 85, 247, 0.6)); }
.weather-emoji-big .emoji-snow    { filter: drop-shadow(0 0 25px rgba(224, 242, 254, 0.6)); }
.weather-emoji-big .emoji-fog     { filter: drop-shadow(0 0 25px rgba(156, 163, 175, 0.5)); }
.weather-emoji-big .emoji-default { filter: drop-shadow(0 0 25px rgba(255, 255, 255, 0.4)); }
.big-temp {
    font-size: 7rem;
    font-weight: 200;
    letter-spacing: -4px;
    line-height: 1;
    color: var(--text);
    text-shadow: 0 0 35px var(--temp-glow);
    margin: .1rem 0;
}
.condition-row { color: var(--text-muted); font-size: 1rem; margin-bottom: .4rem; }
.wind-row { color: var(--text-dim); font-size: .85rem; }

.daily-summary {
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.4rem;
    opacity: 0.9;
}

/* =============================================
   SUN CURVE (Tarjeta Principal)
   ============================================= */
.sun-curve-wrap {
    width: 100%;
    max-width: 240px;
    margin: 1.2rem auto 0.8rem;
    height: 55px;
    position: relative;
}
.sun-curve-svg {
    width: 100%;
    height: 100%;
    display: block;
    overflow: visible;
}

/* =============================================
   FORECAST CARD
   ============================================= */
.forecast-card {
    background: var(--card-bg);
    backdrop-filter: blur(35px) saturate(150%);
    -webkit-backdrop-filter: blur(35px) saturate(150%);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    box-shadow: var(--card-shadow);
    width: 100%;
    margin-bottom: 1rem;
    padding: 1.2rem 1.4rem;
}
.forecast-title {
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-size: .78rem;
    margin-bottom: 1rem;
    text-align: center;
}
.forecast-row {
    display: grid;
    grid-template-columns: 3.2rem 2rem 2.8rem 1fr 2.8rem;
    align-items: center;
    gap: .5rem;
    padding: .55rem 0;
    border-bottom: 1px solid var(--forecast-row-border);
}
.forecast-row:last-of-type { border-bottom: none; }
.forecast-day { color: var(--text); font-size: .95rem; }
.forecast-emoji { text-align: center; font-size: 1.2rem; }
.forecast-min { color: var(--text-muted); text-align: right; font-size: .88rem; }
.forecast-max { color: var(--text); font-size: .88rem; font-weight: 600; }
.temp-curve-wrap { position: relative; height: 28px; }
.temp-curve-wrap svg { display: block; width: 100%; height: 100%; overflow: visible; }
.show-more-btn {
    background: var(--show-more-bg);
    border: 1px solid var(--show-more-border);
    width: 100%;
    color: var(--show-more-color);
    cursor: pointer;
    border-radius: 12px;
    margin-top: .9rem;
    padding: .6rem;
    font-size: .85rem;
    font-family: inherit;
    transition: background .2s, color .2s;
}
.show-more-btn:hover { background: var(--input-bg); color: var(--text); }

/* =============================================
   HOURLY CARD (columnas deslizables)
   ============================================= */
.hourly-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(35px) saturate(150%);
    -webkit-backdrop-filter: blur(35px) saturate(150%);
    border-radius: 20px;
    box-shadow: var(--card-shadow);
    width: 100%;
    min-width: 0;
    margin-bottom: 1rem;
    padding: 1.2rem 0 .8rem;
}
.hourly-title {
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-size: .78rem;
    margin-bottom: .75rem;
    padding: 0 1.4rem;
}
.hourly-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
    padding-bottom: .4rem;
    transition: -webkit-mask-image 0.3s, mask-image 0.3s;
}
.hourly-scroll::-webkit-scrollbar { display: none; }
/* inline-flex: se dimensiona al contenido → desborda → activa el scroll */
.hourly-inner {
    display: inline-flex;
    flex-direction: column;
    padding: 0 .4rem;
}
.hourly-cols {
    display: flex;
    flex-direction: row;
}
.hourly-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .18rem;
    padding: .45rem 0 .35rem;
    border-radius: 12px;
    width: 60px;
    flex-shrink: 0;
    transition: background .2s;
    cursor: default;
}
.hourly-now { background: var(--hourly-now-bg); }
.hourly-rain { background: rgba(14, 165, 233, 0.15); }
.hourly-emoji { font-size: 1.2rem; line-height: 1; }
.hourly-wind { color: var(--text-muted); font-size: .7rem; white-space: nowrap; }
.hourly-hour { color: var(--text-dim); font-size: .68rem; }
.hourly-now .hourly-hour { color: var(--hourly-now-color); font-weight: 700; }
/* SVG chart label text (inline SVG — targetable by CSS) */
.hourly-chart-label {
    fill: var(--text);
    font-size: 11px;
    font-weight: 600;
    font-family: 'Segoe UI', system-ui, sans-serif;
    text-anchor: middle;
}

/* =============================================
   MAP CARD
   ============================================= */
.map-card {
    background: var(--card-bg);
    backdrop-filter: blur(35px) saturate(150%);
    -webkit-backdrop-filter: blur(35px) saturate(150%);
    border-radius: 20px;
    margin-bottom: 1rem;
    border: 1px solid var(--card-border);
    padding: .5rem;
    box-shadow: var(--card-shadow);
}
#mapaClima {
    border-radius: 14px;
    z-index: 1; /* Mantiene los bordes redondeados limpios y por encima del contenedor */
}
[data-theme="dark"] .osm-tiles .leaflet-tile {
    filter: brightness(0.55) invert(1) contrast(3) hue-rotate(200deg) saturate(0.3);
}

.smooth-radar-layer {
    transition: opacity 0.5s ease-in-out;
}

.radar-toggle-btn {
    position: absolute;
    bottom: 12px;
    right: 12px;
    z-index: 400; /* Por encima de Leaflet */
    background: var(--nav-bg);
    color: var(--text);
    border: 1px solid var(--card-border);
    border-radius: 50px;
    padding: 0.4rem 0.9rem;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    transition: transform 0.2s, background 0.2s;
}
.radar-toggle-btn:active { transform: scale(0.95); }

.custom-map-icon {
    background: transparent;
    border: none;
}

/* =============================================
   DETAILS SECTION
   ============================================= */
.details-section { margin-top: 1rem; }
.section-title {
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 1px;
    font-size: .8rem;
    margin-bottom: .75rem;
    padding-left: .4rem;
}
.details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .75rem;
}
.detail-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(35px) saturate(150%);
    -webkit-backdrop-filter: blur(35px) saturate(150%);
    border-radius: 20px;
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: .2rem;
    min-width: 0;
    padding: 1.1rem 1.2rem;
}
/* Si la última tarjeta queda sola al final, se expande a dos columnas */
.detail-card:last-child:nth-child(odd) {
    grid-column: span 2;
}

.detail-header { display: flex; align-items: center; justify-content: center; gap: .4rem; width: 100%; }
.detail-icon { font-size: 1rem; }
.detail-title-label {
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .5px;
    font-size: .78rem;
}
.detail-subtitle { color: var(--text-muted); font-size: .85rem; }
.detail-gauge { margin: .3rem 0 .1rem; }
.detail-gauge.center { display: flex; justify-content: center; }
.detail-value { color: var(--text); font-size: 2.1rem; font-weight: 700; margin-top: .2rem; letter-spacing: -0.5px; }
.detail-unit { color: var(--text-muted); font-size: 1rem; font-weight: 500; margin-left: 2px; letter-spacing: 0; }

/* Sunrise Card Special Animation */
.sunrise-card {
    background: linear-gradient(to bottom, var(--card-bg) 40%, rgba(255, 152, 0, 0.15) 100%);
    position: relative;
    overflow: hidden;
}
.sunrise-glow {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    width: 140px;
    height: 70px;
    background: radial-gradient(ellipse at bottom, rgba(255, 152, 0, 0.45) 0%, transparent 70%);
    border-radius: 140px 140px 0 0;
    animation: sunrise-pulse 4s infinite alternate ease-in-out;
    pointer-events: none;
}
@keyframes sunrise-pulse {
    0% { opacity: 0.3; transform: translateX(-50%) scale(0.9); }
    100% { opacity: 0.8; transform: translateX(-50%) scale(1.15); }
}

/* Gauge SVG */
.gauge-svg { overflow: visible; display: block; }

/* =============================================
   FAVORITES
   ============================================= */
.favorites-list { display: flex; flex-direction: column; gap: .6rem; }
.favorite-item {
    background: var(--fav-item-bg);
    border: 1px solid var(--fav-item-border);
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: .9rem;
    padding: .9rem 1rem;
    cursor: pointer;
    transition: background .2s, transform .2s, box-shadow .2s;
}
.favorite-item:hover { background: var(--input-bg); }

.favorite-item.drag-active {
    transform: scale(1.03);
    box-shadow: 0 12px 24px rgba(0,0,0,0.3);
    background: var(--input-bg);
    z-index: 100;
}
.favorite-item.drag-placeholder {
    opacity: 0.4;
    border: 2px dashed var(--text-muted);
    background: transparent;
    box-shadow: none;
}
.favorite-item.drag-placeholder * {
    opacity: 0;
}

@keyframes cascadeIn {
    0% { opacity: 0; transform: translateY(15px); }
    100% { opacity: 1; transform: translateY(0); }
}
.cascade-enter {
    opacity: 0;
    animation: cascadeIn 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.drag-handle {
    color: var(--text-dim);
    cursor: grab;
    font-size: 1.1rem;
}
.favorite-name { flex: 1; font-weight: 600; font-size: .95rem; color: var(--text); }
.remove-fav-btn {
    background: rgba(255, 80, 80, .15);
    border: none;
    color: #ff6b6b;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 28px;
    height: 28px;
    font-size: .8rem;
    transition: background .2s;
    flex-shrink: 0;
}
.remove-fav-btn:hover { background: rgba(255,80,80,.35); }

/* =============================================
   BACK TO TOP BUTTON
   ============================================= */
.back-to-top {
    position: fixed;
    bottom: 85px;
    right: 15px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--nav-bg);
    color: var(--text);
    border: 1px solid var(--nav-border);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 900;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    opacity: 0;
    transform: translateY(20px) scale(0.9);
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.back-to-top.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}
.back-to-top:active {
    transform: scale(0.9);
}

/* =============================================
   AUTH MODAL
   ============================================= */
.auth-modal-content {
    background: var(--nav-bg);
    backdrop-filter: blur(35px) saturate(150%);
    -webkit-backdrop-filter: blur(35px) saturate(150%);
    color: var(--text);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    box-shadow: var(--card-shadow);
}
.auth-modal-content .modal-header {
    border-bottom: 1px solid var(--forecast-row-border);
    padding: 1rem 1.2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}
.auth-modal-content .btn-close { filter: invert(1) brightness(1.5); }
[data-theme="light"] .auth-modal-content .btn-close { filter: none; }
[data-theme="light"] .auth-modal-content {
    color: #0a1628;
}

.auth-tabs { display: flex; gap: .5rem; flex: 1; }
.auth-tab {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: .95rem;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    padding: .3rem .5rem;
    border-bottom: 2px solid transparent;
    transition: color .2s, border-color .2s;
}
.auth-tab.active { color: var(--text); border-bottom-color: var(--text); }

.auth-input {
    display: block;
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--text);
    border-radius: 12px;
    padding: .75rem 1rem;
    font-size: .95rem;
    font-family: inherit;
    outline: none;
    margin-bottom: .75rem;
    transition: border-color .2s;
}
.auth-input:focus { border-color: var(--text-muted); }
.auth-input::placeholder { color: var(--text-dim); }

.auth-btn-primary {
    display: block;
    width: 100%;
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.2);
    color: var(--text);
    border-radius: 12px;
    padding: .75rem;
    font-size: .95rem;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s;
    margin-bottom: .5rem;
}
.auth-btn-primary:hover { background: rgba(255,255,255,.2); }
[data-theme="light"] .auth-btn-primary {
    background: rgba(10,22,40,.08);
    border-color: rgba(10,22,40,.15);
    color: #0a1628;
}
[data-theme="light"] .auth-btn-primary:hover { background: rgba(10,22,40,.14); }
.auth-btn-danger { background: rgba(255,80,80,.2) !important; border-color: rgba(255,80,80,.3) !important; color: #ff6b6b !important; }
.auth-btn-danger:hover { background: rgba(255,80,80,.35) !important; }

.auth-divider {
    text-align: center;
    color: var(--text-dim);
    font-size: .8rem;
    margin: .75rem 0;
    position: relative;
}
.auth-divider::before, .auth-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background: var(--forecast-row-border);
}
.auth-divider::before { left: 0; }
.auth-divider::after  { right: 0; }

.auth-error {
    background: rgba(255,80,80,.15);
    border: 1px solid rgba(255,80,80,.3);
    color: #ff8a8a;
    border-radius: 10px;
    padding: .6rem .9rem;
    font-size: .88rem;
    margin-bottom: .75rem;
}

/* =============================================
   TOAST NOTIFICATIONS
   ============================================= */
.custom-toast {
    background: var(--nav-bg);
    color: var(--text);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--nav-border) !important;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,.3);
}
.custom-toast .btn-close { filter: invert(1) brightness(1.5); }
[data-theme="light"] .custom-toast .btn-close { filter: none; }

/* =============================================
   BOOTSTRAP OVERRIDES (solo para modales)
   ============================================= */
.modal-backdrop { backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); background-color: rgba(0,0,0,0.3); }

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 400px) {
    .big-temp { font-size: 5.5rem; }
    .app { padding: 1rem .8rem 1.5rem; }
}

/* =============================================
   SETTINGS UI
   ============================================= */
.settings-section { margin-bottom: 1.5rem; }
.settings-section-title { font-size: 0.82rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 0.6rem; font-weight: 600; padding-left: 0.6rem; cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.settings-section-title::-webkit-details-marker { display: none; }
.settings-section-title::after { content: '▼'; font-size: 0.7rem; transition: transform 0.2s; padding-right: 0.6rem; }
details[open] .settings-section-title::after { transform: rotate(180deg); }
.settings-group { background: var(--input-bg); border-radius: 12px; border: 1px solid var(--input-border); overflow: hidden; }
.settings-item { display: flex; align-items: center; justify-content: space-between; padding: 0.9rem 1.2rem; border-bottom: 1px solid var(--forecast-row-border); margin: 0; }
.settings-item:last-child { border-bottom: none; }
.settings-item-label { font-size: 0.95rem; color: var(--text); }
.settings-select { background: transparent; border: none; color: var(--text-muted); padding: 0; font-size: 0.95rem; outline: none; text-align: right; font-weight: 500; cursor: pointer; }
.settings-select option { background: var(--card-bg); color: var(--text); }
.settings-link-item { display: flex; align-items: center; justify-content: space-between; padding: 0.8rem 0; border-bottom: 1px solid var(--forecast-row-border); color: var(--text); text-decoration: none; font-size: 0.95rem; }
.settings-link-item:hover { color: var(--text); opacity: 0.8; }

/* About Card */
.about-card {
    margin-top: 1.8rem;
    background: linear-gradient(to bottom right, rgba(13, 27, 62, 0.85), rgba(10, 15, 44, 0.95)), url('https://images.unsplash.com/photo-1464822759023-fed622ff2c3b?auto=format&fit=crop&w=600&q=80') center/cover;
    border-radius: 16px;
    padding: 1.2rem;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}
[data-theme="light"] .about-card {
    background: linear-gradient(to bottom right, rgba(255, 255, 255, 0.85), rgba(232, 244, 253, 0.95)), url('https://images.unsplash.com/photo-1464822759023-fed622ff2c3b?auto=format&fit=crop&w=600&q=80') center/cover;
    color: #0a1628;
    border: 1px solid rgba(0,0,0,0.1);
}

/* Modern Switch */
.modern-switch { position: relative; display: inline-block; width: 44px; height: 24px; margin-bottom: 0; }
.modern-switch input { opacity: 0; width: 0; height: 0; }
.switch-slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: var(--input-bg); border: 1px solid var(--input-border); transition: .3s; border-radius: 30px; }
.switch-slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 3px; bottom: 3px; background-color: var(--text-muted); transition: .3s; border-radius: 50%; }
input:checked + .switch-slider { background-color: #0d6efd; border-color: #0d6efd; }
input:checked + .switch-slider:before { transform: translateX(20px); background-color: #fff; }

/* Dropdown menu */
.custom-dropdown { background: var(--nav-bg); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border: 1px solid var(--nav-border); border-radius: 12px; padding: 0.5rem; box-shadow: 0 8px 32px rgba(0,0,0,0.3); }
[data-theme="light"] .custom-dropdown { background: rgba(255,255,255,0.85); border-color: rgba(0,0,0,0.1); }
.custom-dropdown .dropdown-item { color: var(--text); border-radius: 8px; padding: 0.5rem 1rem; transition: background 0.2s; font-size: 0.95rem; font-weight: 500; }
.custom-dropdown .dropdown-item:hover { background: var(--input-bg); color: var(--text); }
