/**
 * Dynamic Weather Effects Animation System
 * Lightweight, non-intrusive Canvas atmospheric overlay.
 * Crafted with high performance, accessibility, and zero UI interference.
 */

#weather-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    z-index: 0 !important; /* Strictly in the background behind page content */
    opacity: 1;
    transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

#weather-canvas.weather--hidden {
    opacity: 0 !important;
    visibility: hidden !important;
}

/* Accessibility: Respect user motion preferences */
@media (prefers-reduced-motion: reduce) {
    #weather-canvas {
        display: none !important;
    }
}

/* -------------------------------------------------------------
 * Soft Canvas Background System - Paragon Green Signature
 * Body holds the soft neutral Paragon canvas color (#f4f8f7).
 * Page wrappers are transparent so background canvas shines through in the margins.
 * Content cards and portlets are opaque white (#ffffff) at z-index: 2.
 * ----------------------------------------------------------- */
html,
body {
    background-color: #f4f8f7 !important;
    background-image: none !important;
    min-height: 100vh !important;
    transition: background-color 0.8s ease;
}

/* Atmospheric nuances based on active weather on body - Solid, unified, seamless */
body[data-weather-active="sunny"],
body[data-weather-active="hot"] {
    background-color: #f4f8f7 !important;
    background-image: none !important;
}

body[data-weather-active="rain"] {
    background-color: #f0f6f4 !important;
    background-image: none !important;
}

body[data-weather-active="thunderstorm"],
body[data-weather-active="storm"] {
    background-color: #edf4f2 !important;
    background-image: none !important;
}

body[data-weather-active="snow"] {
    background-color: #f2f7f5 !important;
    background-image: none !important;
}

body[data-weather-active="cloudy"] {
    background-color: #f0f5f3 !important;
    background-image: none !important;
}

body[data-weather-active="fog"],
body[data-weather-active="mist"] {
    background-color: #f0f5f3 !important;
    background-image: none !important;
}

/* Modals & Backdrop Layering Fix: Ensure modals sit above backdrop and canvas never interferes */
.modal {
    z-index: 1055 !important;
}

.modal-backdrop {
    z-index: 1050 !important;
}

body.modal-open #weather-canvas {
    z-index: -1 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Page wrappers are transparent so background and weather canvas shine through behind */
.m-page,
.m-page--fluid,
.m-body,
.m-wrapper,
.m-container,
.m-content {
    background-color: transparent !important;
    background: transparent !important;
}

/* Content cards and portlets: solid white, sits cleanly on top of weather animations */
.m-portlet,
.card,
.content-card,
.hero-card,
.notification-card {
    position: relative;
    z-index: 2;
    background-color: #ffffff !important;
    border: 1px solid rgba(226, 232, 240, 0.9) !important;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04) !important;
}

.m-subheader {
    position: relative;
    z-index: 2;
    background-color: transparent !important;
}

/* Topbar Weather Widget */
.weather-topbar-item .m-nav__link-icon-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.weather-topbar-item:hover .m-nav__link-icon-wrapper {
    background-color: rgba(20, 122, 113, 0.12);
    color: #147a71;
}

#weather-topbar-icon {
    font-size: 1.35rem;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), color 0.2s ease;
}

.weather-topbar-item:hover #weather-topbar-icon {
    transform: scale(1.12);
    color: #147a71;
}

/* Weather Dropdown Menu */
.weather-dropdown-menu {
    padding: 6px 0;
    list-style: none;
    margin: 0;
}

.weather-menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 16px;
    color: #334155;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px;
    margin: 1px 6px;
    transition: all 0.18s ease;
    text-decoration: none !important;
}

.weather-menu-item:hover {
    background-color: rgba(20, 122, 113, 0.06);
    color: #0f172a;
    transform: translateX(2px);
}

.weather-menu-item.active {
    background: rgba(20, 122, 113, 0.12);
    color: #147a71;
    font-weight: 600;
}

.weather-menu-item__left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.weather-menu-item__icon {
    font-size: 1.15rem;
    width: 20px;
    text-align: center;
    color: #64748b;
    transition: color 0.18s ease;
}

.weather-menu-item:hover .weather-menu-item__icon,
.weather-menu-item.active .weather-menu-item__icon {
    color: #147a71;
}

.weather-menu-item__check {
    font-size: 0.95rem;
    color: #147a71;
    opacity: 0;
    transition: opacity 0.18s ease;
}

.weather-menu-item.active .weather-menu-item__check {
    opacity: 1;
}

.weather-dropdown-divider {
    height: 1px;
    background-color: rgba(20, 122, 113, 0.08);
    margin: 6px 0;
}

/* Live Weather Header Card */
.weather-live-card {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f8f6 100%);
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 8px;
    border: 1px solid rgba(20, 122, 113, 0.15);
}

.weather-live-card__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.76rem;
    color: #64748b;
    margin-bottom: 6px;
}

.weather-live-card__location {
    font-weight: 600;
    color: #334155;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.weather-live-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #0d9488;
    background: rgba(13, 148, 136, 0.1);
    padding: 2px 6px;
    border-radius: 999px;
}

.weather-live-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #0d9488;
    animation: livePulse 1.8s ease-in-out infinite;
}

@keyframes livePulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.75); }
}

.weather-live-card__main {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
}

.weather-live-card__temp {
    font-size: 1.5rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1;
}

.weather-live-card__desc {
    font-size: 0.8rem;
    color: #475569;
    font-weight: 500;
    text-align: right;
}

/* Hourly Forecast Mini Strip */
.weather-hourly-strip {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 6px 0 8px 0;
    margin-bottom: 6px;
    scrollbar-width: none;
}

.weather-hourly-strip::-webkit-scrollbar {
    display: none;
}

.weather-hourly-item {
    flex: 0 0 auto;
    width: 48px;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 6px 4px;
    text-align: center;
    font-size: 0.72rem;
}

.weather-hourly-item__time {
    color: #64748b;
    font-size: 0.68rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.weather-hourly-item__icon {
    font-size: 0.95rem;
    color: #147a71;
    margin: 2px 0;
}

.weather-hourly-item__temp {
    color: #1e293b;
    font-weight: 700;
    font-size: 0.74rem;
}

.weather-attribution {
    font-size: 0.68rem;
    color: #94a3b8;
    text-align: center;
    padding: 6px 4px 2px 4px;
    display: block;
}

.weather-attribution a {
    color: #64748b;
    text-decoration: underline;
}

/* Dark Mode Overrides for Weather Dropdown */
html.dark-mode .weather-live-card {
    background: linear-gradient(135deg, #131a29 0%, #172134 100%);
    border-color: rgba(255, 255, 255, 0.08);
}

html.dark-mode .weather-live-card__location {
    color: #f1f5f9;
}

html.dark-mode .weather-live-card__temp {
    color: #ffffff;
}

html.dark-mode .weather-live-card__desc {
    color: #cbd5e1;
}

html.dark-mode .weather-hourly-item {
    background-color: #151d2f;
    border-color: rgba(255, 255, 255, 0.08);
}

html.dark-mode .weather-hourly-item__time {
    color: #94a3b8;
}

html.dark-mode .weather-hourly-item__temp {
    color: #f8fafc;
}

html.dark-mode .weather-menu-item {
    color: #cbd5e1;
}

html.dark-mode .weather-menu-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: #ffffff;
}

html.dark-mode .weather-dropdown-divider {
    background-color: rgba(255, 255, 255, 0.08);
}

html.dark-mode .weather-attribution {
    color: #64748b;
}

