/* ===== WEATHER APP — Glassmorphism Atmospheric ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --sky-1: #0c1445;
    --sky-2: #1a237e;
    --sky-3: #283593;
    --sky-4: #3949ab;
    --sunset: #ff6f00;
    --sunrise: #ff8f00;
    --cloud: rgba(255, 255, 255, 0.08);
    --frost: rgba(255, 255, 255, 0.12);
    --frost-border: rgba(255, 255, 255, 0.18);
    --frost-strong: rgba(255, 255, 255, 0.2);
    --text: #f0f4ff;
    --text2: #b8c4e0;
    --text3: #7b8db5;
    --accent: #64b5f6;
    --accent2: #4dd0e1;
    --warm: #ffab40;
    --hot: #ff5252;
    --cold: #40c4ff;
    --r: 16px;
    --r-lg: 24px;
    --t: .3s ease;
}

body {
    font-family: 'Outfit', 'Inter', system-ui, sans-serif;
    background: linear-gradient(160deg, var(--sky-1) 0%, var(--sky-2) 30%, var(--sky-3) 60%, #5c6bc0 85%, #ef6c00 100%);
    background-attachment: fixed;
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow-x: hidden;
}

/* Animated cloud shapes */
body::before,
body::after {
    content: '';
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    opacity: .15;
    pointer-events: none;
    z-index: -1;
}

body::before {
    width: 600px;
    height: 300px;
    background: radial-gradient(ellipse, #7c4dff, transparent);
    top: 10%;
    left: -10%;
    animation: cloudFloat 25s ease-in-out infinite;
}

body::after {
    width: 500px;
    height: 250px;
    background: radial-gradient(ellipse, #ff6d00, transparent);
    bottom: 5%;
    right: -5%;
    animation: cloudFloat 20s ease-in-out infinite reverse;
}

@keyframes cloudFloat {

    0%,
    100% {
        transform: translate(0, 0);
    }

    50% {
        transform: translate(40px, -20px);
    }
}

/* ===== HEADER ===== */
.app-header {
    background: var(--frost);
    backdrop-filter: blur(20px) saturate(1.4);
    -webkit-backdrop-filter: blur(20px) saturate(1.4);
    border-bottom: 1px solid var(--frost-border);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.app-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--sky-1);
    box-shadow: 0 4px 15px rgba(100, 181, 246, .35);
}

.header-text h1 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -.02em;
}

.header-text p {
    font-size: .85rem;
    color: var(--text2);
    margin-top: 2px;
}

.btn-toggle {
    width: 44px;
    height: 44px;
    background: var(--frost);
    border: 1px solid var(--frost-border);
    border-radius: 12px;
    color: var(--text);
    cursor: pointer;
    transition: all var(--t);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    backdrop-filter: blur(12px);
}

.btn-toggle:hover {
    background: var(--frost-strong);
    border-color: var(--accent);
    color: var(--accent);
    transform: scale(1.05);
}

/* ===== SEARCH ===== */
.search-section {
    padding: 1.5rem 2rem .5rem;
}

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

.search-box {
    display: flex;
    align-items: center;
    gap: .75rem;
    background: var(--frost);
    backdrop-filter: blur(16px);
    border: 1px solid var(--frost-border);
    border-radius: var(--r);
    padding: .875rem 1.25rem;
    transition: all var(--t);
}

.search-box:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(100, 181, 246, .15), 0 8px 25px rgba(0, 0, 0, .15);
}

.search-box i {
    color: var(--text3);
    font-size: 1.1rem;
}

.search-box input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 1rem;
    outline: none;
    font-family: inherit;
}

.search-box input::placeholder {
    color: var(--text3);
}

.search-btn {
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: var(--sky-1);
    border: none;
    border-radius: 12px;
    padding: .7rem 1.4rem;
    font-weight: 700;
    font-size: .9rem;
    cursor: pointer;
    transition: all var(--t);
    display: flex;
    align-items: center;
    gap: .4rem;
    box-shadow: 0 4px 15px rgba(100, 181, 246, .3);
    font-family: inherit;
}

.search-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(100, 181, 246, .4);
}

/* ===== MAIN ===== */
.main-content {
    flex: 1;
    padding: 1.5rem 2rem;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

/* MAP */
.map-container {
    background: var(--frost);
    backdrop-filter: blur(12px);
    border-radius: var(--r-lg);
    overflow: hidden;
    border: 1px solid var(--frost-border);
    margin-bottom: 2rem;
    position: relative;
    box-shadow: 0 8px 32px rgba(0, 0, 0, .2);
}

#map {
    width: 100%;
    height: 550px;
    border-radius: var(--r-lg);
}

.map-info {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--frost);
    backdrop-filter: blur(16px);
    padding: .625rem 1.25rem;
    border-radius: 50px;
    border: 1px solid var(--frost-border);
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .8rem;
    color: var(--text2);
    box-shadow: 0 4px 16px rgba(0, 0, 0, .2);
}

.map-info i {
    color: var(--accent);
}

/* ===== WEATHER CARDS ===== */
.weather-cards-container {
    display: none;
}

