/* Navbar Component Styles */

/* Pre-auth state to prevent flash of incorrect content */
body.pre-auth #authLinks,
body.pre-auth #userProfile,
body.pre-auth #authLinksMobile,
body.pre-auth #userProfileMobile {
    visibility: hidden;
}

/* Free badge small size */
.free-badge-small {
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
}

/* Navbar visibility control */
#authLinks {
    display: flex;
}

#userProfile {
    display: none;
}

#authLinksMobile {
    display: block;
}

#userProfileMobile {
    display: none;
}

/* Ensure Bootstrap d-none class takes precedence */
#authLinksMobile.d-none {
    display: none !important;
}

#userProfileMobile.d-none {
    display: none !important;
}

/* Force visibility control for sidebar elements */
#authLinksMobile {
    display: block !important;
}

#userProfileMobile {
    display: none !important;
}

/* Override when logged in */
body.logged-in #authLinksMobile {
    display: none !important;
}

body.logged-in #userProfileMobile {
    display: block !important;
}

/* Ensure desktop navbar switches reliably when logged in */
body.logged-in #authLinks {
    display: none !important;
}

body.logged-in #userProfile {
    display: flex !important;
}

/* Sign up button styling - Green like Generate Test Scenarios */
#signupLink {
    background: #198754 !important;
    color: white !important;
    border-radius: 8px;
    padding: 8px 16px !important;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 2px solid #198754;
}

#signupLink:hover {
    background: #157347 !important;
    border-color: #157347;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(21, 115, 71, 0.3);
}

#signupLinkMobile {
    background: #198754 !important;
    color: white !important;
    border-radius: 8px;
    padding: 12px 16px !important;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 2px solid #198754;
    display: block;
    text-align: center;
    margin-top: 8px;
}

#signupLinkMobile:hover {
    background: #157347 !important;
    border-color: #157347;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(21, 115, 71, 0.3);
    color: white !important;
}

/* Login button styles: white with black outline */
#loginLink {
    background: #ffffff !important;
    color: #000000 !important;
    border: 2px solid #000000 !important;
    border-radius: 8px;
    padding: 8px 16px !important;
    font-weight: 600;
    margin-right: 8px;
    transition: background 0.2s ease;
}

#loginLink:hover {
    background: #f8f9fa !important;
}

/* Mobile login button */
#loginLinkMobile {
    background: #ffffff !important;
    color: #000000 !important;
    border: 2px solid #000000 !important;
    border-radius: 8px;
    padding: 12px 16px !important;
    font-weight: 600;
    display: block;
    text-align: center;
}

#loginLinkMobile:hover {
    background: #f8f9fa !important;
}

/* Mobile Sidebar Styles */
.mobile-sidebar {
    position: fixed;
    top: 0;
    left: -300px;
    width: 300px;
    height: 100vh;
    background: white;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 1050;
    transition: left 0.3s ease;
    overflow-y: auto;
}

.mobile-sidebar.show {
    left: 0;
}

.sidebar-header {
    padding: 1rem;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
}

.sidebar-content {
    padding: 1rem;
}

.sidebar-link {
    display: block;
    padding: 0.75rem 1rem;
    color: #495057;
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    transition: all 0.3s ease;
}

.sidebar-link:hover {
    background: #f8f9fa;
    color: #007bff;
}

.user-info {
    display: flex;
    align-items: center;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 10px;
}

.sidebar-menu {
    margin-top: 1rem;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* Profile dropdown hover effect */
.dropdown-item:hover {
    background-color: #f8f9fa;
    color: #007bff;
}

/* Navbar brand hover effect */
.navbar-brand:hover {
    color: #007bff !important;
}

/* Nav link hover effects */
.nav-link:hover {
    color: #007bff !important;
}

/* Upgrade button hover effect */
#upgradeBtn:hover {
    background-color: #007bff;
    border-color: #007bff;
    color: white;
}

/* Mobile upgrade button hover effect */
#upgradeBtnMobile:hover {
    background-color: #0056b3;
    border-color: #0056b3;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .navbar-brand {
        font-size: 1.1rem;
    }
    
    .mobile-sidebar {
        width: 280px;
    }
    
    .sidebar-content {
        padding: 0.75rem;
    }
    
    .sidebar-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 576px) {
    .mobile-sidebar {
        width: 100%;
        left: -100%;
    }
    
    .sidebar-header {
        padding: 0.75rem;
    }
    
    .user-info {
        padding: 0.75rem;
    }
}

/* Make the main navbar sticky so it remains visible while the page scrolls.
   Use a selector that targets the injected navbar element but won't break other layout. */
#navbar-container .navbar,
.navbar {
    position: sticky;
    top: 0;
    z-index: 1100;
    background: white;
    box-shadow: 0 1px 6px rgba(0,0,0,0.06);
}

/* Stronger rules to override page-level styles that might prevent stickiness.
   Some pages set overflow/position on ancestors; applying to the container and using
   !important increases robustness. */
/* Keep the navbar above normal content but below Bootstrap modals/backdrops.
   Bootstrap uses 1040 for modal-backdrop and 1050 for modal; choose 1030 so
   modals overlay the navbar but the navbar still overlays page content. */
#navbar-container {
    position: sticky;
    top: 0;
    z-index: 1030;
    overflow: visible !important;
}

nav.navbar {
    position: sticky !important;
    top: 0 !important;
    z-index: 1030 !important;
    background: white;
}
