/* Fix WordPress Admin Toolbar Positioning - Global Fix */

/* Reset body margin when admin bar is present */
body.admin-bar {
    margin-top: 0 !important;
}

/* Fix admin toolbar position and z-index */
body.admin-bar #wpadminbar {
    position: fixed !important;
    top: 0 !important;
    z-index: 99999 !important;
    width: 100% !important;
}

/* Adjust content positioning for desktop admin toolbar (32px height) */
@media screen and (min-width: 783px) {
    body.admin-bar .no-header-space {
        margin-top: 32px !important;
        position: relative;
    }
    
    /* Alternative: push down the first section if no-header-space class is not used */
    body.admin-bar main > section:first-child,
    body.admin-bar .main-content > section:first-child {
        padding-top: 32px;
    }
    
    /* Ensure hero sections start below admin bar */
    body.admin-bar section:first-of-type {
        padding-top: 0;
    }
    
    /* Fix for pages without no-header-space class */
    body.admin-bar .hero-section,
    body.admin-bar .banner-section {
        margin-top: 32px;
    }
}

/* Adjust content positioning for mobile admin toolbar (46px height) */
@media screen and (max-width: 782px) {
    body.admin-bar .no-header-space {
        margin-top: 46px !important;
        position: relative;
    }
    
    /* Alternative: push down the first section if no-header-space class is not used */
    body.admin-bar main > section:first-child,
    body.admin-bar .main-content > section:first-child {
        padding-top: 46px;
    }
    
    /* Ensure hero sections start below admin bar */
    body.admin-bar section:first-of-type {
        padding-top: 0;
    }
    
    /* Fix for pages without no-header-space class */
    body.admin-bar .hero-section,
    body.admin-bar .banner-section {
        margin-top: 46px;
    }
}

/* Fix for sticky elements when admin bar is present */
body.admin-bar .sticky-header,
body.admin-bar .fixed-header {
    top: 32px !important;
}

@media screen and (max-width: 782px) {
    body.admin-bar .sticky-header,
    body.admin-bar .fixed-header {
        top: 46px !important;
    }
}

/* Prevent content from being hidden behind admin bar */
body.admin-bar .main-content,
body.admin-bar .hero-content {
    position: relative;
    z-index: 1;
}

/* Additional fix for hero sections */
body.admin-bar .no-header-space {
    min-height: calc(100vh - 32px);
}

@media screen and (max-width: 782px) {
    body.admin-bar .no-header-space {
        min-height: calc(100vh - 46px);
    }
}

/* Fallback fix for any page that might not have proper spacing */
body.admin-bar {
    padding-top: 0 !important;
}

body.admin-bar .site-header {
    top: 32px;
    position: relative;
}

@media screen and (max-width: 782px) {
    body.admin-bar .site-header {
        top: 46px;
    }
}

/* Make sure the admin bar stays on top of everything */
#wpadminbar {
    z-index: 999999 !important;
}