/* ===== Skycast — Weather PWA ===== */

:root {
    --bg-main: linear-gradient(135deg, #e0eafc 0%, #cfdef3 100%);
    --surface-bg: rgba(255, 255, 255, 0.4);
    --surface-strong: rgba(255, 255, 255, 0.75);
    --surface-border: rgba(255, 255, 255, 0.6);
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --accent: #2563eb;
    --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.12);
}

[data-theme="light"] {
    --bg-main: linear-gradient(135deg, #e0eafc 0%, #cfdef3 100%);
    --surface-bg: rgba(255, 255, 255, 0.4);
    --surface-strong: rgba(255, 255, 255, 0.8);
    --surface-border: rgba(255, 255, 255, 0.6);
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --accent: #2563eb;
}

[data-theme="dark"] {
    --bg-main: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    --surface-bg: rgba(255, 255, 255, 0.06);
    --surface-strong: rgba(30, 41, 59, 0.92);
    --surface-border: rgba(255, 255, 255, 0.12);
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --accent: #60a5fa;
}

[data-theme="premium"] {
    --bg-main: linear-gradient(135deg, #09090b 0%, #1c1917 100%);
    --surface-bg: rgba(24, 24, 27, 0.55);
    --surface-strong: rgba(24, 24, 27, 0.95);
    --surface-border: rgba(212, 175, 55, 0.35);
    --text-primary: #ffffff;
    --text-secondary: #d4d4d8;
    --accent: #d4af37;
}

[data-theme="ocean"] {
    --bg-main: linear-gradient(to bottom, rgba(2, 44, 34, 0.8), rgba(4, 47, 46, 0.9)), url("https://images.unsplash.com/photo-1518837695005-2083093ee35b?crop=entropy&cs=srgb&fm=jpg&ixid=M3w3NTY2NzV8MHwxfHNlYXJjaHwxfHxvY2VhbiUyMHdhdmVzJTIwYmFja2dyb3VuZHxlbnwwfHx8fDE3ODk4MTUyNjJ8MA&ixlib=rb-4.1.0&q=85");
    --surface-bg: rgba(255, 255, 255, 0.1);
    --surface-strong: rgba(4, 47, 46, 0.92);
    --surface-border: rgba(255, 255, 255, 0.2);
    --text-primary: #ffffff;
    --text-secondary: #ccfbf1;
    --accent: #2dd4bf;
}

[data-theme="sunset"] {
    --bg-main: linear-gradient(to bottom, rgba(67, 20, 7, 0.7), rgba(124, 45, 18, 0.8)), url("https://images.unsplash.com/photo-1490735891913-40897cdaafd1?crop=entropy&cs=srgb&fm=jpg&ixid=M3w4NjA1NTN8MHwxfHNlYXJjaHwxfHxzdW5zZXQlMjBza3klMjBjbGVhcnxlbnwwfHx8fDE3ODk4MTUyNjJ8MA&ixlib=rb-4.1.0&q=85");
    --surface-bg: rgba(0, 0, 0, 0.25);
    --surface-strong: rgba(67, 20, 7, 0.92);
    --surface-border: rgba(255, 255, 255, 0.2);
    --text-primary: #ffffff;
    --text-secondary: #ffedd5;
    --accent: #f97316;
}

[data-theme="forest"] {
    --bg-main: linear-gradient(to bottom, rgba(2, 44, 34, 0.7), rgba(6, 78, 59, 0.9)), url("https://images.unsplash.com/photo-1658615324653-00fbdaee8a3f?crop=entropy&cs=srgb&fm=jpg&ixid=M3w4NTYxODh8MHwxfHNlYXJjaHwyfHxmb3Jlc3QlMjBjYW5vcHl8ZW58MHx8fHwxNzg5ODE1MjYyfDA&ixlib=rb-4.1.0&q=85");
    --surface-bg: rgba(0, 0, 0, 0.3);
    --surface-strong: rgba(6, 78, 59, 0.92);
    --surface-border: rgba(255, 255, 255, 0.2);
    --text-primary: #ffffff;
    --text-secondary: #d1fae5;
    --accent: #10b981;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
    font-family: "DM Sans", system-ui, sans-serif;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
}

.app {
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--bg-main);
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    transition: background 0.5s ease, color 0.3s ease;
    padding: env(safe-area-inset-top) 1rem 1rem;
}

.app-inner {
    max-width: 600px;
    margin: 0 auto;
    padding: 1.5rem 0 2rem;
}

/* ===== Glass ===== */
.glass {
    background: var(--surface-bg);
    -webkit-backdrop-filter: blur(24px) saturate(150%);
    backdrop-filter: blur(24px) saturate(150%);
    border: 1px solid var(--surface-border);
    box-shadow: var(--shadow);
    border-radius: 1.5rem;
}

/* ===== Header ===== */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.brand { display: flex; align-items: center; gap: 0.75rem; }

.brand-mark {
    display: grid;
    place-items: center;
    width: 46px; height: 46px;
    border-radius: 14px;
    background: var(--accent);
    color: #fff;
    font-size: 1.5rem;
    box-shadow: 0 6px 18px -4px var(--accent);
    flex-shrink: 0;
}

.brand-name {
    font-family: "Manrope", sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1;
}

.brand-loc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.brand-loc .dot { opacity: 0.5; }

.header-actions { display: flex; align-items: center; gap: 0.5rem; }

.icon-btn {
    display: grid;
    place-items: center;
    width: 44px; height: 44px;
    border-radius: 50%;
    border: 1px solid var(--surface-border);
    background: var(--surface-bg);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    color: var(--text-primary);
    font-size: 1.25rem;
    cursor: pointer;
    transition: transform 0.25s cubic-bezier(0.4,0,0.2,1), background-color 0.25s ease;
}
.icon-btn:hover { transform: translateY(-2px) scale(1.05); }
.icon-btn:active { transform: scale(0.95); }
.icon-btn.spinning i { animation: spin 0.8s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Theme menu ===== */
.theme-wrap { position: relative; }

.theme-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    width: 220px;
    padding: 1rem;
    z-index: 40;
    background: var(--surface-strong);
    animation: pop 0.2s ease;
    transform-origin: top right;
}
.theme-menu[hidden] { display: none; }

@keyframes pop {
    from { opacity: 0; transform: scale(0.9) translateY(-6px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.theme-menu-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.7;
    margin-bottom: 0.75rem;
}

.theme-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.theme-swatch {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 0.7rem;
    font-weight: 500;
}
.theme-swatch .ring {
    width: 40px; height: 40px;
    border-radius: 50%;
    border: 2px solid transparent;
    padding: 3px;
    transition: transform 0.2s ease, border-color 0.2s ease;
}
.theme-swatch .ring span {
    display: block;
    width: 100%; height: 100%;
    border-radius: 50%;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.1);
}
.theme-swatch:hover .ring { transform: scale(1.1); }
.theme-swatch.active .ring { border-color: var(--accent); }
.theme-swatch.active { font-weight: 700; }

/* ===== Meta row ===== */
.meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    font-weight: 500;
    padding: 0.4rem 0.8rem;
    border-radius: 99px;
    background: var(--surface-bg);
    border: 1px solid var(--surface-border);
    color: var(--text-primary);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}
.chip.subtle { color: var(--text-secondary); }
.chip i { color: var(--accent); }

.live-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 0 rgba(34,197,94,0.6);
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(34,197,94,0.6); }
    70% { box-shadow: 0 0 0 8px rgba(34,197,94,0); }
    100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}

