/* ═══════════════════════════════════════════════
   SMART WEATHER DASHBOARD — style.css
   Design: Full-screen city photo + glass panels
   ═══════════════════════════════════════════════ */

:root {
    --font: 'DM Sans', sans-serif;
    --font-serif: 'DM Serif Display', serif;

    /* Glass */
    --glass: rgba(15, 15, 20, 0.52);
    --glass-light: rgba(255, 255, 255, 0.06);
    --glass-border: rgba(255, 255, 255, 0.10);
    --glass-blur: blur(22px);

    /* Text */
    --t1: rgba(255, 255, 255, 0.95);
    --t2: rgba(255, 255, 255, 0.55);
    --t3: rgba(255, 255, 255, 0.30);
    --accent: #ffffff;

    /* Panels */
    --bottom-bg: rgba(10, 10, 14, 0.88);
    --bottom-border: rgba(255, 255, 255, 0.07);
    --card-bg: rgba(255, 255, 255, 0.07);
    --card-hover: rgba(255, 255, 255, 0.12);

    /* Sizes */
    --hero-h: 58vh;
    --bottom-h: 42vh;
    --radius: 16px;
}

/* ── Reset ── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font);
    color: var(--t1);
    background: #0a0a0e;
    user-select: none;
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

/* ═══════════════════════════════════
   LOADER
═══════════════════════════════════ */
.loader {
    position: fixed;
    inset: 0;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #0a0a0e;
    transition: opacity 0.5s ease;
}

.loader.hidden {
    opacity: 0;
    pointer-events: none;
}

.loader-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.7);
    animation: dotPulse 1.2s ease-in-out infinite;
}

.loader-dot:nth-child(2) {
    animation-delay: 0.15s;
}

.loader-dot:nth-child(3) {
    animation-delay: 0.30s;
}

@keyframes dotPulse {

    0%,
    80%,
    100% {
        transform: scale(0.6);
        opacity: 0.3;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ═══════════════════════════════════
   CITY BACKGROUND
═══════════════════════════════════ */
.city-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
}

.city-bg-img {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center top;
    background-repeat: no-repeat;
    transition: opacity 0.8s ease;
    background-color: #1a1a2e;
}

.city-bg-tint {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom,
            rgba(0, 0, 0, 0.25) 0%,
            rgba(0, 0, 0, 0.10) 30%,
            rgba(0, 0, 0, 0.45) 55%,
            rgba(10, 10, 14, 0.92) 100%);
}

/* ═══════════════════════════════════
   HERO PANEL
═══════════════════════════════════ */
.hero-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--hero-h);
    z-index: 10;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 1.4rem 2rem 1.8rem;
}

/* ── Search ── */
.search-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-self: center;
    width: 100%;
    max-width: 460px;
    /* ✅ Necesario para que el dropdown se posicione relativo a este contenedor */
    position: relative;
}

.search-bar {
    display: flex;
    align-items: center;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    backdrop-filter: var(--glass-blur);
    border-radius: 50px;
    padding: 0.45rem 0.55rem 0.45rem 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-bar:focus-within {
    border-color: rgba(255, 255, 255, 0.35);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.06);
}

.s-icon {
    width: 16px;
    height: 16px;
    color: var(--t2);
    flex-shrink: 0;
}

.s-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    font-family: var(--font);
    font-size: 0.88rem;
    color: var(--t1);
    padding: 0.2rem 0.6rem;
}

.s-input::placeholder {
    color: var(--t3);
}

.s-geo {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--t1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s;
}

.s-geo:hover {
    background: rgba(255, 255, 255, 0.22);
}

.s-geo svg {
    width: 14px;
    height: 14px;
}

/* ═══════════════════════════════════
   ✅ SUGGESTIONS DROPDOWN
═══════════════════════════════════ */
.suggestions-box {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    /* justo debajo de search-bar */
    left: 0;
    right: 0;
    z-index: 50;
    background: rgba(12, 12, 18, 0.97);
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 16px;
    backdrop-filter: blur(24px);
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
    animation: sugSlideIn 0.18s ease;
}

