/**
 * Sidebar Navigation Styles
 * Desktop: Left sidebar
 * Mobile: Bottom navigation bar
 */

/* Desktop Sidebar Navigation */
.sidebar-nav {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    width: 80px;
    background-color: #fff;
    z-index: 1000 !important;
    padding: 80px 0 20px;
    overflow-y: auto;
    overflow-x: hidden;
    transition: all 0.3s ease;
}

/* On desktop, ensure sidebar starts below navbar */
@media (min-width: 992px) {
    .sidebar-nav {
        z-index: 1000 !important;
        /* Sidebar will be behind navbar, navbar is fixed on top */
    }
}

/* Ensure sidebar stays below navbar on desktop */
@media (min-width: 992px) {
    .sidebar-nav {
        z-index: 1000 !important;
    }
}

.sidebar-nav-menu {
    height: 100%;
}

.sidebar-nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding-top: 10px;
}

.sidebar-nav-item {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 0 12px;
}


.sidebar-nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    padding: 8px;
    text-decoration: none;
    color: #6b7280;
    border-radius: 12px;
    transition: all 0.3s ease;
    position: relative;
    margin: 0 auto;
}

.sidebar-nav-link:hover {
    text-decoration: none;
    color: #ff670f;
    transform: translateY(-2px);
}



.sidebar-nav-link.active i {
    color: #fff;
}

.sidebar-nav-link.active .sidebar-nav-label {
    color: #fff;
}

.sidebar-nav-link i {
    font-size: larger;
    color: #384152;
    margin-bottom: 0;
    display: block;
}

[data-bs-theme="dark"] .sidebar-nav-link i {
    font-size: larger;
    color: #d1d5db;
    margin-bottom: 0;
    display: block;
}

.sidebar-nav-link i:hover {
    color: #ff670f;
    margin-bottom: 0;
    display: block;
}

.sidebar-nav-label {
    font-size: 11px;
    font-weight: 500;
    text-align: center;
    line-height: 1.2;
    margin-top: 4px;
    white-space: nowrap;
}

/* Mobile Bottom Navigation */
.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: #fff;
    border-top: 1px solid #e5e7eb;
    z-index: 1000;
    padding: 8px 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.mobile-nav-container {
    display: flex;
    justify-content: space-around;
    align-items: center;
    max-width: 100%;
    padding: 0 8px;
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 8px 4px;
    text-decoration: none;
    color: #6b7280;
    transition: all 0.3s ease;
    min-width: 0;
    position: relative;
}

.mobile-nav-item:hover,
.mobile-nav-item:focus {
    color: #111827;
    text-decoration: none;
}


.mobile-nav-item i {
    color: #384152;
    margin-bottom: 4px;
}

.mobile-nav-item i:hover {
    color: #ff670f;
    margin-bottom: 4px;
}

.mobile-nav-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 4px;
    border: 2px solid #e5e7eb;
}

[data-bs-theme="dark"] .mobile-nav-avatar {
    border-color: #4b5563;
}

.mobile-nav-label {
    font-size: 10px;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

/* Profile Sidebar */
.profile-sidebar {
    width: 320px;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 15px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e5e7eb;
}

.profile-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-placeholder {
    width: 100%;
    height: 100%;
    background-color: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    font-size: 30px;
}

.profile-info h6 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.profile-info small {
    font-size: 13px;
}

.profile-menu-list {
    list-style: none;
    padding: 0;
    margin: 20px 0 0;
}

.profile-menu-item {
    margin-bottom: 8px;
}

.profile-menu-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    text-decoration: none;
    color: #374151;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.profile-menu-link:hover {
    background-color: #f3f4f6;
    color: #111827;
    text-decoration: none;
}

.profile-menu-link i {
    font-size: 20px;
    width: 24px;
    text-align: center;
    color: #6b7280;
}

.profile-menu-link span {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
}

.profile-menu-link .badge {
    font-size: 12px;
    padding: 4px 8px;
}

