/**
 * Header Fix CSS
 * Fixes header overlapping content and navbar issues
 * @package dyat
 * @since 1.0.1
 */

/* CRITICAL: Header and Navbar must NOT be absolute or fixed */
.navbar-area,
.navbar,
#masthead,
.site-header {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    width: 100% !important;
}

/* Ensure site content starts BELOW header, not overlapping */
.site-content,
#content {
    padding-top: 20px !important;
    margin-top: 0 !important;
    min-height: calc(100vh - 80px);
    position: relative;
    z-index: 1;
}

/* Fix for navbar area - COMPACT */
.navbar-area {
    position: relative !important;
    z-index: 999;
    background-color: #060606;
    padding: 10px 0 !important;
    min-height: 60px !important;
}

/* Ensure header doesn't overlap */
#masthead.site-header {
    position: relative !important;
    z-index: 998;
    margin-bottom: 0 !important;
}

/* Fix navbar collapse - ensure it's collapsed by default on desktop */
@media (min-width: 992px) {
    .navbar-nav {
        display: flex !important;
        flex-direction: row;
        align-items: center;
    }

    .navbar-nav .menu-item {
        position: relative;
    }

    /* Hide submenus by default on desktop */
    .navbar-nav .sub-menu {
        display: none !important;
        position: absolute;
        top: 100%;
        left: 0;
        background: #1a1a1a;
        min-width: 220px;
        padding: 10px 0;
        z-index: 1000;
        box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    }

    /* Show submenu on hover */
    .navbar-nav .menu-item-has-children:hover > .sub-menu {
        display: block !important;
    }

    .navbar-nav .sub-menu .menu-item {
        display: block;
        width: 100%;
    }

    .navbar-nav .sub-menu .menu-item a {
        padding: 10px 20px;
        display: block;
        color: #fff;
        white-space: nowrap;
        transition: background 0.3s ease;
    }

    .navbar-nav .sub-menu .menu-item a:hover {
        background: #25C6DA;
        color: #fff;
    }

    /* Remove menu-open class effects on desktop */
    .navbar-nav.menu-open {
        display: flex !important;
    }
}

/* Mobile menu fixes */
@media (max-width: 991px) {
    .navbar-collapse {
        max-height: calc(100vh - 80px);
        overflow-y: auto;
    }

    .navbar-nav.show {
        display: block !important;
    }
}

/* OVERRIDE: Force navbar to be relative, NOT absolute */
.navbar-area.nav-absolute {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    width: 100%;
}

/* Tournament pages specific fix */
.trn-page {
    margin-top: 20px !important;
}

.trn-container {
    padding-top: 20px;
}

/* Breadcrumb fix */
.breadcrumb-wrap {
    margin-top: 0 !important;
}

/* Mobile responsiveness */
@media only screen and (max-width: 991px) {
    .site-content,
    #content {
        padding-top: 80px !important;
    }

    body:has(.navbar-area.nav-absolute) .site-content,
    body:has(.navbar-area.nav-absolute) #content {
        padding-top: 100px !important;
    }
}

@media only screen and (max-width: 767px) {
    .site-content,
    #content {
        padding-top: 70px !important;
    }

    body:has(.navbar-area.nav-absolute) .site-content,
    body:has(.navbar-area.nav-absolute) #content {
        padding-top: 90px !important;
    }
}

/* Ensure proper stacking context */
.site {
    position: relative;
    overflow-x: hidden;
}

/* Fix for pages with hero sections */
.has-hero-section .site-content,
.has-hero-section #content {
    padding-top: 0 !important;
}

.has-hero-section .hero-section {
    padding-top: 120px;
}
