/* style.css — Modal стилови (map и топбар се во pages.css) */
:root {
    --c-dark:   #0D2E4E;
    --c-mid:    #1565C0;
    --c-light:  #29B6F6;
    --c-sun:    #FFB300;
    --c-alert:  #EF5350;
    --c-white:  #ffffff;
    --modal-bg: #0B1F35;
    --trans:    .2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-tap-highlight-color: transparent; }
body { font-family: 'Nunito', Arial, sans-serif; color: #263238; min-height: 100vh; overflow-x: hidden; }
body.modal-open { overflow: hidden; }
body.nav-open   { overflow: hidden; }

/* ── Modal overlay ── */
#meteo-modal-overlay {
    position: fixed; inset: 0;
    background: rgba(4,14,30,0.72);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 9000; opacity: 0; pointer-events: none;
    transition: opacity .25s ease;
}

#meteo-modal-overlay.open { opacity: 1; pointer-events: all; }

/* ── Modal ── */
#meteo-modal {
    position: fixed; bottom: 0; left: 50%;
    transform: translateX(-50%) translateY(105%);
    width: 100%; max-width: 540px; max-height: 93vh;
    background: var(--modal-bg);
    border-radius: 24px 24px 0 0;
    z-index: 9001; display: flex; flex-direction: column;
    overflow: hidden;
    transition: transform .32s cubic-bezier(.22,1,.36,1);
    box-shadow: 0 -6px 48px rgba(0,0,0,.5);
    will-change: transform;
    pointer-events: none;
}

#meteo-modal.open { transform: translateX(-50%) translateY(0); pointer-events: all; }

@media (min-width: 640px) {
    #meteo-modal {
        bottom: auto; top: 50vh;
        border-radius: 24px; max-height: 90vh;
        transform: translateX(-50%) translateY(-50%) scale(.96);
        opacity: 0;
        transition: transform .28s cubic-bezier(.22,1,.36,1), opacity .22s ease;
    }
    #meteo-modal.open { transform: translateX(-50%) translateY(-50%) scale(1); opacity: 1; pointer-events: all; }
}

.modal-handle {
    width: 42px; height: 4px;
    background: rgba(255,255,255,.22); border-radius: 2px;
    margin: 10px auto 0; flex-shrink: 0;
}
@media (min-width: 640px) { .modal-handle { display: none; } }

/* ── Modal позадина ── */
.modal-bg {
    position: relative;
    background: linear-gradient(160deg, #0D2E4E, #1565C0);
    background-size: cover; background-position: center top;
    flex-shrink: 0;
}
.modal-bg.has-bg::before {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(180deg, rgba(4,14,30,.42) 0%, rgba(4,14,30,.85) 100%);
}
#modal-header-content { position: relative; z-index: 1; padding: 14px 16px; }

/* ── Modal header елементи ── */
.modal-toprow { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 12px; }
.modal-city   { font-size: 18px; font-weight: 800; color: #fff; }
.modal-source { font-size: 10px; color: var(--c-light); margin-top: 3px; }

.modal-close-btn {
    background: rgba(255,255,255,.16); border: 1.5px solid rgba(255,255,255,.25);
    color: #fff; width: 32px; height: 32px; border-radius: 50%;
    cursor: pointer; font-size: 15px; display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; transition: background var(--trans); font-family: inherit;
}
.modal-close-btn:hover { background: rgba(255,255,255,.28); }

.modal-header-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.modal-share-btn {
    background: rgba(255,255,255,.16); border: 1.5px solid rgba(255,255,255,.25);
    color: #fff; width: 32px; height: 32px; border-radius: 50%;
    cursor: pointer; font-size: 14px; display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; transition: background var(--trans); font-family: inherit;
    position: relative;
}
.modal-share-btn:hover { background: rgba(255,255,255,.28); }

.share-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #0B1F35;
    border: 1px solid rgba(255,255,255,.15);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,.5);
    min-width: 180px;
    width: 180px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.share-menu[hidden] { display: none; }

.share-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 16px;
    color: #fff;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    flex-shrink: 0;
    text-align: left;
    font-family: 'Nunito', Arial, sans-serif;
    transition: background .15s ease;
    white-space: nowrap;
}

.share-menu-item:hover { background: rgba(255,255,255,.08); }
.share-menu-icon { font-size: 16px; flex-shrink: 0; }

