/* =================================================================
   Mobile-First App-Like Header Styles
   ================================================================= */

/* Prevent body scroll when mobile menu is open */
body.menu-open {
    overflow: hidden;
}

body.menu-open .header {
    box-shadow: none;
}

/* Mobile Header Improvements */
@media (max-width: 991px) {
    /* Sticky header for mobile */
    .header {
        position: sticky;
        top: 0;
        z-index: 1000;
        background: #ffffff;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        padding: 0.75rem 0;
        transition: transform 0.3s ease, box-shadow 0.3s ease;
    }

    /* Optional: Hide header on scroll down (uncomment if desired)
    .header.header-hidden {
        transform: translateY(-100%);
    }
    */

    /* Logo adjustments */
    .header .logo {
        display: inline-block;
        max-width: 120px;
        height: auto;
    }

    .header .logo img {
        max-height: 35px;
        width: auto;
    }

    /* Hamburger button styling */
    .header .navbar-toggler {
        border: none;
        padding: 0.5rem;
        font-size: 1.5rem;
        color: #333;
        background: transparent;
        border-radius: 0.5rem;
        transition: background-color 0.2s ease;
    }

    .header .navbar-toggler:focus {
        outline: none;
        box-shadow: none;
    }

    .header .navbar-toggler:hover {
        background-color: #f3f4f6;
    }

    /* Mobile navigation menu */
    .header .navbar-collapse {
        position: fixed;
        top: 0;
        right: -100%;
        width: 85%;
        max-width: 320px;
        height: 100vh;
        background: #ffffff;
        box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
        transition: right 0.3s ease-in-out;
        overflow-y: auto;
        padding: 1.5rem 0;
        z-index: 1050;
    }

    .header .navbar-collapse.show {
        right: 0;
    }

    /* Backdrop overlay */
    .header .navbar-collapse.show::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: -1;
        animation: fadeIn 0.3s ease;
    }

    @keyframes fadeIn {
        from { opacity: 0; }
        to { opacity: 1; }
    }

    /* Mobile nav items */
    .header .navbar-nav {
        flex-direction: column;
        width: 100%;
        margin: 0;
        padding: 0;
    }

    .header .navbar-nav .nav-item {
        width: 100%;
        border-bottom: 1px solid #f3f4f6;
    }

    .header .navbar-nav .nav-link {
        padding: 1rem 1.5rem;
        font-size: 1rem;
        color: #374151;
        display: flex;
        align-items: center;
        justify-content: space-between;
        transition: background-color 0.2s ease;
    }

    .header .navbar-nav .nav-link:hover,
    .header .navbar-nav .nav-link:active {
        background-color: #f9fafb;
        color: #3b82f6;
    }

    /* User dropdown in mobile */
    .header .userbtn {
        position: relative;
    }

    .header .userbtn > a {
        display: flex;
        align-items: center;
        padding: 1rem 1.5rem;
    }

    .header .userbtn .dropdown-menu {
        position: static;
        display: none;
        width: 100%;
        border: none;
        box-shadow: none;
        margin: 0;
        padding: 0;
        background: #f9fafb;
    }

    .header .userbtn .dropdown-menu .nav-item {
        border-bottom: 1px solid #e5e7eb;
    }

    .header .userbtn .dropdown-menu .nav-link {
        padding-left: 2.5rem;
        font-size: 0.9375rem;
    }

    .header .userbtn .dropdown-menu .nav-link i {
        margin-right: 0.75rem;
        width: 20px;
        text-align: center;
    }

    /* Primary action buttons */
    .header .nav-item.postjob .nav-link,
    .header .nav-item .nav-link.register {
        background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
        color: #ffffff !important;
        border-radius: 0.5rem;
        margin: 0.5rem 1rem;
        padding: 0.875rem 1.5rem;
        font-weight: 600;
        text-align: center;
        box-shadow: 0 4px 6px rgba(59, 130, 246, 0.2);
    }

    .header .nav-item.postjob .nav-link:hover,
    .header .nav-item .nav-link.register:hover {
        background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
        transform: translateY(-1px);
        box-shadow: 0 6px 8px rgba(59, 130, 246, 0.3);
    }

    /* Hide desktop-only elements */
    .header .container-fluid {
        padding: 0 1rem;
    }
}

/* =================================================================
   Bottom Navigation Bar (Mobile App Style)
   ================================================================= */

@media (max-width: 991px) {
    /* Bottom nav bar */
    .mobile-bottom-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: #ffffff;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
        z-index: 1000;
        padding: 0.5rem 0;
        display: flex;
        justify-content: space-around;
        align-items: center;
    }

    .mobile-bottom-nav .nav-item {
        flex: 1;
        text-align: center;
        padding: 0.5rem 0;
    }

    .mobile-bottom-nav .nav-link {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        color: #6b7280;
        text-decoration: none;
        font-size: 0.75rem;
        transition: color 0.2s ease;
        padding: 0.25rem;
    }

    .mobile-bottom-nav .nav-link i {
        font-size: 1.5rem;
        margin-bottom: 0.25rem;
    }

    .mobile-bottom-nav .nav-link.active,
    .mobile-bottom-nav .nav-link:hover {
        color: #3b82f6;
    }

    /* Add padding to content to account for fixed bottom nav */
    body {
        padding-bottom: 70px;
    }

    /* User avatar in bottom nav */
    .mobile-bottom-nav .user-avatar {
        width: 28px;
        height: 28px;
        border-radius: 50%;
        object-fit: cover;
        border: 2px solid #e5e7eb;
    }

    .mobile-bottom-nav .nav-link.active .user-avatar {
        border-color: #3b82f6;
    }
}

/* =================================================================
   Tablet and Desktop Improvements
   ================================================================= */

@media (min-width: 992px) {
    .header {
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }

    /* Hide mobile-only elements on desktop */
    .mobile-bottom-nav {
        display: none;
    }

    /* Desktop nav improvements */
    .header .navbar-nav .nav-link {
        padding: 0.75rem 1rem;
        transition: color 0.2s ease;
    }

    .header .navbar-nav .nav-link:hover {
        color: #3b82f6;
    }
}

/* =================================================================
   Close button for mobile menu
   ================================================================= */

@media (max-width: 991px) {
    .mobile-menu-close {
        position: absolute;
        top: 1rem;
        right: 1rem;
        background: transparent;
        border: none;
        font-size: 1.5rem;
        color: #6b7280;
        padding: 0.5rem;
        cursor: pointer;
        z-index: 10;
    }

    .mobile-menu-close:hover {
        color: #374151;
    }

    .mobile-menu-header {
        padding: 1rem 1.5rem;
        border-bottom: 1px solid #e5e7eb;
        margin-bottom: 0.5rem;
    }

    .mobile-menu-header h3 {
        margin: 0;
        font-size: 1.125rem;
        color: #111827;
        font-weight: 600;
    }
}

/* =================================================================
   Smooth Scrolling and Performance
   ================================================================= */

.header,
.mobile-bottom-nav {
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}
