/**
 * Navigation Bar Enhancements
 * Improved alignment and user-friendly navigation
 */

/* ============================================
   HEADER & NAVIGATION CONTAINER
   ============================================ */

header {
    position: relative;
    z-index: 1000;
}

.de-flex {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 1rem 0;
}

.de-flex-col {
    display: flex;
    align-items: center;
}

/* ============================================
   LOGO SECTION
   ============================================ */

#logo {
    display: flex;
    align-items: center;
    margin-right: 2rem;
}

#logo img {
    max-height: 100px;
    height: auto;
    width: auto;
    object-fit: contain;
    transition: all 0.3s ease;
}

/* Ensure logo-1 and logo-2 are both sized correctly */
#logo .logo-1,
#logo .logo-2 {
    max-height: 100px;
    height: auto;
    width: auto;
    object-fit: contain;
}

/* ============================================
   MAIN MENU NAVIGATION
   ============================================ */

.header-col-mid {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Hide menu on mobile by default - must be after base styles */
@media (max-width: 991px) {
    .header-col-mid {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        height: 0 !important;
        overflow: hidden !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    #mainmenu {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
    }
}

#mainmenu {
    display: flex;
    align-items: center;
    justify-content: center;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 0.5rem;
    flex-wrap: wrap;
}

#mainmenu li {
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
}

#mainmenu li a.menu-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.25rem;
    color: #1A1A1A;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    white-space: nowrap;
    position: relative;
}

#mainmenu li a.menu-item:hover {
    background: rgba(255, 215, 0, 0.2);
    color: #FDB813;
    transform: translateY(-2px);
}

#mainmenu li a.menu-item:active {
    transform: translateY(0);
}

/* Active menu item indicator */
#mainmenu li a.menu-item.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 3px;
    background: #FFD700;
    border-radius: 2px;
}

/* ============================================
   MENU SIDE AREA (Login/Register/Dashboard)
   ============================================ */

.menu_side_area {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: 1.5rem;
    flex-wrap: wrap;
}

.menu_side_area .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.3s ease;
    white-space: nowrap;
    border: none;
    cursor: pointer;
    gap: 0.5rem;
}

.menu_side_area .btn-primary {
    background: linear-gradient(135deg, #FFD700 0%, #FFE44D 100%);
    color: #1A1A1A;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.3);
}

.menu_side_area .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.4);
    background: linear-gradient(135deg, #FDB813 0%, #FFD700 100%);
    color: #1A1A1A;
}

/* Ensure icons are always visible in header buttons */
.menu_side_area .btn i,
.menu_side_area .btn-primary i {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    color: inherit !important;
    margin-right: 0.5rem;
    font-size: 0.9rem;
    line-height: 1;
    vertical-align: middle;
}

.menu_side_area .btn:hover i,
.menu_side_area .btn-primary:hover i {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    color: inherit !important;
}

.menu_side_area .btn[href*="logout"] i {
    color: #ffffff !important;
}

.menu_side_area .btn[href*="logout"]:hover i {
    color: #ffffff !important;
}

.menu_side_area .btn[href*="logout"] {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.2);
}

.menu_side_area .btn[href*="logout"]:hover {
    background: linear-gradient(135deg, #c82333 0%, #bd2130 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
    color: #ffffff;
}

/* Remove inline style conflicts */
.menu_side_area .btn[style*="padding"] {
    padding: 0.625rem 1.25rem !important;
}

.menu_side_area .btn[style*="margin"] {
    margin: 0 !important;
}

/* ============================================
   TOPBAR ENHANCEMENTS
   ============================================ */

#topbar {
    background: #FFD700 !important;
    padding: 0.5rem 0;
    font-size: 0.875rem;
    color: #1A1A1A !important;
}

#topbar * {
    color: #1A1A1A !important;
}

.topbar-left,
.topbar-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.topbar-left *,
.topbar-right * {
    color: #1A1A1A !important;
}

.topbar-widget {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #1A1A1A !important;
}

.topbar-widget a {
    color: #1A1A1A !important;
    text-decoration: none;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.topbar-widget a:hover {
    color: #FDB813 !important;
}

.topbar-widget i {
    font-size: 0.9rem;
    color: #1A1A1A !important;
}

.topbar-widget span {
    color: #1A1A1A !important;
}

.social-icons {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.social-icons a {
    color: #1A1A1A !important;
    text-decoration: none;
    transition: all 0.3s ease;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(26, 26, 26, 0.1);
}

.social-icons a:hover {
    color: #FFFFFF !important;
    background: #1A1A1A !important;
    transform: translateY(-2px);
}

.social-icons a i {
    color: #1A1A1A !important;
}

.social-icons a:hover i {
    color: #FFFFFF !important;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 1200px) {
    #mainmenu li a.menu-item {
        padding: 0.625rem 1rem;
        font-size: 0.9rem;
    }
    
    .menu_side_area {
        gap: 0.5rem;
    }
    
    .menu_side_area .btn {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }
    
    #logo img,
    #logo .logo-1,
    #logo .logo-2 {
        max-height: 90px;
    }
}

