﻿/* ===================================================================
   SIDEBAR.CSS — PERSISTENT SIDEBAR NAVIGATION SYSTEM (Single Source of Truth)
   ===================================================================
   SOURCE OF TRUTH (Desktop collapse):
     body.sidebar-layout.sidebar-collapsed

   Mobile drawer:
     .sidebar.mobile-open
     .sidebar-overlay.active
     body.sidebar-locked

   Width tokens:
     --sidebar-w / --sidebar-w-collapsed

   ================================================================ */


/* ===================================================================
   0. TOKENS (local to this stylesheet)
   ================================================================ */

:root {
    --sidebar-w: 240px;
    --sidebar-w-collapsed: 60px;
    /* If your app already defines these, they’ll override naturally */
    --sidebar-bg-1: #FAFAF9;
    --sidebar-bg-2: #F5F5F4;
    --sidebar-border: #eee;
}


/* ===================================================================
   1. SIDEBAR CONTAINER & STRUCTURE
   ================================================================ */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-w);
    height: 100vh;
    background: linear-gradient(135deg, var(--sidebar-bg-1) 0%, var(--sidebar-bg-2) 100%);
    display: flex;
    flex-direction: column;
    z-index: 300; /* keep above content/header; below modals */
    transition: width 0.3s ease, transform 0.3s ease;
    overflow: hidden;
    border-right: thin solid var(--sidebar-border);
}

/* Collapsed width (SINGLE SOURCE OF TRUTH = body class) */
.layout-app.sidebar-collapsed .sidebar {
    width: var(--sidebar-w-collapsed);
}


/* ===================================================================
   2. SIDEBAR HEADER
   ================================================================ */

.sidebar-header {
    display: flex;
    flex-direction: row;
    padding: var(--space-lg) 0.85rem;
    background-color: transparent;
    flex-shrink: 0;
    border-bottom: thin solid var(--sidebar-border);
}

    .sidebar-header:hover .icon-sidebar {
        opacity: 1;
    }

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    text-decoration: none;
    color: var(--text-primary);
    transition: opacity 0.3s ease;
}

.sidebar-logo-img {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.icon-sidebar {
    width: 24px;
    opacity: 0.6;
}

.sidebar-logo-text {
    font-family: var(--font-display);
    font-size: var(--text-lg);
    font-weight: var(--weight-semibold);
    color: var(--text-primary);
    white-space: nowrap;
    opacity: 1;
    transition: opacity 0.3s ease;
}

/* Hide logo text when collapsed */
.layout-app.sidebar-collapsed .sidebar .sidebar-logo-text {
    opacity: 0;
    width: 0;
}

/* Collapse Button */
.sidebar-collapse-btn {
    width: 100%;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: right;
    position: relative;
    background: transparent;
    border: none;
}

    .sidebar-collapse-btn:hover {
        background-color: transparent;
        color: var(--accent-primary);
        border-color: var(--accent-primary-light);
        outline: none;
        opacity: 1;

    }

    /* Rotate arrow icon when collapsed */
    .sidebar-collapse-btn .icon-sidebar {
        transition: transform .3s ease;
    }

.layout-app.sidebar-collapsed .sidebar .sidebar-collapse-btn .icon-sidebar {
    transform: rotate(180deg);
}

/* Brand text after the arrow when NOT collapsed */
.sidebar-collapse-btn::after {
    content: attr(data-brand);
    margin-left: .3rem;
    font-family: var(--font-display, Inter, "SF Pro Display", Segoe UI, Roboto, sans-serif);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary, #0f172a);
    white-space: nowrap;
    opacity: 1;
    transition: opacity .3s ease, width .3s ease, margin-left .3s ease;

}

/* Hide brand text when collapsed */
.layout-app.sidebar-collapsed .sidebar .sidebar-collapse-btn::after {
    content: "";
    opacity: 0;
    width: 0;
    margin-left: 0;
}


/* ===================================================================
   3. CONTEXT SELECTOR (Organization/Region)
   ================================================================ */

.sidebar-context {
    padding: var(--space-md);
    background: var(--primary-bg);
    flex-shrink: 0;
}

.context-org {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md);
    background-color: transparent;
    border-radius: var(--radius-md);
    margin-bottom: var(--space-sm);
}

.context-org-name {
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background-color: transparent;
}