.suggestions-box.show {
    display: block;
}

@keyframes sugSlideIn {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.suggestion-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.7rem 1rem;
    cursor: pointer;
    transition: background 0.14s;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    user-select: none;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover,
.suggestion-item.active {
    background: rgba(255, 255, 255, 0.09);
}

.sug-icon {
    color: var(--t3);
    flex-shrink: 0;
}

.sug-name {
    font-size: 0.87rem;
    font-weight: 500;
    color: var(--t1);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sug-meta {
    font-size: 0.73rem;
    color: var(--t3);
    white-space: nowrap;
}

/* History chips */
.history-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    padding: 0 0.3rem;
}

.h-chip-wrap {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 50px;
    overflow: hidden;
    transition: border-color 0.15s;
}

.h-chip-wrap:hover {
    border-color: rgba(255, 255, 255, 0.25);
}

.h-chip {
    background: none;
    border: none;
    font-family: var(--font);
    font-size: 0.75rem;
    color: var(--t2);
    padding: 0.22rem 0.5rem 0.22rem 0.7rem;
    cursor: pointer;
    transition: color 0.15s;
}

.h-chip:hover {
    color: var(--t1);
}

.h-chip-del {
    background: none;
    border: none;
    border-left: 1px solid rgba(255, 255, 255, 0.10);
    color: var(--t3);
    font-size: 0.85rem;
    line-height: 1;
    padding: 0.15rem 0.5rem;
    cursor: pointer;
    transition: all 0.15s;
}

.h-chip-del:hover {
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.12);
}

/* Error bar */
.error-bar {
    display: none;
    align-items: center;
    gap: 0.5rem;
    background: rgba(220, 60, 60, 0.25);
    border: 1px solid rgba(220, 60, 60, 0.4);
    backdrop-filter: var(--glass-blur);
    border-radius: 50px;
    padding: 0.4rem 1rem;
    font-size: 0.8rem;
    color: #ffaaaa;
    animation: slideDown 0.25s ease;
}

.error-bar.show {
    display: flex;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Hero info row ── */
.hero-info {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.hero-info.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Left */
.hero-left {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.temp-row {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.temp-big {
    font-family: var(--font-serif);
    font-size: clamp(3.5rem, 8vw, 6rem);
    line-height: 0.9;
    letter-spacing: -0.03em;
    color: var(--t1);
}

.temp-meta {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding-top: 0.5rem;
}

.unit-toggle {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.8rem;
    color: var(--t2);
}

.u-btn {
    background: none;
    border: none;
    font-family: var(--font);
    font-size: 0.8rem;
    color: var(--t3);
    cursor: pointer;
    transition: color 0.15s;
    padding: 0;
}

.u-btn.active {
    color: var(--t1);
    font-weight: 600;
}

.u-btn:hover {
    color: var(--t2);
}

.condition-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--t2);
}

.cond-icon {
    width: 28px;
    height: 28px;
}

.city-title {
    font-family: var(--font-serif);
    font-size: clamp(1.6rem, 4vw, 2.6rem);
    font-weight: 400;
    letter-spacing: -0.01em;
    line-height: 1.1;
    color: var(--t1);
    margin-top: 0.4rem;
}

.city-sub {
    font-size: 0.88rem;
    color: var(--t2);
    font-weight: 300;
}

.change-city-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: none;
    border: none;
    color: var(--t3);
    font-family: var(--font);
    font-size: 0.78rem;
    cursor: pointer;
    margin-top: 0.5rem;
    transition: color 0.15s;
}

.change-city-btn:hover {
    color: var(--t2);
}

/* Right */
.hero-right {
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
}

.clock-big {
    font-family: var(--font-serif);
    font-size: clamp(1.8rem, 4vw, 3rem);
    font-weight: 400;
    letter-spacing: -0.02em;
    color: var(--t1);
}

.date-str {
    font-size: 0.82rem;
    color: var(--t2);
    font-weight: 300;
}

.tz-row {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-top: 0.4rem;
    background: rgba(0, 0, 0, 0.30);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 50px;
    padding: 0.3rem 0.6rem;
    backdrop-filter: blur(10px);
}

.tz-btn {
    background: none;
    border: none;
    font-family: var(--font);
    font-size: 0.7rem;
    color: var(--t3);
    cursor: pointer;
    padding: 0.1rem 0.3rem;
    border-radius: 50px;
    transition: all 0.15s;
}

.tz-btn.active,
.tz-btn:hover {
    color: var(--t1);
    background: rgba(255, 255, 255, 0.12);
}

.tz-arrow {
    font-size: 0.75rem;
    color: var(--t3);
    padding-left: 0.15rem;
}

/* ═══════════════════════════════════
   BOTTOM PANEL
═══════════════════════════════════ */
.bottom-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-h);
    z-index: 10;
    background: var(--bottom-bg);
    border-top: 1px solid var(--bottom-border);
    backdrop-filter: blur(30px);
    display: flex;
    gap: 0;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease 0.2s, transform 0.6s ease 0.2s;
}