/* Adjust main content for sidebar */
@media (min-width: 992px) {

    /* Add padding to body to account for fixed sidebar */
    body {
        padding-left: 80px;
        transition: padding-left 0.3s ease;
        box-sizing: border-box;
    }

    /* Ensure all content is visible and properly positioned */
    header.wrapper,
    .content-wrapper,
    section,
    footer,
    .wrapper,
    main {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box;
    }

    /* Ensure containers are full width within adjusted body */
    .container {
        max-width: 100%;
        margin-left: auto;
        margin-right: auto;
        padding-left: 15px;
        padding-right: 15px;
    }

    /* Fix for navbar positioning */
    .navbar {
        margin-left: 0;
    }

    /* Ensure fixed elements don't overlap */
    .fixed-icon,
    .progress-wrap {
        right: 30px;
        left: auto;
    }

    /* Ensure all sections and content areas are visible */
    section.deeplink_wrapper,
    section.mt-3,
    section.slider,
    .wrapper.bg-soft-primary,
    .wrapper.bg-light {
        margin-left: 0;
        width: 100%;
    }
}

/* Dark Theme Styles */
[data-bs-theme="dark"] .sidebar-nav {
    background-color: #131829;
    border-right-color: #495057;
}

[data-bs-theme="dark"] .sidebar-nav-link {
    color: #9ca3af;
}

[data-bs-theme="dark"] .sidebar-nav-link:hover {
    color: #ff670f;
}


[data-bs-theme="dark"] .sidebar-nav-link.active i,
[data-bs-theme="dark"] .sidebar-nav-link.active .sidebar-nav-label {
    color: #fff;
}

[data-bs-theme="dark"] .mobile-bottom-nav {
    background-color: #121828;
    border-top-color: #4b5563;
}

[data-bs-theme="dark"] .mobile-nav-item {
    color: #9ca3af;
}

[data-bs-theme="dark"] .mobile-nav-item:hover,
[data-bs-theme="dark"] .mobile-nav-item:focus {
    color: #fff;
}


[data-bs-theme="dark"] .profile-sidebar {
    background-color: #374151 !important;
    color: #adb5bd !important;
}

[data-bs-theme="dark"] .profile-sidebar .offcanvas-header {
    background-color: #374151 !important;
    border-bottom: 1px solid #4b5563 !important;
}

[data-bs-theme="dark"] .profile-sidebar .offcanvas-title {
    color: #fff !important;
}

[data-bs-theme="dark"] .profile-sidebar .btn-close {
    filter: invert(1);
}

[data-bs-theme="dark"] .profile-header {
    border-bottom-color: #4b5563 !important;
}

[data-bs-theme="dark"] .profile-info h6 {
    color: #fff !important;
}

[data-bs-theme="dark"] .profile-info small {
    color: #9ca3af !important;
}

[data-bs-theme="dark"] .profile-menu-link {
    color: #adb5bd !important;
}

[data-bs-theme="dark"] .profile-menu-link:hover {
    background-color: #4b5563 !important;
    color: #fff !important;
}

[data-bs-theme="dark"] .profile-menu-link i {
    color: #9ca3af !important;
}

[data-bs-theme="dark"] .profile-menu-link:hover i {
    color: #fff !important;
}

[data-bs-theme="dark"] .avatar-placeholder {
    background-color: #4b5563 !important;
    color: #9ca3af !important;
}

[data-bs-theme="dark"] .profile-sidebar .offcanvas-body {
    background-color: #374151 !important;
}

[data-bs-theme="dark"] .profile-sidebar .text-center {
    color: #adb5bd !important;
}

[data-bs-theme="dark"] .profile-sidebar .text-center p {
    color: #adb5bd !important;
}

[data-bs-theme="dark"] .profile-sidebar .btn-primary {
    background-color: #3b82f6 !important;
    border-color: #3b82f6 !important;
    color: #fff !important;
}

[data-bs-theme="dark"] .profile-sidebar .text-center {
    color: #adb5bd !important;
}

[data-bs-theme="dark"] .profile-sidebar .btn-primary {
    background-color: #3b82f6 !important;
    border-color: #3b82f6 !important;
}

/* Responsive adjustments */
@media (max-width: 991.98px) {
    .sidebar-nav {
        display: none !important;
    }

    /* Remove left padding on mobile */
    /* Ensure clean footer spacing - removed redundant body/footer spacing here as it's managed by view classes */
    body {
        padding-left: 0 !important;
    }
}