@media (max-width: 992px) {
    /* Header container adjustments */
    header .container {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    .de-flex {
        flex-wrap: nowrap;
        justify-content: space-between;
        align-items: center;
        padding: 0.75rem 0;
        position: relative;
    }
    
    /* Logo column */
    .header-logo-col {
        flex: 0 0 auto;
        order: 1;
        margin-right: auto;
    }
    
    #logo {
        margin-right: 0;
    }
    
    #logo img,
    #logo .logo-1,
    #logo .logo-2 {
        max-height: 50px !important;
        width: auto;
    }
    
    /* Hide menu and buttons on mobile by default */
    .header-col-mid {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        height: 0 !important;
        overflow: hidden !important;
    }
    
    /* Hide login/register buttons on mobile - they'll show in hamburger menu */
    .header-buttons-col,
    .header-buttons-col .menu_side_area {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        height: 0 !important;
        overflow: hidden !important;
        position: absolute !important;
        left: -9999px !important;
    }
    
    /* Hide mainmenu directly as well */
    #mainmenu {
        display: none !important;
        visibility: hidden !important;
    }
    
    /* Show hamburger button */
    .mobile-menu-toggle {
        display: flex !important;
        align-items: center;
        order: 2;
        margin-left: 1rem;
        flex: 0 0 auto;
    }
    
    .hamburger-menu-btn {
        display: flex !important;
        width: 44px;
        height: 44px;
        background: #FFFFFF;
        border: 2px solid #FFD700;
        border-radius: 8px;
        padding: 10px;
        cursor: pointer;
        z-index: 1001;
        transition: all 0.3s ease;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }
    
    .hamburger-menu-btn:hover {
        border-color: #FDB813;
        background: rgba(255, 215, 0, 0.1);
        box-shadow: 0 4px 12px rgba(255, 215, 0, 0.3);
    }
    
    .hamburger-menu-btn.active {
        border-color: #FDB813;
        background: rgba(255, 215, 0, 0.15);
    }
    
    .hamburger-line {
        background: #1A1A1A;
    }
    
    .hamburger-menu-btn:hover .hamburger-line,
    .hamburger-menu-btn.active .hamburger-line {
        background: #FFD700;
    }
}

@media (max-width: 768px) {
    #logo {
        margin-right: 1rem;
    }
    
    #logo img {
        max-height: 80px;
    }
    
    .de-flex {
        padding: 0.75rem 0;
    }
    
    .header-col-mid {
        margin-top: 0.75rem;
    }
    
    #mainmenu {
        gap: 0.25rem;
    }
    
    #mainmenu li a.menu-item {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
    
    .menu_side_area {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .menu_side_area .btn {
        width: 100%;
        justify-content: center;
    }
    
    .topbar-left {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }
    
    .topbar-widget {
        font-size: 0.8rem;
    }
}

@media (max-width: 576px) {
    #mainmenu li a.menu-item {
        padding: 0.5rem;
        font-size: 0.75rem;
    }
    
    .menu_side_area .btn {
        padding: 0.625rem;
        font-size: 0.8rem;
    }
}

/* ============================================
   HAMBURGER MENU BUTTON
   ============================================ */

.mobile-menu-toggle {
    display: none;
}

.hamburger-menu-btn {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 1001;
    position: relative;
    transition: all 0.3s ease;
}

.hamburger-line {
    width: 100%;
    height: 3px;
    background: #1A1A1A;
    border-radius: 2px;
    transition: all 0.3s ease;
    transform-origin: center;
}

/* Hamburger button hover state */
.hamburger-menu-btn:hover .hamburger-line {
    background: #FFD700;
}

/* Hamburger button active state (when menu is open) */
.hamburger-menu-btn.active .hamburger-line:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.hamburger-menu-btn.active .hamburger-line:nth-child(2) {
    opacity: 0;
    transform: translateX(-10px);
}

.hamburger-menu-btn.active .hamburger-line:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* ============================================
   MOBILE MENU (Hamburger Implementation)
   ============================================ */