.share-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #26A69A;
    color: #fff;
    padding: 10px 20px;
    border-radius: 24px;
    font-size: 13px;
    font-weight: 700;
    box-shadow: 0 4px 20px rgba(0,0,0,.3);
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease, transform .25s ease;
}
.share-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ── Hero ── */
.modal-hero {
    display: flex; align-items: center; gap: 14px; margin-bottom: 10px;
}
.modal-hero-icon { font-size: 64px; line-height: 1; filter: drop-shadow(0 2px 8px rgba(0,0,0,.35)); flex-shrink: 0; }
.modal-hero-data { flex: 1; }
.modal-temp-row  { display: flex; align-items: flex-start; line-height: 1; }
.modal-temp-big  { font-size: 64px; font-weight: 800; color: #fff; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.modal-unit      { font-size: 26px; font-weight: 400; color: rgba(255,255,255,.7); align-self: flex-start; margin-top: 8px; margin-left: 2px; }
.modal-wmo-desc  { font-size: 15px; font-weight: 600; color: rgba(255,255,255,.88); margin-top: 4px; }
.modal-minmax    { font-size: 12px; color: rgba(255,255,255,.62); margin-top: 4px; }
.modal-minmax strong { color: rgba(255,255,255,.88); font-weight: 700; }

.modal-sun-row {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    margin-top: 6px; font-size: 12.5px; font-weight: 700; color: var(--c-sun);
}
.temp-badge {
    display: inline-flex; align-items: center; gap: 4px;
    border-radius: 24px; padding: 4px 13px;
    font-size: 11.5px; font-weight: 800; color: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,.2);
}

/* ── Tabs ── */
.modal-tabs {
    display: flex; background: rgba(0,0,0,.32);
    border-top: 1px solid rgba(255,255,255,.08); flex-shrink: 0;
}
.modal-tab {
    flex: 1; padding: 11px 4px; text-align: center;
    font-size: 11.5px; font-weight: 700; color: rgba(255,255,255,.42);
    border: none; background: none; border-bottom: 2.5px solid transparent;
    cursor: pointer; font-family: 'Nunito', Arial, sans-serif;
    transition: color var(--trans), border-color var(--trans);
}
.modal-tab.active { color: var(--c-light); border-bottom-color: var(--c-light); }
.modal-tab:hover:not(.active) { color: rgba(255,255,255,.7); }

/* ── Tab body ── */
#modal-tab-body {
    flex: 1; overflow-y: auto; padding: 14px;
    overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
}

/* ── Detail grid (Денес таб) ── */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.detail-item {
    background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.11);
    border-radius: 11px; padding: 10px 11px; display: flex; align-items: flex-start;
    gap: 9px; transition: background var(--trans);
}
.detail-item:hover { background: rgba(255,255,255,.15); }
.d-icon   { font-size: 20px; flex-shrink: 0; margin-top: 1px; }
.d-text   { font-size: 12.5px; color: rgba(255,255,255,.88); line-height: 1.4; font-weight: 600; }
.d-label  { display: block; font-size: 10px; color: #23b5eb; font-weight: 700; margin-bottom: 3px; letter-spacing: .06em; text-transform: uppercase; }
.d-value  { display: block; font-size: 14px; font-weight: 800; color: #fff; line-height: 1.2; margin-bottom: 2px; }
.d-status { display: block; font-size: 11px; font-weight: 600; color: rgba(255,255,255,.65); margin-bottom: 2px; }
.d-tip    { display: block; font-size: 11px; color: #e9f50a; font-weight: 400; line-height: 1.45; border-top: 1px solid rgba(255,255,255,.08); padding-top: 4px; margin-top: 3px; }

.forecast-text-box {
    margin-top: 10px; background: rgba(255,255,255,.07);
    border: 1px solid rgba(255,255,255,.1); border-radius: 11px;
    padding: 11px 13px; display: flex; gap: 10px; align-items: flex-start;
}
.ft-icon { font-size: 20px; flex-shrink: 0; }
.forecast-text-box p { font-size: 12.5px; color: rgba(255,255,255,.82); line-height: 1.65; }

/* ── Hourly ── */
.hourly-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 6px; }
.hourly-row { display: flex; gap: 7px; width: max-content; padding: 2px 2px 4px; }
.hour-card {
    background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.12);
    border-radius: 12px; padding: 9px 10px; text-align: center; min-width: 56px;
}
.hour-card.now { background: rgba(41,182,246,.22); border-color: var(--c-light); }
.hour-time  { font-size: 9px; color: rgba(255,255,255,.5); margin-bottom: 4px; font-weight: 700; }
.hour-icon  { font-size: 20px; line-height: 1; margin-bottom: 4px; }
.hour-temp  { font-size: 13px; font-weight: 800; }
.hour-feels { font-size: 9px; color: rgba(255,255,255,.42); margin-top: 1px; }
.hour-rain  { font-size: 9px; color: var(--c-light); margin-top: 3px; }
.hour-wind  { font-size: 9px; color: rgba(255,255,255,.38); margin-top: 1px; }
.hourly-chart-wrap { margin-top: 12px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1); border-radius: 11px; padding: 10px 12px 6px; }
.chart-label { font-size: 9px; color: rgba(255,255,255,.38); letter-spacing: .09em; margin-bottom: 6px; font-weight: 700; }
.hourly-legend { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; font-size: 9.5px; color: rgba(255,255,255,.38); font-weight: 600; }

