/**
 * EventPOS - Modern Sidebar Styling
 * Professional navigation menu with #3b7db5 primary color
 */

/* ==================== CSS Variables ==================== */
:root {
    --sidebar-bg: #1a202c;
    --sidebar-border: #2d3748;
    --sidebar-hover: #2d3748;
    --sidebar-active: #3b7db5;
    --sidebar-text: #cbd5e0;
    --sidebar-text-hover: #ffffff;
    --sidebar-icon: #718096;
    --sidebar-submenu-bg: #161b26;
    --topbar-bg: #ffffff;
    --topbar-border: #e2e8f0;
}

/* ==================== Reset Bootstrap Navbar Styles ==================== */
.navbar-default .navbar-brand {
    color: #111827 !important;
}

.navbar-default .navbar-brand:hover,
.navbar-default .navbar-brand:focus {
    color: #3b7db5 !important;
    background-color: transparent !important;
}

.navbar-default .navbar-text {
    color: #6b7280 !important;
}

.navbar-default .navbar-nav > li > a {
    color: #6b7280 !important;
}

.navbar-default .navbar-nav > li > a:hover,
.navbar-default .navbar-nav > li > a:focus {
    color: #111827 !important;
    background-color: transparent !important;
}

/* Ensure no Bootstrap gradients or backgrounds */
.navbar-default,
.navbar-fixed-top,
.navbar {
    filter: none !important;
    background-image: none !important;
}

/* Subtle divider line under navbar */
.navbar-fixed-top::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(to right,
        transparent 0%,
        rgba(229, 231, 235, 0.5) 15%,
        rgba(229, 231, 235, 1) 50%,
        rgba(229, 231, 235, 0.5) 85%,
        transparent 100%);
}

/* ==================== Typography ==================== */
/* ==================== Top Navigation Bar ==================== */
.navbar-fixed-top {
    background: #ffffff !important;
    background-color: #ffffff !important;
    background-image: none !important;
    border: none !important;
    border-bottom: 1px solid #e5e7eb !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
    min-height: 64px !important;
    height: 64px !important;
    backdrop-filter: blur(10px);
}

.navbar-default {
    background: #ffffff !important;
    background-color: #ffffff !important;
    background-image: none !important;
    border: none !important;
    border-bottom: 1px solid #e5e7eb !important;
}

.top-bar {
    height: 64px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 0 2rem !important;
    background: #ffffff !important;
}

.navbar-header {
    float: none !important;
    display: flex !important;
    align-items: center !important;
}

.navbar-brand {
    font-family: 'Outfit', sans-serif !important;
    font-size: 1.5rem !important;
    font-weight: 600 !important;
    color: #111827 !important;
    padding: 0 !important;
    margin: 0 !important;
    letter-spacing: -0.3px;
    line-height: 64px !important;
    height: auto !important;
    display: inline-block !important;
    transition: all 0.2s ease;
    position: relative;
}

.navbar-brand:hover {
    color: #3b7db5 !important;
}

.navbar-brand:focus {
    color: #111827 !important;
}

.navbar-right {
    float: none !important;
    display: flex !important;
    align-items: center !important;
    gap: 0;
    margin: 0 !important;
}

.navbar-text {
    padding: 0 !important;
    margin: 0 !important;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem;
    color: #1a202c !important;
}

.navbar-text a {
    color: #6b7280 !important;
    text-decoration: none !important;
    margin: 0 !important;
    transition: all 0.2s ease;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 0.875rem;
    border-radius: 7px;
    background: transparent;
    border: 1px solid transparent;
}

.navbar-text a:hover {
    color: #111827 !important;
    background: #f9fafb;
    border-color: #e5e7eb;
    text-decoration: none !important;
}

.navbar-text a:focus {
    color: #111827 !important;
    text-decoration: none !important;
}

.navbar-text i {
    color: #9ca3af;
    font-size: 0.95rem;
    transition: color 0.2s ease;
}

.navbar-text a:hover i {
    color: #3b7db5;
}