@media (max-width: 991px) {
    /* Show menu when hamburger is clicked - override ALL hiding rules */
    header.menu-open .header-col-mid {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        height: auto !important;
        max-height: 1000px !important;
        overflow: visible !important;
        width: 100% !important;
        min-width: 100% !important;
        position: relative !important;
        top: auto !important;
        left: auto !important;
        clip: auto !important;
        order: 3;
        margin-top: 1rem;
        padding-top: 1rem;
        border-top: 2px solid rgba(255, 215, 0, 0.3);
        animation: slideDown 0.3s ease;
        background: #FFFFFF;
        border-radius: 8px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }
    
    header.menu-open .header-buttons-col {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        height: auto !important;
        max-height: 500px !important;
        overflow: visible !important;
        width: 100% !important;
        min-width: 100% !important;
        position: relative !important;
        top: auto !important;
        left: auto !important;
        clip: auto !important;
        order: 4;
        margin-top: 0.5rem;
        padding-top: 1rem;
        border-top: 2px solid rgba(255, 215, 0, 0.3);
        animation: slideDown 0.3s ease 0.1s both;
        background: #FFFFFF;
        border-radius: 8px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }
    
    /* Show mainmenu when menu is open */
    header.menu-open #mainmenu,
    header.menu-open .header-col-mid #mainmenu {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        height: auto !important;
        max-height: 1000px !important;
        overflow: visible !important;
        width: 100% !important;
        min-width: 100% !important;
        position: relative !important;
        top: auto !important;
        left: auto !important;
        clip: auto !important;
        flex-direction: column !important;
        gap: 1 !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    /* Show menu items when menu is open */
    header.menu-open #mainmenu li,
    header.menu-open .header-col-mid #mainmenu li {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        height: auto !important;
        overflow: visible !important;
        position: relative !important;
        left: auto !important;
        width: 100% !important;
        clip: auto !important;
        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    }
    
    header.menu-open #mainmenu li:last-child {
        border-bottom: none !important;
    }
    
    /* Show menu links when menu is open */
    header.menu-open #mainmenu li a,
    header.menu-open #mainmenu li a.menu-item,
    header.menu-open .header-col-mid #mainmenu li a {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        height: auto !important;
        overflow: visible !important;
        position: relative !important;
        left: auto !important;
        width: 100% !important;
        clip: auto !important;
        padding: 1rem 1.5rem !important;
        color: #1A1A1A !important;
        font-size: 1rem !important;
        font-weight: 500 !important;
        text-decoration: none !important;
        transition: all 0.3s ease !important;
        border-radius: 0 !important;
    }
    
    header.menu-open #mainmenu li a:hover {
        background: rgba(255, 215, 0, 0.15) !important;
        padding-left: 2rem !important;
        color: #FFD700 !important;
    }
    
    /* Show buttons when menu is open - override all hiding rules */
    header.menu-open .menu_side_area,
    header.menu-open .header-buttons-col .menu_side_area {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        height: auto !important;
        max-height: 500px !important;
        overflow: visible !important;
        width: 100% !important;
        min-width: 100% !important;
        position: relative !important;
        top: auto !important;
        left: auto !important;
        clip: auto !important;
        flex-direction: column !important;
        gap: 1rem !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    header.menu-open .menu_side_area .btn,
    header.menu-open .header-buttons-col .btn {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        height: auto !important;
        overflow: visible !important;
        position: relative !important;
        left: auto !important;
        width: 100% !important;
        min-width: 100% !important;
        margin: 0 !important;
        padding: 1.125rem 1.5rem !important;
        font-size: 1rem !important;
        font-weight: 700 !important;
        justify-content: center !important;
        align-items: center !important;
        border-radius: 12px !important;
        background: linear-gradient(135deg, #FFD700 0%, #FDB813 100%) !important;
        border: none !important;
        color: #1A1A1A !important;
        box-shadow: 0 4px 15px rgba(255, 215, 0, 0.35) !important;
        text-decoration: none !important;
        transition: all 0.3s ease !important;
    }
    
    header.menu-open .menu_side_area .btn:hover,
    header.menu-open .header-buttons-col .btn:hover {
        transform: translateY(-3px) !important;
        box-shadow: 0 8px 25px rgba(255, 215, 0, 0.5) !important;
        background: linear-gradient(135deg, #FDB813 0%, #FFD700 100%) !important;
    }
    
    header.menu-open .menu_side_area .btn i,
    header.menu-open .header-buttons-col .btn i {
        display: inline-block !important;
        visibility: visible !important;
        opacity: 1 !important;
        margin-right: 0.75rem !important;
        font-size: 1.1rem !important;
    }
    
    @keyframes slideDown {
        from {
            opacity: 0;
            transform: translateY(-10px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
    
    /* Menu styling when open */
    header.menu-open #mainmenu {
        flex-direction: column;
        width: 100%;
        gap: 1;
        padding: 0;
        margin: 0;
    }
    
    header.menu-open #mainmenu li {
        width: 100%;
        border-bottom: 1px solid rgba(0, 0, 0, 0.08);
        margin: 0;
        display: block;
    }
    
    header.menu-open #mainmenu li:last-child {
        border-bottom: none;
    }
    
    header.menu-open #mainmenu li a.menu-item {
        display: block;
        width: 100%;
        padding: 1rem 1.5rem;
        font-size: 1rem;
        text-align: left;
        border-radius: 0;
        transition: all 0.3s ease;
        color: #1A1A1A;
        font-weight: 500;
    }
    
    header.menu-open #mainmenu li a.menu-item:hover {
        background: rgba(255, 215, 0, 0.15);
        padding-left: 2rem;
        color: #FFD700;
    }
    
    /* Menu buttons when open */
    header.menu-open .menu_side_area {
        display: flex !important;
        flex-direction: column;
        width: 100%;
        gap: 0.75rem;
        margin: 0;
        padding: 0;
    }
    
    header.menu-open .menu_side_area .btn {
        width: 100%;
        margin: 0;
        padding: 0.875rem 1.5rem;
        font-size: 0.95rem;
        justify-content: center;
        border-radius: 8px;
        font-weight: 600;
    }
    
    /* Prevent body scroll when menu is open */
    body.menu-open {
        overflow: hidden;
        position: fixed;
        width: 100%;
    }
    
    /* Add overlay when menu is open */
    header.menu-open::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.4);
        z-index: 998;
        animation: fadeIn 0.3s ease;
        pointer-events: auto;
    }
    
    @keyframes fadeIn {
        from { opacity: 0; }
        to { opacity: 1; }
    }
    
    /* Ensure menu content is above overlay */
    header.menu-open .header-col-mid,
    header.menu-open .header-buttons-col {
        position: relative;
        z-index: 1000;
        background: #FFFFFF;
        margin-left: -15px;
        margin-right: -15px;
        padding-left: 15px;
        padding-right: 15px;
    }
}

