/* File: wp-content/plugins/vivaia-pos/assets/css/global-sidebar.css */
/* Description: Global sidebar styles for VIVAIA POS frontend pages */
/* Version: 1.1.0 */

/* Ensure viewport constraints */
html, body {
    width: 100%;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
}

/* Sidebar styles */
#sidebar {
    background-color: #1f2937; /* Gray-800 */
    color: #ffffff; /* White text */
    transition: transform 0.3s ease-in-out;
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    z-index: 950; /* Below toggle, above popups */
}

@media (max-width: 640px) {
    #sidebar.active {
        z-index: 1001; /* Higher than #staff-scan-popup's z-index of 1000 */
    }
}

/* Navigation menu styles */
#sidebar a, #sidebar ul li a, #sidebar nav a {
    color: #ffffff !important; /* White text */
    transition: background-color 0.3s ease, color 0.3s ease;
    text-decoration: none;
    display: block;
    padding: 0.5rem 1rem;
}

#sidebar a:hover, #sidebar ul li a:hover, #sidebar nav a:hover {
    background-color: #374151; /* Gray-700 */
    color: #ffffff !important;
}

#sidebar a:focus, #sidebar ul li a:focus, #sidebar nav a:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3); /* White focus ring */
}

/* Highlighted (active) menu item */
#sidebar a.bg-gray-700 {
    background-color: #374151; /* Gray-700 */
    color: #ffffff !important;
}

/* Main content adjustments */
#main-content {
    flex: 1;
    padding: 1.5rem;
    position: relative;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
}

/* Hamburger toggle styling */
#toggle-sidebar, #desktop-toggle-sidebar {
    padding: 0.5rem;
    margin-bottom: 1rem; /* Match mb-4 */
    color: #374151; /* Gray-700 */
    background: none;
    border: none;
    cursor: pointer;
    z-index: 1000; /* Above sidebar */
    position: relative; /* Flow context */
}

#toggle-sidebar svg, #desktop-toggle-sidebar svg {
    width: 1.5rem;
    height: 1.5rem;
}

#toggle-sidebar:focus, #desktop-toggle-sidebar:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.3); /* Focus ring */
}

/* Responsive sidebar for mobile and tablet */
@media (max-width: 768px) {
    #sidebar {
        display: none;
        width: 100%; /* Full-width on mobile */
        transform: translateX(-100%);
    }
    #sidebar.active {
        display: block;
        transform: translateX(0);
    }
    #main-content {
        margin-left: 0 !important;
        padding: 1rem;
        max-width: 100%;
        overflow-x: hidden;
    }
    #toggle-sidebar {
        display: block;
    }
    #desktop-toggle-sidebar {
        display: none;
    }
}

/* Desktop and larger */
@media (min-width: 769px) {
    #toggle-sidebar {
        display: none;
    }
    #desktop-toggle-sidebar {
        display: block;
    }
    #sidebar {
        width: 16rem; /* Fixed width for desktop */
        display: block;
    }
    #sidebar.hidden {
        display: none;
    }
    #main-content {
        margin-left: 16rem; /* Match sidebar width */
        transition: margin-left 0.3s ease-in-out;
    }
    #main-content.sidebar-hidden {
        margin-left: 0;
    }
}

/* Ensure popups don't block toggle */
#popup-overlay {
    z-index: 900;
}

#transfer-request-popup, #mark-status-popup {
    z-index: 910;
    width: 90%;
    max-width: 400px;
}