.bottom-panel.visible {
    opacity: 1;
    transform: translateY(0);
}

/* LEFT */
.bp-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1.1rem 1.6rem;
    border-right: 1px solid var(--bottom-border);
    overflow: hidden;
}

/* Tabs */
.tab-bar {
    display: flex;
    gap: 1.4rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--bottom-border);
    padding-bottom: 0.7rem;
    flex-shrink: 0;
}

.tab {
    background: none;
    border: none;
    font-family: var(--font);
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--t3);
    cursor: pointer;
    padding: 0;
    position: relative;
    transition: color 0.2s;
}

.tab::after {
    content: '';
    position: absolute;
    bottom: -11px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--t1);
    transform: scaleX(0);
    transition: transform 0.2s ease;
}

.tab.active {
    color: var(--t1);
}

.tab.active::after {
    transform: scaleX(1);
}

.tab:hover {
    color: var(--t2);
}

/* Tab panes */
.tab-pane {
    display: none;
    flex: 1;
    overflow: hidden;
}

.tab-pane.active {
    display: flex;
    flex-direction: column;
}

/* Stats grid (Today) */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.6rem;
    flex: 1;
    overflow: auto;
}

.s-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.7rem;
    border-radius: 10px;
    background: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.15s;
}

.s-item:hover {
    background: var(--card-hover);
}

.s-svg {
    width: 16px;
    height: 16px;
    color: var(--t2);
    flex-shrink: 0;
}

.s-lbl {
    flex: 1;
    font-size: 0.75rem;
    color: var(--t2);
}

.s-val {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--t1);
    white-space: nowrap;
}

/* Hourly */
.hourly-row {
    display: flex;
    gap: 0.6rem;
    overflow-x: auto;
    padding-bottom: 0.4rem;
    flex: 1;
    align-items: center;
}

.hourly-card {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    background: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 0.7rem 0.9rem;
    min-width: 68px;
    transition: background 0.15s;
}

.hourly-card:hover {
    background: var(--card-hover);
}

.hc-time {
    font-size: 0.7rem;
    color: var(--t3);
}

.hc-icon {
    width: 32px;
    height: 32px;
}

.hc-temp {
    font-size: 0.88rem;
    font-weight: 600;
}

.hc-desc {
    font-size: 0.62rem;
    color: var(--t3);
    text-align: center;
    max-width: 68px;
    line-height: 1.2;
}

/* Daily */
.daily-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    flex: 1;
    overflow-y: auto;
}

.daily-row {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.45rem 0.7rem;
    border-radius: 10px;
    background: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.15s;
}

.daily-row:hover {
    background: var(--card-hover);
}

.dr-day {
    width: 50px;
    font-size: 0.78rem;
    color: var(--t1);
    font-weight: 600;
}

