/* ===== RIGHT-SIDE COLLAPSIBLE SIDEBAR ===== */

:root {
    --sidebar-teal: #0F4C5C;
    --sidebar-teal-mid: #1A535C;
    --sidebar-teal-light: #E8F5F0;
    --sidebar-orange: #F77F00;
    --sidebar-orange-hover: #e07000;
    --sidebar-dark: #111827;
    --sidebar-gray: #6B7280;
    --sidebar-border: #E5E7EB;
    --sidebar-width: 240px;
    --sidebar-width-collapsed: 68px;
    --sidebar-shadow: -4px 0 24px rgba(15,76,92,.10);
    --sidebar-radius: 20px 0 0 20px;
    --sidebar-transition: all 0.28s cubic-bezier(.4,0,.2,1);
}

/* Body margin adjustment to make room for desktop sidebar */
body.has-sidebar {
    margin-right: var(--sidebar-width) !important;
    transition: margin-right 0.28s cubic-bezier(.4,0,.2,1);
}
body.sidebar-collapsed {
    margin-right: var(--sidebar-width-collapsed) !important;
}

/* Overlay (mobile only) */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(17,24,39,.40);
    z-index: 1099;
    backdrop-filter: blur(2px);
}
.sidebar-overlay.show { 
    display: block; 
}

/* The sidebar panel */
.app-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: var(--sidebar-width);
    background: #ffffff;
    border-left: 1.5px solid var(--sidebar-border);
    box-shadow: var(--sidebar-shadow);
    border-radius: var(--sidebar-radius);
    z-index: 1100;
    display: flex;
    flex-direction: column;
    transition: var(--sidebar-transition);
    overflow: hidden;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.app-sidebar.collapsed {
    width: var(--sidebar-width-collapsed);
    background: transparent;
    border-left: none;
    box-shadow: none;
    pointer-events: none;
}

/* Sidebar header: toggle button */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 16px;
    border-bottom: 1.5px solid var(--sidebar-border);
    min-height: 64px;
    flex-shrink: 0;
}

.app-sidebar.collapsed .sidebar-header {
    border-bottom: none;
    background: transparent;
    padding: 18px 0 10px;
    justify-content: center;
}

.sidebar-logo-wrap {
    display: none !important;
}

.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--sidebar-teal-light);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    color: var(--sidebar-teal);
    font-size: 1rem;
    transition: background .2s, color .2s, transform .2s;
    flex-shrink: 0;
    outline: none;
}
.sidebar-toggle:hover {
    background: var(--sidebar-teal);
    color: #fff;
}
.app-sidebar.collapsed .sidebar-toggle {
    margin: 0 auto;
    pointer-events: auto;
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
    border: 1.5px solid rgba(15, 76, 92, 0.08);
}
.app-sidebar.collapsed .sidebar-toggle:hover {
    background: var(--sidebar-teal);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(15, 76, 92, 0.22);
}

/* Nav list */
.sidebar-nav {
    flex: 1;
    padding: 16px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 14px;
    border-radius: 14px;
    text-decoration: none;
    color: var(--sidebar-dark);
    font-size: .93rem;
    font-weight: 600;
    white-space: nowrap;
    transition: background .2s, color .2s, padding .28s;
    position: relative;
    cursor: pointer;
}

.sidebar-item i {
    font-size: 1.15rem;
    color: var(--sidebar-gray);
    width: 22px;
    text-align: center;
    flex-shrink: 0;
    transition: color .2s;
}

.sidebar-item:hover {
    background: var(--sidebar-teal-light);
    color: var(--sidebar-teal);
}
.sidebar-item:hover i {
    color: var(--sidebar-teal);
}

.sidebar-item.active {
    background: var(--sidebar-teal-light);
    color: var(--sidebar-teal);
    font-weight: 700;
}
.sidebar-item.active i {
    color: var(--sidebar-teal);
}
.sidebar-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 20%;
    height: 60%;
    width: 3.5px;
    background: var(--sidebar-teal);
    border-radius: 0 3px 3px 0;
}

.sidebar-item .sidebar-label {
    transition: opacity 0.2s, width 0.28s;
    overflow: hidden;
}
.app-sidebar.collapsed .sidebar-item .sidebar-label {
    opacity: 0;
    width: 0;
}
.app-sidebar.collapsed .sidebar-item {
    pointer-events: auto;
    width: 44px;
    height: 44px;
    padding: 0;
    margin: 3px auto;
    justify-content: center;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
    border: 1.5px solid rgba(15, 76, 92, 0.08);
    transition: transform 0.2s cubic-bezier(.4,0,.2,1), box-shadow 0.2s, background 0.2s, color 0.2s;
}

.app-sidebar.collapsed .sidebar-item:hover {
    background: var(--sidebar-teal-light);
    color: var(--sidebar-teal);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(15, 76, 92, 0.18);
}