.layout-app.sidebar-collapsed .sidebar .context-org-name {
    display: none;
}

/* Region Selector Dropdown */
.context-selector {
    position: relative;
}

.context-select {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--card-bg);
    font-size: var(--text-sm);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

    .context-select:hover {
        border-color: var(--accent-primary-light);
    }

    .context-select:focus {
        outline: none;
        border-color: var(--accent-primary);
        box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
    }

.layout-app.sidebar-collapsed .sidebar .context-selector {
    display: none;
}


/* ===================================================================
   3A. USER CHIP (Optional)
   ================================================================ */

.sidebar-userchip {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin: 20px var(--space-md) var(--space-sm);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    transition: background .2s ease, border-color .2s ease, transform .2s ease;
}

.userchip-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: var(--weight-semibold);
    font-size: var(--text-sm);
    color: white;
    background: var(--accent-primary);
    overflow: hidden;
}

.userchip-info {
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.userchip-name {
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.userchip-role {
    margin-top: 2px;
    font-size: 11px;
    letter-spacing: .3px;
    text-transform: uppercase;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Collapsed userchip: avatar only */
.layout-app.sidebar-collapsed .sidebar .sidebar-userchip {
    justify-content: center;
    padding: var(--space-sm);
    margin: 0 var(--space-xs) var(--space-sm);
}

.layout-app.sidebar-collapsed .sidebar .userchip-info {
    display: none;
}

.layout-app.sidebar-collapsed .sidebar .userchip-avatar {
    width: 28px;
    height: 28px;
}

/* Spacing when chip exists */
.sidebar-userchip + .sidebar-context,
.sidebar-userchip + .sidebar-content {
    margin-top: var(--space-sm);
}


/* ===================================================================
   4. SIDEBAR CONTENT & NAVIGATION
   ================================================================ */

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: var(--space-sm) .5rem;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

    .sidebar-content::-webkit-scrollbar {
        width: 6px;
    }

    .sidebar-content::-webkit-scrollbar-track {
        background: transparent;
    }

    .sidebar-content::-webkit-scrollbar-thumb {
        background: var(--border-color);
        border-radius: 3px;
    }

        .sidebar-content::-webkit-scrollbar-thumb:hover {
            background: var(--text-muted);
        }

/* Sections */
.nav-section {
    margin-bottom: var(--space-lg);
}

.nav-section-title {
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wider);
    padding: var(--space-sm) var(--space-md);
    margin-bottom: var(--space-xs);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity 0.3s ease;
}

.layout-app.sidebar-collapsed .sidebar .nav-section-title {
    opacity: 0;
    height: 0;
    padding: 0;
    margin: 0;
}

/* Nav items */
.nav-item {
    display: flex;
    justify-content: flex-start; /* expanded mode = left aligned */
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0rem 0.5rem 0.6rem !important;
    color: var(--text-secondary);
    text-decoration: none;
    font-family: Calibri;
    font-size: 1rem;
    font-weight: var(--weight-medium);
    border-radius: var(--radius-sm);
    transition: background 0.2s ease, color 0.2s ease;
    cursor: pointer;
    position: relative;
    white-space: nowrap;
    outline: none !important;
    border: none !important;
    width: 100%;

}

    .nav-item:hover {
        /*background: rgba(30, 64, 175, 0.15);
        color: #222;*/
        color: lightsalmon;
        }


    /* Active */
    .nav-item.active {
        /*background: rgba(30, 64, 175, 0.12);
        color: var(--text-primary, #0f172a);*/
        color: orangered;
    }

    /* quick one-shot “activated” flash (class applied in JS) */
    .nav-item.just-activated {
        background: rgba(30, 64, 175, 0.16);
    }

    /* Icons */
    .nav-item i {
        width: 20px;
        height: 20px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 18px;
        flex-shrink: 0;
        padding: 0;
        margin: 0 .25rem 0 .1rem;
    }

/* SVG icons inside nav-item */
.sidebar .nav-item svg {
    width: 20px;
    height: 20px;
    stroke: #475569;
    opacity: .85;
    flex-shrink: 0;
}

.sidebar .nav-item:hover svg {
    stroke: var(--accent, var(--accent-primary, #2563eb));
    opacity: 1;
}

/* Text */
.nav-item-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 1;
    transition: opacity 0.3s ease;
}

/* Badge */
.nav-item-badge {
    background: var(--error);
    color: white;
    font-size: var(--text-xs);
    font-weight: var(--weight-bold);
    padding: 2px 6px;
    border-radius: var(--radius-full);
    min-width: 18px;
    text-align: center;
    transition: opacity 0.3s ease;
}

/* Collapsed: icon-only, centered, text hidden */
.layout-app.sidebar-collapsed .sidebar .nav-item {
    justify-content: center;
    padding: var(--space-sm);
    margin: var(--space-xs) var(--space-xs);
}

.layout-app.sidebar-collapsed .sidebar .nav-item-text,
.layout-app.sidebar-collapsed .sidebar .nav-item-badge {
    opacity: 0;
    width: 0;
}

/* Collapsed tooltips */
.layout-app.sidebar-collapsed .sidebar .nav-item::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 100%;
    margin-left: var(--space-sm);
    padding: var(--space-xs) var(--space-sm);
    background: var(--text-primary);
    color: white;
    font-size: var(--text-xs);
    border-radius: var(--radius-sm);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 1000;
}

.layout-app.sidebar-collapsed .sidebar .nav-item:hover::after {
    opacity: 1;
}

/* Disabled nav items (coming soon) */
.nav-item-disabled,
.nav-item[aria-disabled="true"] {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

    .nav-item-disabled i,
    .nav-item-disabled svg {
        color: #cbd5e1;
        stroke: #cbd5e1;
    }






/* ===================================================================
   5. SIDEBAR FOOTER (Optional Branding)
   ================================================================ */

.sidebar-footer {
    padding: var(--space-md);
    background-color: transparent;
    flex-shrink: 0;
}

.sidebar-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-sm);
    opacity: 1;
    transition: opacity 0.3s ease;
}

.layout-app.sidebar-collapsed .sidebar .sidebar-brand {
    opacity: 0;
}

.brand-text {
    font-size: var(--text-xs);
    color: var(--text-muted);
    font-weight: var(--weight-medium);
}

.brand-version {
    font-size: var(--text-xs);
    color: var(--text-muted);
    opacity: 0.6;
}


/* ===================================================================
   6. DESKTOP MINIMAL HEADER (User Profile)
   ================================================================ */

.minimal-header {
    position: fixed;
    top: 0;
    right: 0;
    left: var(--sidebar-w);
    height: 60px;
    background-color: transparent;
    z-index: 200;
}

.layout-app.sidebar-collapsed .minimal-header {
    left: var(--sidebar-w-collapsed);
}

.minimal-header-content {
    height: 100%;
    padding: 0 var(--space-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: transparent;
}

.header-spacer {
    flex: 1;
}

.header-profile-btn {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-xs) var(--space-md);
    cursor: pointer;
    background: transparent;
    border: none;
}

    .header-profile-btn:hover {
        border-color: #d1d5db;
        background-color: transparent;
        outline: none;
    }

    .header-profile-btn:active,
    .header-profile-btn:focus {
        outline: none;
        border: none;
        background-color: transparent;
        box-shadow: none;
    }

.header-profile-img,
.header-profile-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
    overflow: hidden;
}