/* Profile toggle button in header */
.profile-toggle-btn img {
    width: 32px;
    height: 32px;
    object-fit: cover;
    border: 2px solid #e5e7eb;
    transition: border-color 0.3s ease;
}

.profile-toggle-btn:hover img {
    border-color: #ff670f;
}

[data-bs-theme="dark"] .profile-toggle-btn img {
    border-color: #4b5563;
}

[data-bs-theme="dark"] .profile-toggle-btn:hover img {
    border-color: #ff670f;
}

.offcanvas-body {
    background-color: #ffffff !important;
}

.offcanvas-header {
    background-color: #ffffff !important;
    border-bottom: none !important;
}

[data-bs-theme="dark"] .sidebar-nav {
    background: linear-gradient(90deg, #0f172a, #020617);
    transition: border-bottom-color 0.3s ease, box-shadow 0.3s ease;
}

[data-bs-theme="dark"] .sidebar-nav:hover {
    border-bottom-color: #f37a00;
    box-shadow: 0 12px 12px rgb(223, 127, 11);
}

.sidebar-nav {
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    transition: border-bottom-color 0.3s ease, box-shadow 0.3s ease;
}

.sidebar-nav:hover {
    border-bottom-color: #464544;
    box-shadow: 0 4px 8px rgb(78, 77, 76);
}

.sidebar-nav-label:hover {
    color: #f37a00 !important;
}


[data-bs-theme="dark"] .mobile-nav-item i {
    color: #d1d5db;
    margin-bottom: 4px;
}

[data-bs-theme="dark"] .mobile-nav-item i:hover {
    color: #ff670f;
    margin-bottom: 4px;
}

.sidebar,
[data-bs-theme="dark"] .sidebar {
    z-index: 1000 !important;
}

.profile-offcanvas:hover {
    color: #d3221e !important;
}

/* FIX: Ensure sidebars maintain background and position during transitions, 
   overriding Bootstrap's navbar-expand rules which force transparency on desktop. */
.offcanvas.profile-sidebar,
.offcanvas.filter-sidebar,
.offcanvas#offcanvas-cart {
    background-color: #ffffff !important;
    position: fixed !important;
    display: flex !important;
}

/* Maintain background in dark mode */
[data-bs-theme="dark"] .offcanvas.profile-sidebar,
[data-bs-theme="dark"] .offcanvas.filter-sidebar,
[data-bs-theme="dark"] .offcanvas#offcanvas-cart {
    background-color: #374151 !important;
}

/* Ensure they are visible during transitions. 
   We explicitly target state with .show and .hiding. */
.offcanvas.profile-sidebar.show,
.offcanvas.filter-sidebar.show,
.offcanvas#offcanvas-cart.show,
.offcanvas.profile-sidebar.hiding,
.offcanvas.filter-sidebar.hiding,
.offcanvas#offcanvas-cart.hiding {
    visibility: visible !important;
}

/* Scrollbar Styles for All Sidebars */
/* Profile Sidebar - Proper scroll with fixed bottom buttons */
.profile-sidebar .offcanvas-body {
    display: flex !important;
    flex-direction: column !important;
    height: 100vh !important;
    overflow: hidden !important;
}

.profile-sidebar .flex-grow-1 {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    flex: 1 1 auto !important;
    max-height: calc(100vh - 180px) !important;
    /* Account for dark mode toggle and close button */
}

/* Profile sidebar bottom sections - fixed at bottom */
.profile-sidebar .border-top {
    flex-shrink: 0 !important;
    position: sticky !important;
    bottom: 60px !important;
    background-color: #ffffff !important;
    z-index: 10 !important;
}

.profile-sidebar .p-3:last-child {
    flex-shrink: 0 !important;
    position: sticky !important;
    bottom: 0 !important;
    background-color: #ffffff !important;
    z-index: 10 !important;
}

[data-bs-theme="dark"] .profile-sidebar .border-top,
[data-bs-theme="dark"] .profile-sidebar .p-3:last-child {
    background-color: #374151 !important;
}