/* ── 7 дена ── */
.forecast-7 { display: flex; flex-direction: column; gap: 6px; }
.forecast-7-header { display: grid; grid-template-columns: 30px 24px 1fr auto auto 54px; gap: 8px; padding: 0 12px 5px; font-size: 9px; font-weight: 700; color: rgba(255,255,255,.32); letter-spacing: .06em; text-transform: uppercase; }
.fday-row { display: grid; grid-template-columns: 30px 24px 1fr auto auto 54px; align-items: center; gap: 8px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.1); border-radius: 11px; padding: 9px 12px; }
.fday-name  { font-size: 12px; font-weight: 800; color: rgba(255,255,255,.88); }
.fday-icon  { font-size: 20px; }
.fday-desc  { font-size: 11px; color: rgba(255,255,255,.58); }
.fday-rain  { font-size: 10px; color: var(--c-light); font-weight: 700; text-align: right; }
.fday-rain.rain-high { color: #EF5350; }
.fday-wind  { font-size: 10px; color: rgba(255,255,255,.42); text-align: right; }
.fday-temps { font-size: 12px; font-weight: 800; color: #fff; text-align: right; white-space: nowrap; }
.fday-min   { font-weight: 400; color: rgba(255,255,255,.42); margin-left: 4px; }

/* ── AQI ── */
.aqi-main { border: 1.5px solid; border-radius: 16px; padding: 16px; text-align: center; margin-bottom: 12px; }
.aqi-emoji { font-size: 36px; margin-bottom: 4px; }
.aqi-val   { font-size: 46px; font-weight: 800; line-height: 1; }
.aqi-label { font-size: 14px; font-weight: 700; margin-top: 4px; }
.aqi-bar   { position: relative; height: 8px; border-radius: 4px; overflow: hidden; margin: 12px 0 4px; }
.aqi-bar-fill { position: absolute; inset: 0; border-radius: 4px; background: linear-gradient(90deg,#4CAF50,#FFB300,#E53935); }
.aqi-needle { position: absolute; top: -2px; width: 3px; height: 12px; background: #fff; border-radius: 2px; transform: translateX(-50%); box-shadow: 0 0 4px rgba(0,0,0,.5); }
.aqi-scale-labels { display: flex; justify-content: space-between; font-size: 9px; font-weight: 700; margin-top: 3px; padding: 0 2px; }
.aqi-tip  { font-size: 11.5px; color: rgba(255,255,255,.78); margin-top: 8px; line-height: 1.55; }
.aqi-section-title { font-size: 11px; font-weight: 700; color: rgba(255,255,255,.45); letter-spacing: .06em; text-transform: uppercase; margin: 12px 0 8px; }
.aqi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.aqi-item { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.1); border-radius: 11px; padding: 9px 10px; }
.aqi-item-top { display: flex; align-items: center; gap: 5px; margin-bottom: 3px; }
.aqi-item-emoji { font-size: 15px; }
.aqi-item-name  { font-size: 11px; font-weight: 700; color: #23b5eb; flex: 1; }
.aqi-item-val   { font-size: 15px; font-weight: 800; }
.aqi-item-unit  { font-size: 8px; color: rgba(255,255,255,.38); }
.aqi-item-label { font-size: 10px; font-weight: 700; margin-bottom: 2px; }
.aqi-who        { font-size: 10px; color: #23b5eb; }
.aqi-pollutant-desc { font-size: 10px; color: #e9f50a; line-height: 1.5; margin-top: 4px; border-top: 1px solid rgba(255,255,255,.07); padding-top: 4px; }

/* ── Skeleton ── */
@keyframes shimmer { 0%,100%{opacity:.35} 50%{opacity:.7} }
.skeleton-pulse { background: rgba(255,255,255,.15); border-radius: 6px; animation: shimmer 1.4s ease infinite; }

/* ── Misc ── */
.tab-empty   { text-align: center; padding: 32px 16px; color: rgba(255,255,255,.42); font-size: 13px; }
.modal-error { text-align: center; padding: 26px 16px; color: #EF5350; font-size: 13px; }

/* ── Responsive ── */
@media (max-width: 400px) {
    .detail-grid { grid-template-columns: 1fr; }
    .aqi-grid    { grid-template-columns: 1fr; }
    .fday-row    { grid-template-columns: 28px 20px 1fr auto 50px; }
    .fday-wind   { display: none; }
}