.header-profile-avatar {
    background: var(--accent-primary);
    color: white;
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
}

/* Keep your current “icon-only” desktop header behavior */
.header-profile-info {
    display: none;
}

.header-profile-chevron {
    display: none;
}


/* ===================================================================
   7. DESKTOP LOGIN BUTTONS (Unauthenticated)
   ================================================================ */

.desktop-login-container {
    position: fixed;
    top: var(--space-lg);
    right: var(--space-lg);
    z-index: 300;
    display: flex;
    gap: var(--space-sm);
}

.desktop-login-btn,
.desktop-register-btn {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.desktop-login-btn {
    background: var(--accent-primary);
    color: white;
    border: 2px solid var(--accent-primary);
}

    .desktop-login-btn:hover {
        background: var(--accent-primary-dark);
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(30, 64, 175, 0.3);
    }

.desktop-register-btn {
    background: white;
    color: var(--accent-primary);
    border: 2px solid var(--accent-primary);
}

    .desktop-register-btn:hover {
        background: var(--accent-primary);
        color: white;
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(30, 64, 175, 0.3);
    }

    .desktop-login-btn i,
    .desktop-register-btn i {
        font-size: var(--text-base);
    }


/* ===================================================================
   8. MOBILE TOP BAR
   ================================================================ */

.mobile-topbar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    z-index: 200;
    padding: 0 var(--space-md);
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.mobile-topbar-logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    text-decoration: none;
    color: var(--text-primary);
}

    .mobile-topbar-logo img {
        width: 32px;
        height: 32px;
    }