/* ===== Search ===== */
.search {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--surface-bg);
    border: 1px solid var(--surface-border);
    border-radius: 99px;
    padding: 0.35rem 0.5rem 0.35rem 1.1rem;
    margin-bottom: 1.5rem;
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}
.search > i { color: var(--text-secondary); font-size: 1.15rem; }
.search-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
}
.search-input::placeholder { color: var(--text-secondary); opacity: 0.8; }
.search-btn {
    border: none;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    font-family: inherit;
    padding: 0.55rem 1.2rem;
    border-radius: 99px;
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease;
}
.search-btn:hover { transform: scale(1.04); }
.search-btn:active { transform: scale(0.96); }

/* ===== Banner ===== */
.banner {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.9rem 1.1rem;
    margin-bottom: 1.25rem;
    background: var(--surface-strong);
    border-radius: 1rem;
    font-size: 0.9rem;
}
.banner[hidden] { display: none; }
.banner i { color: #ef4444; font-size: 1.3rem; }
.banner-retry {
    margin-left: auto;
    border: 1px solid var(--surface-border);
    background: none;
    color: var(--text-primary);
    padding: 0.35rem 0.9rem;
    border-radius: 99px;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
}

/* ===== Hero ===== */
.hero {
    position: relative;
    overflow: hidden;
    padding: 2rem;
    text-align: center;
}
.hero-content { position: relative; z-index: 2; }
.hero-top {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    margin-bottom: 0.25rem;
}
.hero-icon { font-size: 2.2rem; color: var(--accent); }
.hero-condition {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}
.hero-temp {
    font-family: "Manrope", sans-serif;
    font-size: clamp(4rem, 15vw, 7.5rem);
    font-weight: 800;
    letter-spacing: -0.05em;
    line-height: 1;
    margin: 0.25rem 0;
}
.hero-feels {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}
.hero-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--surface-border);
}
.stat {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}
.stat i { font-size: 1.35rem; color: var(--accent); }
.stat > div { display: flex; flex-direction: column; text-align: left; }
.stat-val { font-weight: 700; font-size: 0.95rem; }
.stat-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
}

