/**
 * Hero Section Complete Mobile Fix
 * Comprehensive fixes for hero section on mobile devices
 */

/* Mobile Hero Section Complete Overhaul */
@media (max-width: 767px) {
    /* Main hero section fixes */
    .hero,
    .hero__style-one,
    section.hero {
        margin-top: 0 !important;
        padding-top: 50px !important; /* Reduced from 80px */
        padding-bottom: 40px !important;
        position: relative !important;
        overflow: hidden !important;
        min-height: auto !important;
        height: auto !important;
    }
    
    /* Background image optimization for mobile */
    .hero.bg_img,
    .hero[data-background] {
        background-attachment: scroll !important; /* Fixed backgrounds don't work well on mobile */
        background-position: center center !important;
        background-size: cover !important;
        background-repeat: no-repeat !important;
    }
    
    /* Add overlay for better text readability */
    .hero::before {
        content: "";
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 1;
        pointer-events: none;
    }
    
    /* Ensure content is above overlay */
    .hero .container {
        position: relative;
        z-index: 2;
        padding-top: 0 !important;
        padding-bottom: 0 !important;
    }
    
    /* Remove any gaps after header */
    header + .hero,
    .header-area + .hero,
    .xb-header + .hero,
    .vt-header + .hero,
    .stricky-fixed + .hero,
    .stricky-header + .hero {
        margin-top: 0 !important;
        padding-top: 50px !important;
    }
    
    /* Hero content adjustments */
    .hero__content {
        padding: 20px 0 !important;
        max-width: 100% !important;
        text-align: center !important; /* Center align on mobile */
    }
    
    /* Hero title responsive */
    .hero__content h1 {
        font-size: 28px !important;
        line-height: 1.3 !important;
        margin-bottom: 15px !important;
        color: #fff !important;
        text-shadow: 2px 2px 4px rgba(0,0,0,0.5) !important;
        font-weight: 700 !important;
    }
    
    .hero__content h1 br {
        display: none !important; /* Remove line breaks on mobile */
    }
    
    .hero__content h1 span {
        display: inline !important;
        color: var(--color-primary, #FFC107) !important;
        margin-left: 5px !important;
    }
    
    /* Hero paragraph */
    .hero__content p {
        font-size: 15px !important;
        line-height: 1.6 !important;
        margin-bottom: 20px !important;
        color: #fff !important;
        text-shadow: 1px 1px 2px rgba(0,0,0,0.5) !important;
        max-width: 90% !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }
    
    /* Hero list responsive */
    .hero__content .xb-list {
        margin: 20px auto !important;
        max-width: 280px !important;
        text-align: left !important;
        padding: 0 !important;
    }
    
    .hero__content .xb-list li {
        font-size: 14px !important;
        margin-bottom: 10px !important;
        padding-left: 25px !important;
        position: relative !important;
        color: #fff !important;
        text-shadow: 1px 1px 2px rgba(0,0,0,0.5) !important;
    }
    
    .hero__content .xb-list li i {
        position: absolute !important;
        left: 0 !important;
        top: 3px !important;
        font-size: 14px !important;
        color: var(--color-primary, #FFC107) !important;
    }
    
    /* Hero buttons responsive */
    .hero__content .btns {
        display: flex !important;
        flex-direction: column !important;
        gap: 12px !important;
        margin-top: 25px !important;
        align-items: center !important;
    }
    
    .hero__content .btns .thm-btn {
        width: 100% !important;
        max-width: 250px !important;
        padding: 14px 25px !important;
        font-size: 15px !important;
        font-weight: 600 !important;
        text-align: center !important;
        border-radius: 5px !important;
        transition: all 0.3s ease !important;
    }
    
    /* Primary button style */
    .hero__content .btns .thm-btn:first-child {
        background: var(--color-primary, #FFC107) !important;
        color: #000 !important;
        border: 2px solid var(--color-primary, #FFC107) !important;
    }
    
    .hero__content .btns .thm-btn:first-child:active {
        transform: scale(0.98) !important;
    }
    
    /* Secondary button style */
    .hero__content .btns .thm-btn--white {
        background: transparent !important;
        color: #fff !important;
        border: 2px solid #fff !important;
    }
    
    .hero__content .btns .thm-btn--white:active {
        background: rgba(255,255,255,0.1) !important;
    }
    
    /* Remove animations on mobile */
    .hero__content .wow {
        animation: none !important;
        visibility: visible !important;
    }
    
    /* Column adjustments */
    .hero .row {
        margin: 0 !important;
    }
    
    .hero [class*="col-"] {
        padding: 0 15px !important;
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    .hero,
    .hero__style-one {
        padding-top: 40px !important;
        padding-bottom: 30px !important;
    }
    
    .hero__content h1 {
        font-size: 24px !important;
        margin-bottom: 12px !important;
    }
    
    .hero__content p {
        font-size: 14px !important;
        margin-bottom: 15px !important;
    }
    
    .hero__content .xb-list {
        margin: 15px auto !important;
    }
    
    .hero__content .xb-list li {
        font-size: 13px !important;
        margin-bottom: 8px !important;
    }
    
    .hero__content .btns {
        gap: 10px !important;
        margin-top: 20px !important;
    }
    
    .hero__content .btns .thm-btn {
        padding: 12px 20px !important;
        font-size: 14px !important;
    }
}

/* Landscape orientation */
@media (max-width: 767px) and (orientation: landscape) {
    .hero {
        padding-top: 30px !important;
        padding-bottom: 25px !important;
    }
    
    .hero__content h1 {
        font-size: 22px !important;
        margin-bottom: 10px !important;
    }
    
    .hero__content p {
        font-size: 13px !important;
        margin-bottom: 12px !important;
    }
    
    .hero__content .xb-list {
        display: none !important; /* Hide list in landscape to save space */
    }
    
    .hero__content .btns {
        flex-direction: row !important;
        justify-content: center !important;
        gap: 10px !important;
        margin-top: 15px !important;
    }
    
    .hero__content .btns .thm-btn {
        width: auto !important;
        min-width: 120px !important;
        padding: 10px 20px !important;
        font-size: 13px !important;
    }
}

/* Admin bar compensation */
@media (max-width: 767px) {
    body.admin-bar .hero {
        padding-top: calc(50px + 46px) !important;
    }
}

@media (max-width: 600px) {
    body.admin-bar .hero {
        padding-top: calc(50px + 46px) !important;
    }
}

/* Fix for sticky header scenarios */
@media (max-width: 767px) {
    .stricky-fixed ~ .hero,
    .header-fixed ~ .hero,
    .sticky-header ~ .hero,
    body.has-sticky-header .hero {
        padding-top: 60px !important;
    }
    
    body.admin-bar.has-sticky-header .hero {
        padding-top: calc(60px + 46px) !important;
    }
}

/* Ensure proper spacing for first section */
@media (max-width: 767px) {
    body.home .hero:first-of-type,
    body.front-page .hero:first-of-type,
    body.page-template-front-page .hero:first-of-type,
    main > .hero:first-child,
    #content > .hero:first-child {
        margin-top: 0 !important;
    }
}

/* High priority overrides */
@media (max-width: 767px) {
    section.hero.hero__style-one {
        margin-top: 0 !important;
        padding-top: 50px !important;
        min-height: unset !important;
        height: auto !important;
    }
    
    /* Remove any inline padding that might be added */
    .hero[style*="padding-top"] {
        padding-top: 50px !important;
    }
}

/* Accessibility improvements */
@media (max-width: 767px) {
    .hero__content .thm-btn:focus,
    .hero__content .thm-btn:hover {
        outline: 2px solid #fff !important;
        outline-offset: 2px !important;
    }
    
    .hero__content a {
        text-decoration: none !important;
    }
}

/* Performance optimizations */
@media (max-width: 767px) {
    .hero {
        will-change: auto !important;
        transform: none !important;
    }
    
    .hero * {
        -webkit-backface-visibility: hidden !important;
        backface-visibility: hidden !important;
    }
}