/* Enhanced Navbar Styles */

/* Navbar Base Styles */
#mainNavbar {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%) !important;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    padding: 0.5rem 0;
    z-index: 1050;
}

#mainNavbar .container-fluid {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

#mainNavbar .navbar-collapse {
    flex-grow: 1;
}

#mainNavbar.scrolled {
    background: rgba(26, 26, 46, 0.95) !important;
    backdrop-filter: blur(15px);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
}

.navbar-spacer {
    height: 80px;
}

/* Brand Styles */
.navbar-brand-wrapper {
    min-width: 200px;
    flex-shrink: 0;
}

.brand-logo {
    transition: transform 0.3s ease;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.brand-text {
    font-weight: 700;
    font-size: 1.5rem;
    background: linear-gradient(45deg, #fff, #f8f9fa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.navbar-brand:hover .brand-logo {
    transform: scale(1.1);
}

/* Mobile Toggle Button */
.navbar-toggler {
    padding: 0.5rem 0.75rem;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.navbar-toggler:hover {
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.1);
}

.navbar-toggler i {
    color: #fff;
    font-size: 1.2rem;
}

/* Enhanced Search Styles */
.navbar-search {
    max-width: 400px;
    min-width: 300px;
    flex-shrink: 0;
}

.search-form {
    position: relative;
}

.search-input-group {
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    background: white;
    display: flex;
    align-items: stretch;
}

.input-group-prepend {
    display: flex;
    position: relative;
}

.search-category-btn {
    background: #f8f9fa;
    border: none;
    color: #495057;
    font-weight: 500;
    white-space: nowrap;
    padding: 0.5rem 0.75rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    position: relative;
    z-index: 1;
}

.search-category-btn:hover,
.search-category-btn:focus {
    background: #e9ecef;
    color: #212529;
}

.search-category-btn.show {
    background: #e9ecef;
    color: #212529;
}

.search-input {
    border: none;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    background: #fff;
    color: #495057;
    flex: 1;
}

.search-input:focus {
    box-shadow: none;
    border: none;
    outline: none;
}

.search-btn {
    border: none;
    background: linear-gradient(45deg, #007bff, #0056b3);
    color: white;
    padding: 0.5rem 1rem;
    transition: all 0.3s ease;
}

.search-btn:hover {
    background: linear-gradient(45deg, #0056b3, #004085);
    transform: translateY(-1px);
}

/* Search Category Dropdown */
.search-category-dropdown {
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border: none;
    max-height: 300px;
    overflow-y: auto;
    margin-top: 0.5rem;
    z-index: 1052;
    min-width: 200px;
    background: white;
}

.search-category-item {
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    cursor: pointer;
    color: #495057;
    text-decoration: none;
    display: block;
}

.search-category-item:last-child {
    border-bottom: none;
}

.search-category-item:hover {
    background: #f8f9fa;
    color: #007bff;
    transform: translateX(5px);
}

.search-category-item:active {
    background: #e9ecef;
}

/* Ensure dropdown appears on top */
.dropdown-menu.search-category-dropdown {
    display: block;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.dropdown-menu.search-category-dropdown.show {
    visibility: visible;
    opacity: 1;
}

/* Search Suggestions */
.search-suggestions-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 0 0 15px 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 1051;
    max-height: 400px;
    overflow-y: auto;
    display: none;
}

.search-suggestions-dropdown.show {
    display: block;
}

.suggestions-content {
    padding: 1rem 0;
}

.suggestion-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
}

.suggestion-item:hover {
    background: #f8f9fa;
    color: #007bff;
}

.suggestion-icon {
    width: 20px;
    text-align: center;
    margin-right: 0.75rem;
    color: #6c757d;
}

.suggestion-text {
    flex-grow: 1;
}

.suggestion-category {
    font-size: 0.875rem;
    color: #6c757d;
}

/* Navigation Links */
.navbar-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    margin: 0 auto;
    padding: 0;
}

.nav-link-enhanced {
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    align-items: center;
    color: rgba(255, 255, 255, 0.9) !important;
    font-weight: 500;
}

.nav-link-enhanced:hover {
    color: #fff !important;
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.nav-icon {
    font-size: 1.1rem;
    margin-right: 0.5rem;
}

.nav-text {
    font-size: 0.95rem;
}

/* Badges */
.badge-pill {
    font-size: 0.65rem;
    padding: 0.25rem 0.5rem;
    border-radius: 50px;
    font-weight: 600;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Mega Menu Styles */
.mega-dropdown {
    position: static !important;
}

.mega-menu {
    width: 100%;
    left: 0 !important;
    right: 0 !important;
    border: none;
    border-radius: 0 0 15px 15px;
    background: white;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    padding: 2rem 0;
    margin-top: 0;
}

.mega-menu-item {
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
    border-radius: 8px;
    margin: 0.25rem 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.mega-menu-item:hover {
    background: #f8f9fa;
    color: #007bff;
    transform: translateX(10px);
}

.mega-menu-featured {
    padding: 1rem;
}

.mega-menu-title {
    color: #495057;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #007bff;
}

.featured-category-card {
    background: linear-gradient(135deg, #007bff, #0056b3);
    border-radius: 12px;
    padding: 1rem;
    color: white;
    text-align: center;
}

.featured-category-img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.featured-category-img-placeholder {
    width: 100%;
    height: 100px;
    border-radius: 8px;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, rgba(255,255,255,0.2), rgba(255,255,255,0.05));
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.9);
}

.featured-category-content h6 {
    color: white;
    font-weight: 600;
}

/* User Avatar Styles */
.user-avatar,
.user-avatar-large {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
}

.user-avatar-large {
    width: 50px;
    height: 50px;
}

.user-avatar img,
.user-avatar-large img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-placeholder,
.avatar-placeholder-large {
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, #007bff, #0056b3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
}

.avatar-placeholder-large {
    font-size: 1.125rem;
}

.user-menu-toggle:hover .user-avatar {
    transform: scale(1.1);
    border-color: rgba(255, 255, 255, 0.6);
}

.user-info {
    margin-left: 0.5rem;
    text-align: left;
}

.user-name {
    display: block;
    font-weight: 500;
    color: white;
    font-size: 0.9rem;
}

.user-role {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
}

/* User Dropdown Menu */
.user-dropdown-menu {
    min-width: 320px;
    border: none;
    border-radius: 12px;
    padding: 0;
    margin-top: 0.5rem;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.user-dropdown-header {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    padding: 1.5rem;
    border-radius: 12px 12px 0 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.user-details h6 {
    font-weight: 600;
    color: #495057;
}

.user-badges .badge {
    font-size: 0.7rem;
    margin-right: 0.25rem;
}

.dropdown-section {
    padding: 0.5rem 0;
}

.dropdown-section-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.5rem 1rem;
    margin-bottom: 0.25rem;
    background: #f8f9fa;
}

.user-dropdown-item {
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-dropdown-item:hover {
    background: #f8f9fa;
    color: #007bff;
    transform: translateX(5px);
}

.user-dropdown-item i {
    width: 20px;
    text-align: center;
}

/* Notifications Dropdown */
.notifications-dropdown {
    min-width: 350px;
    max-height: 400px;
    border: none;
    border-radius: 12px;
    padding: 0;
    margin-top: 0.5rem;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.notifications-list {
    max-height: 300px;
    overflow-y: auto;
}

.dropdown-footer {
    padding: 1rem;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    background: #f8f9fa;
    border-radius: 0 0 12px 12px;
}

/* Register Button */
.nav-register-btn {
    border-radius: 20px;
    padding: 0.5rem 1rem;
    font-weight: 500;
    background: linear-gradient(45deg, #28a745, #20c997);
    border: none;
    transition: all 0.3s ease;
}

.nav-register-btn:hover {
    background: linear-gradient(45deg, #20c997, #17a2b8);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

/* Mobile Responsive */
@media (max-width: 991.98px) {
    #mainNavbar .container-fluid {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .navbar-search {
        min-width: 100%;
        max-width: 100%;
        margin: 1rem 0;
    }
    
    .search-input-group {
        border-radius: 8px;
    }
    
    .navbar-nav {
        width: 100%;
        gap: 0.5rem;
    }
    
    .mega-menu {
        position: relative !important;
        width: 100% !important;
        left: auto !important;
        right: auto !important;
        border-radius: 8px;
        margin-top: 0.5rem;
        padding: 1rem;
    }
    
    .mega-menu .container {
        padding: 0;
    }
    
    .mega-menu .row {
        margin: 0;
    }
    
    .mega-menu .col-md-4,
    .mega-menu .col-md-6,
    .mega-menu .col-md-8 {
        padding: 0;
    }
    
    .user-dropdown-menu {
        min-width: 280px;
    }
    
    .notifications-dropdown {
        min-width: 280px;
    }
    
    .nav-link-enhanced {
        padding: 1rem;
        margin: 0.25rem 0;
        border-radius: 8px;
    }
    
    .user-info {
        display: none !important;
    }
    
    .navbar-spacer {
        height: 60px;
    }
}

@media (max-width: 575.98px) {
    .navbar-search {
        margin: 0.5rem 0;
    }
    
    .search-input-group {
        font-size: 0.9rem;
    }
    
    .search-category-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }
    
    .search-input {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }
    
    .search-btn {
        padding: 0.5rem 1rem;
    }
    
    .brand-text {
        font-size: 1.25rem;
    }
    
    .nav-text {
        font-size: 0.9rem;
    }
}

/* Animation for dropdown menus */
.dropdown-menu {
    animation: dropdownFadeIn 0.3s ease;
}

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

/* Loading states */
.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Accessibility improvements */
.nav-link-enhanced:focus,
.user-dropdown-item:focus,
.mega-menu-item:focus,
.search-category-item:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .search-input-group {
        background: #343a40;
    }
    
    .search-input {
        background: #343a40;
        color: #fff;
    }
    
    .search-category-btn {
        background: #495057;
        color: #fff;
    }
    
    .mega-menu {
        background: #343a40;
        color: #fff;
    }
    
    .user-dropdown-menu {
        background: #343a40;
        color: #fff;
    }
    
    .notifications-dropdown {
        background: #343a40;
        color: #fff;
    }
}