.mobile-topbar-logo-text {
    font-family: var(--font-display);
    font-size: var(--text-lg);
    font-weight: var(--weight-semibold);
    color: var(--text-primary);
}

.mobile-topbar-actions {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.mobile-profile-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-primary);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    cursor: pointer;
    transition: all 0.2s ease;
}

    .mobile-profile-btn:hover {
        background: var(--accent-primary-dark);
        transform: scale(1.05);
    }

    .mobile-profile-btn img {
        width: 100%;
        height: 100%;
        border-radius: 50%;
        object-fit: cover;
    }

.mobile-login-btn,
.mobile-register-btn {
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    text-decoration: none;
    transition: all 0.2s ease;
}

.mobile-login-btn {
    background: var(--accent-primary);
    color: white;
    border: none;
}

    .mobile-login-btn:hover {
        background: var(--accent-primary-dark);
    }

.mobile-register-btn {
    background: transparent;
    color: var(--accent-primary);
    border: 1px solid var(--accent-primary);
}

    .mobile-register-btn:hover {
        background: rgba(30, 64, 175, 0.1);
    }


/* ===================================================================
   9. MOBILE COMPONENTS
   ================================================================ */

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 350;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

    .sidebar-overlay.active {
        display: block;
        opacity: 1;
        pointer-events: auto;
    }



/* Body lock (mobile drawer open) */
body.sidebar-locked {
    overflow: hidden;
}


/* ===================================================================
   10. DESKTOP LAYOUT (≥769px)
   ================================================================ */

@media (min-width: 769px) {

    .minimal-header {
        display: block;
    }

    .mobile-topbar {
        display: none !important;
    }

    .desktop-login-container {
        display: flex;
    }

    /* Sidebar always visible on desktop */
    .sidebar {
        display: flex;
        transform: translateX(0);
    }

    /* Main content */
    .layout-app .main-content {
        margin-left: var(--sidebar-w);
        margin-top: 60px;
        padding-top: var(--space-lg);
        min-height: calc(100vh - 120px);
        transition: margin-left 0.3s ease;
    }

    .layout-app.sidebar-collapsed .main-content {
        margin-left: var(--sidebar-w-collapsed);
    }

    /* Footer (if you use .app-footer) */
    .layout-app .app-footer {
        margin-left: var(--sidebar-w);
        transition: margin-left 0.3s ease;
    }

    .layout-app.sidebar-collapsed .app-footer {
        margin-left: var(--sidebar-w-collapsed);
    }

    /* Hide bottom nav on desktop */
    .bottom-nav {
        display: none;
    }

  

    .sidebar-overlay {
        display: none !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }
}


/* ===================================================================
   11. MOBILE LAYOUT (≤768px)
   ================================================================ */

@media (max-width: 768px) {

    .minimal-header {
        display: none !important;
    }

    .desktop-login-container {
        display: none !important;
    }

    .mobile-topbar {
        display: flex !important;
    }

    /* Sidebar slides in */
    .sidebar {
        transform: translateX(-100%);
        z-index: 400; /* above overlay */
    }

        .sidebar.mobile-open {
            transform: translateX(0);
        }


    .mobile-topbar-left {
        display: flex;
        align-items: center;
        gap: var(--space-sm);
    }

    .mobile-nav-toggle {
        width: 40px;
        height: 40px;
        border-radius: 10px;
        border: 1px solid var(--border-color);
        background: rgba(255,255,255,.85);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
    }

        .mobile-nav-toggle:active {
            transform: translateY(1px);
        }

      
    /* Main content full width */
    .layout-app .main-content {
        margin-left: 0;
        margin-top: 0;
        padding-top: 72px;
        min-height: calc(100vh - 126px);
    }

    /* Footer spacing for bottom nav */
    .layout-app .app-footer {
        margin-left: 0;
        padding-bottom: 70px;
    }

    /* On mobile, collapse state is not used (JS clears it) */
    .layout-app.sidebar-collapsed .main-content {
        margin-left: 0;
    }

    .layout-app.sidebar-collapsed .app-footer {
        margin-left: 0;
    }

    /* Mobile chip sizing */
    .sidebar-userchip {
        margin: var(--space-sm) var(--space-md);
        padding: var(--space-sm) var(--space-md);
    }

    .userchip-avatar {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }

    .userchip-name {
        font-size: 13px;
    }

    .userchip-role {
        font-size: 10px;
    }
}