.app-sidebar.collapsed .sidebar-item.active {
    background: var(--sidebar-teal);
    color: #ffffff;
    border-color: var(--sidebar-teal);
    box-shadow: 0 6px 20px rgba(15, 76, 92, 0.32);
}

.app-sidebar.collapsed .sidebar-item.active i {
    color: #ffffff;
}

.app-sidebar.collapsed .sidebar-item::before {
    display: none;
}

/* Notification badge */
.sidebar-badge {
    width: 8px;
    height: 8px;
    background: var(--sidebar-orange);
    border-radius: 50%;
    margin-left: auto;
    flex-shrink: 0;
    transition: opacity 0.2s;
}
.app-sidebar.collapsed .sidebar-badge {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 10px;
    height: 10px;
    border: 2px solid #ffffff;
    margin-left: 0;
}

/* Tooltip for collapsed mode */
.app-sidebar.collapsed .sidebar-item:hover::after {
    content: attr(data-label);
    position: absolute;
    right: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--sidebar-dark);
    color: #fff;
    font-size: .8rem;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 8px;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0,0,0,.2);
    z-index: 9999;
}

/* ── Mobile Screensize: Floating Bottom Pill Navigation (Chowdeck Style) ── */
.mobile-bottom-nav {
    display: none;
}

@media (max-width: 768px) {
    /* Get rid of mobile hamburger button */
    .sidebar-mobile-trigger,
    #mobileSidebarTrigger {
        display: none !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }

    /* Hide desktop/drawer sidebar and overlay on mobile */
    .app-sidebar,
    .sidebar-overlay {
        display: none !important;
    }

    body.has-sidebar,
    body.sidebar-collapsed {
        margin-right: 0 !important;
    }

    /* Add room at the bottom of the screen so floating nav doesn't cover content */
    body {
        padding-bottom: 96px !important;
    }

    /* Chowdeck floating pill bottom nav bar */
    .mobile-bottom-nav {
        display: flex !important;
        position: fixed;
        bottom: 16px;
        left: 50%;
        transform: translateX(-50%);
        width: calc(100% - 32px);
        max-width: 420px;
        height: 66px;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-radius: 999px;
        border: 1.5px solid rgba(229, 231, 235, 0.9);
        box-shadow: 0 12px 36px rgba(0, 0, 0, 0.14), 0 2px 10px rgba(15, 76, 92, 0.08);
        z-index: 99999;
        align-items: center;
        justify-content: space-around;
        padding: 4px 8px;
        box-sizing: border-box;
        transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1), transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.28s ease;
    }

    .mobile-bottom-nav.nav-hidden,
    body.modal-open .mobile-bottom-nav,
    body.lightbox-open .mobile-bottom-nav {
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
        transform: translate(-50%, 40px) !important;
    }

    .mobile-nav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        text-decoration: none;
        color: #8E8E93;
        padding: 6px 4px;
        border-radius: 20px;
        transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
        user-select: none;
        -webkit-tap-highlight-color: transparent;
        text-align: center;
    }

    .mobile-nav-icon-wrap {
        position: relative;
        width: 32px;
        height: 28px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.25rem;
        color: #8E8E93;
        transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1), color 0.22s;
    }

    .mobile-nav-label {
        font-size: 0.72rem;
        font-weight: 600;
        line-height: 1.1;
        color: #8E8E93;
        transition: color 0.22s, font-weight 0.22s;
        white-space: nowrap;
    }

    /* Active Tab State (matching Chowdeck reference) */
    .mobile-nav-item.active {
        color: var(--sidebar-teal, #0F4C5C);
    }
    .mobile-nav-item.active .mobile-nav-label {
        color: var(--sidebar-teal, #0F4C5C);
        font-weight: 800;
    }
    .mobile-nav-item.active .mobile-nav-icon-wrap {
        color: var(--sidebar-teal, #0F4C5C);
        transform: translateY(-2px);
    }
    .mobile-nav-item.active .mobile-nav-icon-wrap::before {
        content: '';
        position: absolute;
        width: 38px;
        height: 38px;
        border-radius: 50%;
        background: radial-gradient(circle, rgba(15, 76, 92, 0.12) 0%, rgba(232, 245, 240, 0.5) 60%, transparent 100%);
        z-index: -1;
        animation: activeTabPulse 0.3s ease;
    }

    /* Special Accent for Post a Service button */
    .mobile-nav-item[data-tab="post-service"] .post-service-icon {
        color: var(--sidebar-orange, #F77F00);
        font-size: 1.35rem;
    }
    .mobile-nav-item[data-tab="post-service"].active .post-service-icon {
        color: var(--sidebar-orange, #F77F00);
    }
    .mobile-nav-item[data-tab="post-service"].active .post-service-icon::before {
        background: radial-gradient(circle, rgba(247, 127, 0, 0.18) 0%, rgba(254, 243, 199, 0.5) 60%, transparent 100%);
    }

    .mobile-nav-item:active {
        transform: scale(0.92);
    }
}

@keyframes activeTabPulse {
    from { transform: scale(0.6); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