/* Filter Sidebar - Proper scroll with fixed bottom buttons */
.filter-sidebar .offcanvas-body {
    display: flex !important;
    flex-direction: column !important;
    height: 100vh !important;
    overflow: hidden !important;
}

.filter-sidebar .flex-grow-1 {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    flex: 1 1 auto !important;
    max-height: calc(100vh - 200px) !important;
    /* Account for header and bottom buttons */
}

/* Filter sidebar bottom section - fixed at bottom */
.filter-sidebar .p-3.border-top {
    flex-shrink: 0 !important;
    position: sticky !important;
    bottom: 0 !important;
    background-color: #ffffff !important;
    z-index: 10 !important;
}

[data-bs-theme="dark"] .filter-sidebar .p-3.border-top {
    background-color: #374151 !important;
}

/* Cart Sidebar - Proper scroll with fixed bottom buttons */
#offcanvas-cart .offcanvas-body {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    flex: 1 1 auto !important;
    max-height: calc(100vh - 180px) !important;
    /* Account for header and footer */
}

#offcanvas-cart .offcanvas-footer {
    flex-shrink: 0 !important;
    position: sticky !important;
    bottom: 0 !important;
    background-color: #ffffff !important;
    z-index: 10 !important;
}

[data-bs-theme="dark"] #offcanvas-cart .offcanvas-footer {
    background-color: #374151 !important;
}

/* Custom Scrollbar Styling for All Sidebars */
.profile-sidebar .flex-grow-1::-webkit-scrollbar,
.filter-sidebar .flex-grow-1::-webkit-scrollbar,
#offcanvas-cart .offcanvas-body::-webkit-scrollbar {
    width: 6px;
}

.profile-sidebar .flex-grow-1::-webkit-scrollbar-track,
.filter-sidebar .flex-grow-1::-webkit-scrollbar-track,
#offcanvas-cart .offcanvas-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.profile-sidebar .flex-grow-1::-webkit-scrollbar-thumb,
.filter-sidebar .flex-grow-1::-webkit-scrollbar-thumb,
#offcanvas-cart .offcanvas-body::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

.profile-sidebar .flex-grow-1::-webkit-scrollbar-thumb:hover,
.filter-sidebar .flex-grow-1::-webkit-scrollbar-thumb:hover,
#offcanvas-cart .offcanvas-body::-webkit-scrollbar-thumb:hover {
    background: #ff670f;
}

/* Dark Theme Scrollbar */
[data-bs-theme="dark"] .profile-sidebar .flex-grow-1::-webkit-scrollbar-track,
[data-bs-theme="dark"] .filter-sidebar .flex-grow-1::-webkit-scrollbar-track,
[data-bs-theme="dark"] #offcanvas-cart .offcanvas-body::-webkit-scrollbar-track {
    background: #2d3748;
}

[data-bs-theme="dark"] .profile-sidebar .flex-grow-1::-webkit-scrollbar-thumb,
[data-bs-theme="dark"] .filter-sidebar .flex-grow-1::-webkit-scrollbar-thumb,
[data-bs-theme="dark"] #offcanvas-cart .offcanvas-body::-webkit-scrollbar-thumb {
    background: #4a5568;
}

[data-bs-theme="dark"] .profile-sidebar .flex-grow-1::-webkit-scrollbar-thumb:hover,
[data-bs-theme="dark"] .filter-sidebar .flex-grow-1::-webkit-scrollbar-thumb:hover,
[data-bs-theme="dark"] #offcanvas-cart .offcanvas-body::-webkit-scrollbar-thumb:hover {
    background: #ff670f;
}

/* Firefox Scrollbar */
.profile-sidebar .flex-grow-1,
.filter-sidebar .flex-grow-1,
#offcanvas-cart .offcanvas-body {
    scrollbar-width: thin;
    scrollbar-color: #888 #f1f1f1;
}

[data-bs-theme="dark"] .profile-sidebar .flex-grow-1,
[data-bs-theme="dark"] .filter-sidebar .flex-grow-1,
[data-bs-theme="dark"] #offcanvas-cart .offcanvas-body {
    scrollbar-color: #4a5568 #2d3748;
}