/* ==================== Sidebar Container ==================== */
.left-side {
    background: var(--sidebar-bg) !important;
    /* Fixed height (not min-height): a fixed element that grows with its
       content is clipped by the viewport and overflow-y never scrolls. */
    height: calc(100vh - 64px);
    min-height: 0; /* _base.scss sets min-height: 100%, which would force 100vh here */
    padding: 0 !important;
    border-right: 1px solid var(--sidebar-border);
    font-family: 'Inter', sans-serif;
    position: fixed;
    top: 64px;
    left: 0;
    width: 250px; /* Fixed width instead of percentage */
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 100;
}

/* Scrollbar styling for sidebar */
.left-side::-webkit-scrollbar {
    width: 6px;
}

.left-side::-webkit-scrollbar-track {
    background: var(--sidebar-bg);
}

.left-side::-webkit-scrollbar-thumb {
    background: var(--sidebar-border);
    border-radius: 3px;
}

.left-side::-webkit-scrollbar-thumb:hover {
    background: var(--sidebar-hover);
}

/* ==================== Main Content Area ==================== */
.right-side {
    margin-left: 250px !important; /* Match sidebar width */
    margin-top: 64px !important;
    padding: 2rem !important;
    min-height: calc(100vh - 64px);
    background: #f7fafc;
    width: calc(100% - 250px) !important;
}

/* ==================== Navigation Header ==================== */
.nav-header > a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    background: var(--sidebar-submenu-bg);
    border-bottom: 1px solid var(--sidebar-border);
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-header > a:hover {
    background: var(--sidebar-hover);
    text-decoration: none;
}

.nav-header h5 {
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    color: var(--sidebar-text-hover);
    margin: 0;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    flex: 1;
}

.nav-header h5 i {
    margin-left: 0.5rem;
    font-size: 0.875rem;
    transition: transform 0.3s ease;
    color: var(--sidebar-icon);
}

.nav-header > a[aria-expanded="true"] h5 i {
    transform: rotate(180deg);
}

/* ==================== Menu Items ==================== */
.left-side ul.list-unstyled {
    margin: 0;
    padding: 0;
}

.left-side ul.list-unstyled > li {
    margin: 0;
}

/* Main menu items */
#userMenu > li,
#menu3 > li {
    margin: 0;
}

#userMenu > li > a,
#menu3 > li > a {
    display: flex;
    align-items: center;
    padding: 0.875rem 1.5rem;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 1.05rem;
    font-weight: 500;
    border-left: 3px solid transparent;
}

#userMenu > li > a:hover,
#menu3 > li > a:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text-hover);
    border-left-color: var(--sidebar-active);
    padding-left: 1.75rem;
}

#userMenu > li.active > a,
#menu3 > li.active > a {
    background: var(--sidebar-hover);
    color: var(--sidebar-text-hover);
    border-left-color: var(--sidebar-active);
    font-weight: 600;
}

/* Icons in main menu */
#userMenu > li > a i,
#menu3 > li > a i {
    margin-right: 0.875rem;
    font-size: 1.125rem;
    width: 20px;
    text-align: center;
    color: var(--sidebar-icon);
    transition: color 0.2s ease;
}

#userMenu > li > a:hover i,
#menu3 > li > a:hover i,
#userMenu > li.active > a i,
#menu3 > li.active > a i {
    color: var(--sidebar-active);
}

/* ==================== Submenu Items ==================== */
#userMenu > li > ul,
#menu3 > li > ul {
    background: var(--sidebar-submenu-bg);
    border-left: 3px solid var(--sidebar-border);
    margin-left: 1.5rem;
    padding: 0.5rem 0;
}

#userMenu > li > ul > li > a,
#menu3 > li > ul > li > a {
    display: block;
    padding: 0.625rem 1.5rem 0.625rem 2.5rem;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 1.0rem;
    position: relative;
}

#userMenu > li > ul > li > a:before {
    content: '•';
    position: absolute;
    left: 1.75rem;
    color: var(--sidebar-icon);
    font-size: 1rem;
}

#userMenu > li > ul > li > a:hover,
#menu3 > li > ul > li > a:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text-hover);
    padding-left: 2.75rem;
}