/* ===== Weather animations ===== */
.weather-anim {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}
/* Sun */
.wa-sun {
    position: absolute;
    top: -40px; right: -40px;
    width: 160px; height: 160px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(250,204,21,0.55), rgba(250,204,21,0));
    animation: sunpulse 5s ease-in-out infinite;
}
@keyframes sunpulse {
    0%,100% { transform: scale(1); opacity: 0.7; }
    50% { transform: scale(1.15); opacity: 1; }
}
/* Clouds */
.wa-cloud {
    position: absolute;
    background: rgba(255,255,255,0.18);
    border-radius: 100px;
    filter: blur(2px);
    animation: drift linear infinite;
}
@keyframes drift {
    from { transform: translateX(-140%); }
    to { transform: translateX(700%); }
}
/* Rain */
.wa-rain {
    position: absolute;
    top: -20px;
    width: 2px; height: 60px;
    background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(180,210,255,0.7));
    border-radius: 2px;
    animation: fall linear infinite;
}
@keyframes fall {
    to { transform: translateY(340px); }
}
/* Snow */
.wa-snow {
    position: absolute;
    top: -10px;
    width: 7px; height: 7px;
    background: rgba(255,255,255,0.85);
    border-radius: 50%;
    animation: snowfall linear infinite;
}
@keyframes snowfall {
    to { transform: translateY(340px) translateX(20px); }
}
/* Lightning */
.wa-bolt {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.5);
    opacity: 0;
    animation: flash 6s infinite;
}
@keyframes flash {
    0%,95%,100% { opacity: 0; }
    96%,98% { opacity: 0.55; }
    97% { opacity: 0; }
}
/* Fog */
.wa-fog {
    position: absolute;
    left: 0; right: 0;
    height: 40px;
    background: rgba(255,255,255,0.14);
    filter: blur(8px);
    animation: drift linear infinite;
}

.unit-btn {
    font-family: "Manrope", sans-serif;
    font-weight: 700;
    font-size: 0.95rem;
}

/* ===== Hourly ===== */
.hourly {
    display: flex;
    gap: 0.6rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}