/* ============================================
   ACCESSIBILITY IMPROVEMENTS
   ============================================ */

#mainmenu li a.menu-item:focus,
.menu_side_area .btn:focus {
    outline: 2px solid #FFD700;
    outline-offset: 2px;
}

/* Keyboard navigation */
#mainmenu li a.menu-item:focus-visible {
    background: rgba(255, 215, 0, 0.2);
    color: #1A1A1A;
}

/* ============================================
   SMOOTH SCROLLING
   ============================================ */

html {
    scroll-behavior: smooth;
}

/* ============================================
   STICKY HEADER (if needed)
   ============================================ */

header.sticky {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #FFFFFF;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

header.sticky #topbar {
    display: none;
}

/* ============================================
   SCROLL BEHAVIOR - PARTIAL VISIBILITY
   ============================================ */

/* Make header fixed when scrolling - override all other position styles */
header.scrolling {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    z-index: 1000 !important;
    transition: transform 0.3s ease-in-out !important;
    /* Partially hide - show only bottom portion of nav bar */
    /* Negative value moves header up, hiding most of it */
    /* -90% hides 90% of the header, showing only 10% at bottom */
    transform: translateY(-100%) !important;
    background: #FFFFFF !important;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1) !important;
    will-change: transform;
    overflow: hidden !important;
}

/* When scroll stops, show fully */
header.scroll-stopped {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    z-index: 1000 !important;
    transition: transform 0.3s ease-in-out !important;
    transform: translateY(0) !important;
    background: #FFFFFF !important;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1) !important;
    will-change: transform;
}

/* Hide topbar when scrolling */
header.scrolling #topbar,
header.scroll-stopped #topbar {
    display: none !important;
    opacity: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
}

/* Ensure smooth transitions on header */
header {
    transition: transform 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
}

/* Override any absolute positioning when scrolling classes are active */
header.scrolling,
header.scroll-stopped {
    position: fixed !important;
}

/* ============================================
   FIX FOR BUTTON ALIGNMENT
   ============================================ */

.menu_side_area .external-link-controller {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    vertical-align: middle !important;
    margin: 0 !important;
}

/* Remove &nbsp; spacing issues */
.menu_side_area {
    font-size: 0;
}

.menu_side_area > * {
    font-size: 0.9rem;
}

/* ============================================
   IMPROVED VISUAL HIERARCHY
   ============================================ */

#mainmenu li a.menu-item {
    font-weight: 500;
    letter-spacing: 0.3px;
}

.menu_side_area .btn {
    font-weight: 600;
    letter-spacing: 0.2px;
}

/* Add subtle separator */
.header-col-mid::after {
    content: '';
    width: 1px;
    height: 30px;
    background: #e9ecef;
    margin-left: 1.5rem;
}

@media (max-width: 992px) {
    .header-col-mid::after {
        display: none;
    }
}