.dr-icon {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}

.dr-desc {
    flex: 1;
    font-size: 0.78rem;
    color: var(--t2);
}

.dr-temps {
    display: flex;
    align-items: center;
    gap: 0.2rem;
}

.dr-max {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--t1);
}

.dr-sep {
    font-size: 0.78rem;
    color: var(--t3);
}

.dr-min {
    font-size: 0.78rem;
    color: var(--t3);
}

.no-data {
    font-size: 0.8rem;
    color: var(--t3);
    padding: 1rem;
    text-align: center;
}

/* ── Toast ── */
.toast {
    position: fixed;
    bottom: calc(var(--bottom-h) + 1rem);
    left: 50%;
    transform: translateX(-50%) translateY(8px);
    background: rgba(30, 30, 40, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50px;
    padding: 0.55rem 1.2rem;
    font-size: 0.82rem;
    color: var(--t1);
    backdrop-filter: blur(16px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 100;
    white-space: nowrap;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* RIGHT */
.bp-right {
    width: 300px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    padding: 1.1rem 1.4rem;
    gap: 0.8rem;
}

.bpr-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.bpr-title {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--t1);
}

.add-city-btn {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 20px;
    color: var(--t2);
    font-family: var(--font);
    font-size: 0.7rem;
    padding: 0.25rem 0.6rem;
    cursor: pointer;
    transition: all 0.2s;
}

.add-city-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--t1);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Period cards */
.period-cards {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
}

.period-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    background: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 12px;
    padding: 0.8rem 0.5rem;
    transition: background 0.15s;
}

.period-card:hover {
    background: var(--card-hover);
}

.period-icon {
    width: 20px;
    height: 20px;
    color: var(--t2);
}

.period-lbl {
    font-size: 0.7rem;
    color: var(--t2);
}

.period-temp {
    font-family: var(--font-serif);
    font-size: 1.4rem;
    color: var(--t1);
    line-height: 1;
}

.period-temp sub {
    font-size: 0.55rem;
    color: var(--t2);
    font-family: var(--font);
}

/* Sun bar */
.sun-bar {
    display: flex;
    gap: 0.7rem;
    padding-top: 0.2rem;
    border-top: 1px solid var(--bottom-border);
    margin-top: auto;
}

.sun-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

.sun-item svg {
    color: var(--t2);
    flex-shrink: 0;
}

.sun-detail {
    display: flex;
    flex-direction: column;
}

.sun-lbl {
    font-size: 0.68rem;
    color: var(--t3);
}

.sun-val {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--t1);
}

/* ═══════════════════════════════════
   RESPONSIVE
═══════════════════════════════════ */
@media (max-width: 768px) {
    :root {
        --hero-h: 55vh;
        --bottom-h: 45vh;
    }

    .hero-panel {
        padding: 1rem 1.1rem 1.2rem;
    }

    .search-wrap {
        max-width: 100%;
    }

    .hero-right {
        display: none;
    }

    .city-title {
        font-size: 1.8rem;
    }

    .temp-big {
        font-size: 3.5rem;
    }

    .bottom-panel {
        flex-direction: column;
        height: var(--bottom-h);
    }

    .bp-left {
        border-right: none;
        border-bottom: 1px solid var(--bottom-border);
        padding: 0.9rem 1rem;
    }

    .bp-right {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        padding: 0.7rem 1rem;
        gap: 0.5rem;
    }

    .bpr-header {
        width: 100%;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .period-cards {
        flex: 1;
    }

    .sun-bar {
        flex: 1;
        margin-top: 0;
        border-top: none;
        border-left: 1px solid var(--bottom-border);
        padding-left: 0.7rem;
        padding-top: 0;
        flex-direction: column;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .tab-bar {
        gap: 0.8rem;
    }

    .tab {
        font-size: 0.75rem;
    }

    .bp-right {
        display: none;
    }

    .bp-left {
        padding: 0.8rem;
    }
}