.hourly::-webkit-scrollbar { height: 6px; }
.hourly::-webkit-scrollbar-thumb { background: var(--surface-border); border-radius: 99px; }
.hour-card {
    flex: 0 0 auto;
    width: 72px;
    padding: 0.9rem 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    scroll-snap-align: start;
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
}
.hour-card:hover { transform: translateY(-4px); }
.hr-time { font-size: 0.7rem; font-weight: 700; color: var(--text-secondary); }
.hr-icon { font-size: 1.4rem; color: var(--accent); }
.hr-temp { font-weight: 700; font-size: 0.9rem; }

/* ===== Daylight (sunrise / sunset) ===== */
.daylight {
    display: flex;
    justify-content: center;
    gap: 2.5rem;
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--surface-border);
}
.dl { display: flex; align-items: center; gap: 0.5rem; }
.dl i { font-size: 1.35rem; color: var(--accent); }
.dl > div { display: flex; flex-direction: column; text-align: left; }
.dl-val { font-weight: 700; font-size: 0.95rem; }
.dl-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
}

/* ===== Forecast head + date select ===== */
.forecast-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 1.75rem 0 1rem;
}
.forecast-head .section-title { margin: 0; }
.date-select {
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--surface-strong);
    border: 1px solid var(--surface-border);
    border-radius: 99px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    max-width: 60%;
}
.date-select option { color: #0f172a; }

/* ===== Day detail card ===== */
.day-detail {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.5rem;
    flex-wrap: wrap;
}
.dd-left { display: flex; align-items: center; gap: 1rem; }
.dd-icon { font-size: 2.6rem; color: var(--accent); }
.dd-meta { display: flex; flex-direction: column; }
.dd-cond { font-weight: 700; font-size: 1.05rem; }
.dd-rain {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0.15rem 0;
}
.dd-rain i { color: var(--accent); }
.dd-temp { font-size: 0.95rem; }
.dd-temp .lo { color: var(--text-secondary); }
.dd-right { display: flex; flex-direction: column; gap: 0.4rem; }
.dd-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}
.dd-item i { color: var(--accent); font-size: 1.1rem; }

/* ===== Forecast ===== */
.section-title {
    font-family: "Manrope", sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    margin: 1.75rem 0 1rem;
}
.forecast {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.85rem;
}
.forecast-card {
    padding: 1.1rem 0.75rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
}
.forecast-card:hover { transform: translateY(-4px); }
.fc-day {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
}
.fc-icon { font-size: 2rem; color: var(--accent); margin: 0.1rem 0; }
.fc-cond { font-size: 0.72rem; color: var(--text-secondary); min-height: 2.1em; }
.fc-temp { font-weight: 700; font-size: 0.95rem; }
.fc-temp .lo { color: var(--text-secondary); font-weight: 500; }

/* ===== Skeleton ===== */
.skeleton {
    background: linear-gradient(90deg, rgba(255,255,255,0.06), rgba(255,255,255,0.18), rgba(255,255,255,0.06));
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
    border-radius: 8px;
    color: transparent !important;
}
@keyframes shimmer {
    from { background-position: 200% 0; }
    to { background-position: -200% 0; }
}

/* ===== Footer ===== */
.footer {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 2rem;
    font-size: 0.72rem;
    color: var(--text-secondary);
}
.footer a { color: var(--accent); text-decoration: none; }

/* ===== Install ===== */
.install-btn {
    position: fixed;
    bottom: 1.25rem;
    left: 50%;
    transform: translateX(-50%);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.4rem;
    background: var(--surface-strong);
    color: var(--text-primary);
    font-family: inherit;
    font-weight: 700;
    font-size: 0.9rem;
    border-radius: 99px;
    cursor: pointer;
    z-index: 60;
    animation: pop 0.3s ease;
}
.install-btn[hidden] { display: none; }
.install-btn i { color: var(--accent); }

/* ===== Focus ===== */
button:focus-visible, input:focus-visible, a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ===== Responsive ===== */
@media (max-width: 400px) {
    .brand-name { font-size: 1.3rem; }
    .hero { padding: 1.5rem; }
    .stat { flex-direction: column; gap: 0.2rem; }
    .stat > div { text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}