/* ===================================================================
   12. ACCESSIBILITY & REDUCED MOTION
   ================================================================ */

@media (prefers-reduced-motion: reduce) {
    .sidebar,
    .sidebar-content,
    .nav-item,
    .sidebar-collapse-btn,
    .minimal-header,
    .layout-app .main-content {
        transition: none !important;
    }
}


/* ===================================================================
   13. PRINT STYLES
   ================================================================ */

@media print {
    .sidebar,
    .minimal-header,
    .mobile-topbar,
    .sidebar-mobile-toggle,
    .bottom-nav {
        display: none;
    }

    .sidebar-layout.main-content {
        margin-left: 0;
        margin-top: 0;
    }
}


/* ===================================================================
   WELCOME PAGE OVERRIDES
   ================================================================ */

body.layout-welcome .main-content {
    margin-left: 0 !important;
    margin-top: 0 !important;
    padding-top: var(--space-xl) !important;
}

body.layout-welcome .app-footer {
    margin-left: 0 !important;
}

body.layout-welcome .sidebar,
body.layout-welcome .minimal-header,
body.layout-welcome .mobile-topbar,
body.layout-welcome .bottom-nav {
    display: none !important;
}

body.layout-welcome {
    background: var(--primary-bg);
}


/* ===================================================================
   LAYOUT WITHOUT SIDEBAR (Unauthenticated or pages without sidebar-layout)
   ================================================================ */

body:not(.layout-app) .main-content {
    margin-left: 0;
    margin-top: 0;
    margin-right: 0;
    padding-top: 0;
    width: 100%;
}

body:not(.layout-app) .app-footer {
    margin-left: 0;
    margin-right: 0;
}

body:not(.layout-app) .welcome-page {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
}

@media (min-width: 769px) {
    body:not(.layout-app) .minimal-header {
        display: none;
    }

    body:not(.layout-app) .mobile-topbar {
        display: none;
    }

    body:not(.layout-app) .desktop-login-container {
        display: flex;
    }
}

@media (max-width: 768px) {
    body:not(.layout-app) .main-content {
        padding-top: 72px;
    }

    .sidebar-collapse-btn {
        display: none;
    }
}


/* ===================================================================
   OPTIONAL: Sidebar Weather Compact Widget
   ================================================================ */

.sidebar-weather-compact {
    margin: 8px 12px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    transition: all 0.3s ease;
}

    .sidebar-weather-compact:hover {
        background: rgba(255, 255, 255, 0.08);
        border-color: rgba(255, 255, 255, 0.15);
    }

