/* Additional Mobile Navigation Fixes */

/* Fix for logo responsiveness */
@media (max-width: 767px) {
    .navbar-header {
        min-height: 72px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding-right: 12px;
    }

    .navbar-brand {
        max-width: calc(100% - 70px); /* Account for toggle button */
        height: 72px;
        padding: 6px 15px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        display: flex;
        align-items: center;
    }
    
    .navbar-brand img {
        max-width: 100% !important;
        height: 100% !important;
        max-height: 60px !important;
        width: auto !important;
        object-fit: contain;
    }

    .navbar-toggle {
        order: 2;
        margin-left: auto;
        float: right !important;
        margin-top: 19px;
        margin-bottom: 19px;
    }
}

/* Prevent horizontal scroll on mobile */
body, html {
    overflow-x: hidden;
}

/* Ensure sidebar doesn't create horizontal scroll */
@media (max-width: 767px) {
    .sidebar {
        max-width: 100%;
        left: 0;
        right: 0;
    }
    
    /* Fix for very long menu items */
    .sidebar ul li a {
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
    }
    
    /* Ensure dropdowns work properly on mobile */
    .sidebar .nav-second-level {
        position: relative;
        width: 100%;
    }
    
    /* Remove any borders or outlines that create separation */
    .sidebar ul li {
        border-bottom: 1px solid #e7e7e7;
        border-left: none;
        border-right: none;
        border-top: none;
    }
    
    .sidebar ul li:first-child {
        border-top: none;
    }
    
    .sidebar ul li:last-child {
        border-bottom: none;
    }
}

@media (max-width: 480px) {
    .navbar-header {
        min-height: 68px;
    }

    .navbar-brand {
        height: 68px;
        padding: 6px 12px;
        max-width: calc(100% - 64px);
    }

    .navbar-brand img {
        max-height: 56px !important;
    }

    .navbar-toggle {
        margin-left: auto;
        float: right !important;
        margin-top: 17px;
        margin-bottom: 17px;
        margin-right: 4px;
    }
}

/* Fix for touch devices */
@media (hover: none) and (pointer: coarse) {
    .sidebar ul li a:hover {
        background-color: transparent;
        padding-left: 15px;
    }
    
    .sidebar ul li a:active,
    .sidebar ul li a:focus {
        background-color: #e7e7e7;
        outline: none;
    }
}