#userMenu > li > ul > li > a:hover:before {
    color: var(--sidebar-active);
}

/* ==================== Collapse Animation ==================== */
.collapse {
    transition: height 0.3s ease;
}

.collapsing {
    transition: height 0.3s ease;
}

/* ==================== Breadcrumbs ==================== */
.breadcrumbs {
    background: white !important;
    padding: 0.875rem 1.5rem !important;
    border-radius: 8px !important;
    margin-bottom: 1.5rem !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
    font-family: 'Inter', sans-serif !important;
    font-size: 0.9rem !important;
    color: #6b7280 !important;
}

.breadcrumbs a {
    color: #3b7db5 !important;
    text-decoration: none !important;
    font-weight: 500 !important;
    transition: color 0.2s ease !important;
}

.breadcrumbs a:hover {
    color: #2a5a85 !important;
    text-decoration: underline !important;
}

.breadcrumbs a:visited {
    color: #3b7db5 !important;
}

.breadcrumbs a:focus {
    color: #2a5a85 !important;
}

/* ==================== Page Header ==================== */
.right-side h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 1.5rem;
    margin-top: 0;
}

/* ==================== Footer ==================== */
footer {
    background: white;
    border-top: 1px solid #e2e8f0;
    padding: 1.5rem 2rem;
    margin-top: 3rem;
    margin-left: 250px;
    width: calc(100% - 250px);
}

footer .footer {
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    color: #718096;
}

@media (max-width: 991px) {
    footer {
        margin-left: 220px;
        width: calc(100% - 220px);
    }
}

@media (max-width: 767px) {
    footer {
        margin-left: 0;
        width: 100%;
    }
}

/* ==================== Responsive Design ==================== */
@media (max-width: 991px) {
    .left-side {
        width: 220px;
        position: fixed;
    }

    .right-side {
        margin-left: 220px !important;
        width: calc(100% - 220px) !important;
    }

    #userMenu > li > a,
    #menu3 > li > a {
        font-size: 1.0rem;
        padding: 0.75rem 1.25rem;
    }
}