.weather-main {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.weather-icon-compact {
    font-size: 32px;
    line-height: 1;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

    .weather-icon-compact .fa-sun {
        color: #fbbf24;
    }

    .weather-icon-compact .fa-cloud-showers-heavy,
    .weather-icon-compact .fa-droplet {
        color: #60a5fa;
    }

    .weather-icon-compact .fa-cloud {
        color: #cbd5e1;
    }

    .weather-icon-compact .fa-cloud-sun {
        color: #fbbf24;
    }

    .weather-icon-compact .fa-snowflake {
        color: #93c5fd;
    }

    .weather-icon-compact .fa-cloud-bolt {
        color: #a855f7;
    }

    .weather-icon-compact .fa-smog {
        color: #9ca3af;
    }

.weather-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.temp-compact {
    font-size: 1rem;
    font-weight: 500;
    line-height: 2;
    color: #999;
}

.condition-compact {
    font-size: 11px;
    font-weight: 500;
    color: #cbd5e1;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.weather-location-compact {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    color: #94a3b8;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

    .weather-location-compact i {
        font-size: 9px;
    }

.weather-precip-compact {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: #60a5fa;
    margin-top: 4px;
}

    .weather-precip-compact i {
        font-size: 9px;
    }

/* Collapsed: tighten + hide extra text */
.layout-app.sidebar-collapsed .sidebar .sidebar-weather-compact {
    padding: 8px;
}

.layout-app.sidebar-collapsed .sidebar .weather-main {
    flex-direction: column;
    gap: 4px;
    margin-bottom: 4px;
}

.layout-app.sidebar-collapsed .sidebar .weather-icon-compact {
    font-size: 28px;
}

.layout-app.sidebar-collapsed .sidebar .temp-compact {
    font-size: 16px;
    text-align: center;
}

.layout-app.sidebar-collapsed .sidebar .condition-compact,
.layout-app.sidebar-collapsed .sidebar .weather-location-compact,
.layout-app.sidebar-collapsed .sidebar .weather-precip-compact {
    display: none;
}


.budget-health-mini .legend-item[data-tooltip] {
    cursor: help;
}

/* =========================================================
   MOBILE OFF-CANVAS HARDENING (wins against overrides)
   Put this at the VERY END of sidebar.css
   ========================================================= */
@media (max-width: 768px) {
    body.layout-app .sidebar {
        transform: translateX(-110%) !important; /* fully offscreen */
    }

        body.layout-app .sidebar.mobile-open {
            transform: translateX(0) !important;
        }

    body.layout-app .sidebar-overlay {
        display: block; /* it can still be opacity:0 unless .active */
    }

        body.layout-app .sidebar-overlay:not(.active) {
            opacity: 0;
            pointer-events: none;
        }

        body.layout-app .sidebar-overlay.active {
            opacity: 1;
            pointer-events: auto;
        }
}

/* ===================================================================
   FIX #2: .notice-box — PowerUser deprecation warning
   Add this to sidebar.css, after the .nav-item-disabled rules (section 4)
   =================================================================== */

.notice-box {
    margin: var(--space-sm) var(--space-md);
    padding: var(--space-md);
    background: #fffbeb;
    border: 1px solid #fbbf24;
    border-radius: var(--radius-md, 8px);
    font-size: var(--text-sm, 0.875rem);
    color: #78350f;
    line-height: 1.5;
}

    .notice-box strong {
        display: block;
        margin-bottom: var(--space-xs, 4px);
        color: #b45309;
        font-size: var(--text-sm, 0.875rem);
    }

    .notice-box p {
        margin: var(--space-xs, 4px) 0;
    }

    .notice-box ul {
        list-style: none;
        padding: 0;
        margin: var(--space-xs, 4px) 0;
    }

        .notice-box ul li {
            padding: 2px 0 2px var(--space-md, 12px);
            position: relative;
        }

            .notice-box ul li::before {
                content: "→";
                position: absolute;
                left: 0;
                color: #f59e0b;
            }

    .notice-box em {
        display: block;
        margin-top: var(--space-sm, 8px);
        font-size: var(--text-xs, 0.75rem);
        color: #b45309;
        opacity: 0.85;
    }

/* Collapsed sidebar: hide the notice box entirely (icon-only mode) */
.layout-app.sidebar-collapsed .sidebar .notice-box {
    display: none;
}

/* ===================================================================
   SIDEBAR TOOLTIP — Collapsed-only navigation tooltips
   
   Add this to sidebar.css (or as a separate sidebar-tooltip.css).
   
   ALSO: Remove the old CSS ::after tooltip block from sidebar.css.
   Delete these rules:
   
     .layout-app.sidebar-collapsed .sidebar .nav-item::after { ... }
     .layout-app.sidebar-collapsed .sidebar .nav-item:hover::after { ... }
   
   =================================================================== */

/* Tooltip element (appended to body by sidebar-tooltip.js) */
.sidebar-tip {
    position: fixed;
    z-index: 1000;
    padding: 6px 12px;
    background: #1e293b;
    color: #f8fafc;
    font-size: 0.8125rem;
    font-weight: 500;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    border-radius: 6px;
    white-space: nowrap;
    pointer-events: none;
    transform: translateY(-50%) translateX(-4px);
    opacity: 0;
    transition: opacity 0.15s ease, transform 0.15s ease;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.25);
}

/* Visible state */
.sidebar-tip-visible {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

/* Hide on mobile (sidebar is a drawer, not collapsed) */
@media (max-width: 768px) {
    .sidebar-tip {
        display: none !important;
    }
}