/* Menu CSS */

/* Navbar Container */
.navbar {
    padding-top: 15px;
    padding-bottom: 15px;
    font-family: 'Kanit', sans-serif; /* Assuming Kanit based on app.blade.php */
}

.navbar-brand img {
    max-height: 50px; /* Adjust based on logo size */
}

/* Menu Links */
.navbar-nav .nav-link.menu-color {
    font-weight: 400;
    font-size: 16px;
    padding-right: 10px !important;
    transition: color 0.3s ease;
}
@media (max-width: 1400px) {
    .navbar-nav .nav-link.menu-color {
        padding-right: 5px !important;
    }
}
@media (max-width: 1200px) {
    .navbar-nav .nav-link.menu-color {
        padding-right: 3px !important;
    }
}
.navbar-nav .nav-link.menu-color:hover,
.navbar-nav .nav-link.menu-color:focus,
.navbar-nav .nav-link.menu-color.active {
    color: #F37124 !important;
}

/* Dropdown styling */
.dropdown-menu {
    border: none;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    padding: 10px;
    margin-top: 15px !important; /* Gap between nav and dropdown */
}

.dropdown-item {
    padding: 20px 5px;
    color: #333;
    border-radius: 10px;
    transition: all 0.3s ease; /* Animate padding */
    display: flex;
    align-items: center;
    justify-content: flex-start;
    position: relative;
}

.dropdown-item:hover {
    background-color: transparent !important;
    color: #F37124;
    padding-left: 35px; /* Shift text on hover */
}

.dropdown-item::before {
    content: "\f061";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%) translateX(-10px);
}

.dropdown-item:hover::before {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(0);
}

.dropdown-item i.fa-arrow-right {
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.dropdown-item:hover i.fa-arrow-right {
    opacity: 1;
}

/* Mega Menu adjustments */
.mega-menu {
    width: 600px; /* Adjust as needed */
    left: 50%;
    transform: translateX(-50%);
}

/* Right Side Icons */
.bg-light.rounded-pill {
    background-color: #fff !important;
    border: 1px solid #e0e0e0 !important;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.fa-search, .fa-folder-open, .fa-user-circle {
    color: #333 !important;
    transition: color 0.3s ease;
}

.bg-light.rounded-pill a:hover i,
.bg-light.rounded-pill div:hover > i {
    color: #F37124 !important;
}

/* Mobile Menu Adjustments */
@media (max-width: 991px) {
    .navbar-collapse {
        position: absolute;
        top: 100%;
        right: 0;
        width: 300px; /* Adjust width as needed */
        background: #fff;
        padding: 20px;
        border-radius: 15px;
        box-shadow: 0 10px 30px rgba(0,0,0,0.1);
        margin-top: 10px;
        z-index: 1000;
        max-height: 80vh; /* Prevent overflow on small screens */
        overflow-y: auto;
    }
    
    .mega-menu {
        width: 100%;
        left: 0;
        transform: none;
        margin-left: 0 !important;
        box-shadow: none;
        border-top: none !important;
        padding-left: 20px;
    }

    /* Ensure dropdowns inside mobile menu behave correctly */
    .navbar-nav .dropdown-menu {
        position: static !important;
        float: none;
        width: auto;
        margin-top: 0;
        background-color: transparent;
        border: 0;
        box-shadow: none;
        padding-left: 20px;
    }
    
    .dropdown-menu.show {
        display: block;
    }
}

/* Hover support for desktop */
/* Hover support for desktop */
@media (min-width: 992px) {
    .navbar-nav .dropdown:hover > .dropdown-menu {
        display: block;
        margin-top: 0 !important; /* Remove large gap to prevent closing */
        padding-top: 10px; /* Add padding inside to maintain visual spacing if needed, or just rely on shadow/border */
    }
}

/* Nested Dropdown Styling */
.dropdown-submenu {
    position: relative;
}

/* Ensure nested menu is hidden by default with high specificity */
.dropdown-submenu > .dropdown-menu {
    top: 0;
    left: 100%;
    margin-top: 5px; /* Align with top border */
    margin-left: 0;
    display: none !important; /* Force hidden by default */
    position: absolute;
    /* border-radius removed to match main dropdown (rounded-0) */
    border: none;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    padding: 10px;
    border-top: 5px solid #F37124!important;
    min-width: 200px;
}

/* Only show on hover of the submenu parent */
.dropdown-submenu:hover > .dropdown-menu {
    display: block !important; /* Force show on hover */
}

/* Ensure submenu arrow points right */
.dropdown-submenu > .dropdown-item::after {
    content: "\f054"; /* FontAwesome chevron-right */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    opacity: 1; /* Always visible for submenu parent */
    visibility: visible;
}

/* Fix font size in mobile menu dropdowns */
@media (max-width: 991px) {
    .navbar-nav .dropdown-item {
        font-size: 16px !important;
    }
}

/* Fix User Dropdown Popup on Mobile */
@media (max-width: 576px) {
    .dropdown-menu[aria-labelledby="userDropdown"] {
        width: 300px !important;
        max-width: 90vw !important;
        position: fixed !important;
        top: 20% !important; /* Position it visibly on screen */
        left: 50% !important;
        transform: translateX(-50%) !important;
        right: auto !important;
        z-index: 9999 !important;
        box-shadow: 0 0 50px rgba(0,0,0,0.5) !important; /* Make it pop */
    }
}