@media (max-width: 767px) {
    .left-side {
        position: fixed;
        left: -250px;
        width: 250px;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1000;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
    }

    .left-side.mobile-open {
        left: 0;
    }

    .right-side {
        margin-left: 0 !important;
        width: 100% !important;
    }

    .navbar-text {
        display: none;
    }

    /* Mobile menu toggle button */
    .mobile-menu-toggle {
        display: block !important;
        position: fixed;
        top: 11px;
        left: 15px;
        z-index: 1001;
        background: #111827;
        color: white;
        border: none;
        padding: 0;
        border-radius: 8px;
        cursor: pointer;
        font-size: 1.2rem;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
        transition: all 0.2s ease;
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .mobile-menu-toggle:hover {
        background: #1f2937;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    }

    .mobile-menu-toggle:active {
        transform: scale(0.95);
    }

    /* Mobile overlay */
    .mobile-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }

    .mobile-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    /* Adjust navbar brand position on mobile */
    .navbar-brand {
        margin-left: 55px !important;
        font-size: 1.4rem !important;
    }

    .top-bar {
        padding: 0 1rem !important;
    }
}

@media (min-width: 768px) {
    .mobile-menu-toggle {
        display: none !important;
    }
}

/* ==================== Additional Navbar Improvements ==================== */
/* Ensure navbar doesn't have Bootstrap's default styles */
.navbar {
    margin-bottom: 0 !important;
    border-radius: 0 !important;
}

.container-fluid {
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* Better spacing for navbar items */
.navbar-text span {
    display: inline-block;
}

/* Hide text labels on very small screens, keep only icons */
@media (max-width: 480px) {
    .navbar-text span {
        display: none;
    }

    .navbar-text a {
        padding: 0.5rem 0.625rem;
    }

    .navbar-brand {
        font-size: 1.25rem !important;
    }

    .navbar-text {
        gap: 0.25rem;
    }
}

/* Remove unnecessary after element */

/* Better focus states for accessibility */
.navbar-text a:focus-visible {
    outline: 2px solid #3b7db5;
    outline-offset: 2px;
    border-radius: 7px;
}

/* Additional Professional Touches */
.navbar-text a span {
    font-size: 0.9rem;
    letter-spacing: -0.01em;
}

/* Ensure perfect vertical alignment */
.navbar-header,
.navbar-right,
.navbar-text {
    height: 64px;
    display: flex;
    align-items: center;
}

/* Add separator between navbar links */
.navbar-text a + a {
    margin-left: 0.25rem;
}

.navbar-text a + a::before {
    content: '';
    display: inline-block;
    width: 1px;
    height: 16px;
    background: #e5e7eb;
    margin-right: 0.5rem;
    vertical-align: middle;
}

/* Remove any default Bootstrap backgrounds */
.navbar-default .navbar-collapse,
.navbar-default .navbar-form {
    border: none !important;
}

/* Smooth navbar reveal animation */
.navbar-fixed-top {
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-64px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Add subtle badge effect to navbar */
.navbar-text a {
    position: relative;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.navbar-text a:active {
    transform: scale(0.97);
}

/* ==================== Badges and Counters ==================== */
.badge {
    background: #3b7db5;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.5rem;
}

/* ==================== Active State Enhancement ==================== */
#userMenu > li.active {
    position: relative;
}

#userMenu > li.active:before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--sidebar-active);
    box-shadow: 0 0 10px rgba(59, 125, 181, 0.5);
}

/* ==================== Smooth Transitions ==================== */
* {
    transition-property: background-color, border-color, color, transform;
    transition-duration: 0.2s;
    transition-timing-function: ease;
}

/* ==================== Loading State ==================== */
.sidebar-loading {
    opacity: 0.6;
    pointer-events: none;
}

/* ==================== Visual Enhancements ==================== */
/* Glow effect on active item */
#userMenu > li.active > a {
    box-shadow: inset 3px 0 0 var(--sidebar-active),
                0 0 20px rgba(59, 125, 181, 0.15);
}

/* Smooth icon rotation on hover */
#userMenu > li > a i,
#menu3 > li > a i {
    transition: transform 0.3s ease, color 0.2s ease;
}

#userMenu > li > a:hover i,
#menu3 > li > a:hover i {
    transform: scale(1.1);
}

/* Pulse animation for badges */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

.badge {
    animation: pulse 2s ease-in-out infinite;
}

/* Subtle gradient on hover */
#userMenu > li > a:hover,
#menu3 > li > a:hover {
    background: linear-gradient(90deg, var(--sidebar-hover) 0%, rgba(59, 125, 181, 0.05) 100%);
}

/* Smooth submenu expansion */
#userMenu > li > ul,
#menu3 > li > ul {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, padding 0.3s ease-out;
}

#userMenu > li > ul {
    max-height: 500px; /* Large enough to show all items */
}

/* Focus visible for keyboard navigation */
.left-side a:focus-visible {
    outline: 2px solid var(--sidebar-active);
    outline-offset: -2px;
}

/* Brand logo animation on hover */
.navbar-brand {
    position: relative;
    overflow: hidden;
}

.navbar-brand:before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--sidebar-active);
    transition: width 0.3s ease;
}

.navbar-brand:hover:before {
    width: 100%;
}

/* Separator line between sections */
.nav-header + .nav-header {
    margin-top: 1rem;
    border-top: 1px solid var(--sidebar-border);
    padding-top: 0;
}

/* Improve scrollbar appearance */
.left-side::-webkit-scrollbar-thumb:active {
    background: var(--sidebar-active);
}

/* Add subtle shadow to navbar */
.navbar-fixed-top:after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(to bottom, rgba(59, 125, 181, 0.1), transparent);
}

/* Icon animation for collapsible sections */
.nav-header > a h5 i.fa-chevron-down {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-header > a[aria-expanded="false"] h5 i.fa-chevron-down {
    transform: rotate(-90deg);
}

/* Hover effect for submenu items */
#userMenu > li > ul > li > a:before {
    transition: all 0.2s ease;
}

#userMenu > li > ul > li > a:hover:before {
    transform: scale(1.3);
    left: 1.5rem;
}