.weather-cards-container.active {
    display: block;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.weather-card {
    background: var(--frost);
    backdrop-filter: blur(20px) saturate(1.3);
    -webkit-backdrop-filter: blur(20px) saturate(1.3);
    border: 1px solid var(--frost-border);
    border-radius: var(--r-lg);
    padding: 1.5rem;
    transition: all var(--t);
    position: relative;
    overflow: hidden;
}

.weather-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--accent2), var(--warm));
    opacity: 0;
    transition: opacity var(--t);
}

.weather-card:hover::before {
    opacity: 1;
}

.weather-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, .25);
    border-color: rgba(255, 255, 255, .25);
}

.weather-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.weather-card-header h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
}

.weather-card-header .temp-main {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.weather-card-body {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.weather-icon {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, rgba(100, 181, 246, .15), rgba(77, 208, 225, .15));
    border: 1px solid rgba(100, 181, 246, .1);
    border-radius: var(--r);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
}

.weather-description {
    flex: 1;
}

.weather-description p {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text);
    text-transform: capitalize;
    margin-bottom: .2rem;
}

.weather-description .feels-like {
    font-size: .82rem;
    color: var(--text2);
    display: block;
    margin-bottom: .4rem;
}

.temp-range {
    display: flex;
    gap: .75rem;
    margin-top: .2rem;
}

.temp-range span {
    font-size: .85rem;
    font-weight: 600;
}

.temp-max {
    color: var(--hot);
}

.temp-min {
    color: var(--cold);
}

.weather-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: .75rem;
    padding-top: 1rem;
    border-top: 1px solid var(--frost-border);
}

.weather-detail {
    display: flex;
    flex-direction: column;
    gap: .2rem;
}

.weather-detail-label {
    font-size: .7rem;
    color: var(--text3);
    text-transform: uppercase;
    letter-spacing: .06em;
}

.weather-detail-value {
    font-size: .95rem;
    font-weight: 600;
    color: var(--text);
}

/* ===== LOADING ===== */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(12, 20, 69, .92);
    backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all var(--t);
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.loading-spinner {
    font-size: 3.5rem;
    color: var(--accent);
    margin-bottom: 1rem;
}

.loading-overlay p {
    color: var(--text2);
    font-size: 1rem;
}

/* ===== LEAFLET POPUPS ===== */
.context-menu-marker {
    display: none;
}

.context-menu-popup .leaflet-popup-content-wrapper {
    padding: 0 !important;
    border-radius: var(--r) !important;
    overflow: hidden;
}

.context-menu {
    background: var(--sky-2);
}

.context-menu-btn {
    width: 100%;
    padding: .875rem 1.25rem;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: var(--sky-1);
    border: none;
    cursor: pointer;
    transition: all .2s;
    display: flex;
    align-items: center;
    gap: .6rem;
    font-size: .95rem;
    font-weight: 700;
    font-family: inherit;
}

.context-menu-btn:hover {
    filter: brightness(1.1);
}

/* ===== TOAST ===== */
.toast-notification {
    position: fixed;
    top: 90px;
    right: 1.5rem;
    background: var(--frost);
    backdrop-filter: blur(16px);
    border: 1px solid var(--frost-border);
    border-radius: var(--r);
    padding: 1rem 1.25rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, .25);
    z-index: 10000;
    opacity: 0;
    transform: translateX(400px);
    transition: all var(--t);
    display: flex;
    align-items: center;
    gap: .6rem;
    min-width: 280px;
    max-width: 450px;
}

.toast-notification.show {
    opacity: 1;
    transform: translateX(0);
}

.toast-notification::before {
    content: '';
    width: 4px;
    height: 100%;
    border-radius: 4px;
    position: absolute;
    left: 0;
}

.toast-success::before {
    background: #66bb6a;
}

.toast-error::before {
    background: var(--hot);
}

.toast-warning::before {
    background: var(--warm);
}

.toast-info::before {
    background: var(--accent);
}

/* ===== FOOTER ===== */
.app-footer {
    background: var(--frost);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--frost-border);
    padding: 1.5rem 2rem;
    text-align: center;
    margin-top: 3rem;
}

.app-footer p {
    color: var(--text2);
    margin-bottom: .35rem;
    font-size: .9rem;
}

.app-footer a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--t);
}

.app-footer a:hover {
    color: var(--accent2);
}

.data-source {
    font-size: .8rem;
    color: var(--text3);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .app-header {
        padding: .875rem 1rem;
    }

    .header-text h1 {
        font-size: 1.2rem;
    }

    .search-section {
        padding: 1rem;
    }

    .search-box {
        flex-direction: column;
        align-items: stretch;
        gap: .6rem;
    }

    .search-btn {
        width: 100%;
        justify-content: center;
    }

    .main-content {
        padding: 1rem;
    }

    #map {
        height: 380px;
    }

    .cards-grid {
        grid-template-columns: 1fr;
    }

    .weather-card {
        padding: 1.25rem;
    }

    .weather-card-header .temp-main {
        font-size: 2rem;
    }

    .weather-icon {
        width: 56px;
        height: 56px;
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .header-left {
        gap: .6rem;
    }

    .app-icon {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
        border-radius: 10px;
    }

    .header-text h1 {
        font-size: 1.05rem;
    }

    .header-text p {
        font-size: .75rem;
    }

    .btn-toggle {
        width: 38px;
        height: 38px;
    }

    #map {
        height: 280px;
    }

    .weather-details {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
    }
}