/* ===================================
   Mobile Responsive Fixes
   Target: iPhone ~390px viewport

   Fixes for issues reported in screenshots:
   1. Hero features list alignment
   2. Step circles centering
   3. Checkbox list left margin
   4. Feature cards text wrapping
   5. Stats grid layout
   6. General mobile polish
   =================================== */

/* === 1. Hero Features List - Better mobile alignment === */
@media (max-width: 576px) {
    .hero-features-list {
        padding: 0 8px;
        margin: 24px auto;
        max-width: 100%;
    }

    .hero-features-list li {
        padding: 12px 14px;
        font-size: 15px;
        gap: 10px;
        text-align: left;
    }

    .hero-features-list li span {
        flex: 1;
        line-height: 1.4;
    }

    .hero-features-list i {
        width: 24px;
        height: 24px;
        font-size: 18px;
        flex-shrink: 0;
        min-width: 24px;
    }
}

/* === 2. Step Circles - Centered on mobile === */
@media (max-width: 767px) {
    /* Force centering for step sections */
    .col-md-4,
    .col-md-6.col-lg-3,
    .col-md-3 {
        text-align: center;
    }

    /* Step number circles - ensure center alignment */
    .step-number {
        margin-left: auto !important;
        margin-right: auto !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
    }

    /* Steps section - stack vertically with proper spacing */
    section .row.g-5 > [class*="col-"] {
        margin-bottom: 32px;
    }

    section .row.g-5 > [class*="col-"]:last-child {
        margin-bottom: 0;
    }

    /* How it works section - centered content */
    .bg-dark .text-center,
    .bg-light .text-center {
        text-align: center !important;
    }

    /* Employers 4 steps - center each step */
    .col-md-6.col-lg-3 .text-center {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .col-md-6.col-lg-3 .text-center h3,
    .col-md-6.col-lg-3 .text-center p {
        max-width: 280px;
        margin-left: auto;
        margin-right: auto;
    }
}

/* === 3. Checkbox/Benefits List - Fix left margin and alignment === */
@media (max-width: 767px) {
    /* Hero card with checkmarks (employers.php) */
    .hero-section .card .list-unstyled {
        padding: 0;
        margin: 0;
    }

    .hero-section .card .list-unstyled li {
        display: flex !important;
        align-items: flex-start !important;
        gap: 12px !important;
        padding: 14px 0 !important;
        margin-bottom: 0 !important;
        border-bottom: 1px solid #E5E7EB;
    }

    .hero-section .card .list-unstyled li:last-child {
        border-bottom: none;
        padding-bottom: 0 !important;
    }

    .hero-section .card .list-unstyled li i {
        flex-shrink: 0 !important;
        width: 22px !important;
        height: 22px !important;
        margin-top: 1px;
    }

    .hero-section .card .list-unstyled li span {
        flex: 1;
        line-height: 1.45;
        font-size: 14px;
    }

    /* Fix d-flex align-items-start on mobile */
    .d-flex.align-items-start {
        gap: 12px;
    }

    .d-flex.align-items-start > i {
        flex-shrink: 0;
        margin-top: 2px;
    }

    /* List items with me-3 class - reduce gap on mobile */
    .list-unstyled li .me-3 {
        margin-right: 10px !important;
    }

    /* Benefits list - ensure proper alignment */
    .list-unstyled .mb-3.d-flex {
        margin-bottom: 12px !important;
    }
}

/* === 4. Feature Cards - Better text handling on mobile === */
@media (max-width: 576px) {
    .feature-card {
        padding: 20px 16px;
        text-align: center;
    }

    .feature-card .feature-icon {
        width: 56px;
        height: 56px;
        font-size: 1.5rem;
        margin-bottom: 14px;
    }

    .feature-title {
        font-size: 1rem;
        margin-bottom: 10px;
        line-height: 1.3;
    }

    .feature-description {
        font-size: 0.9rem;
        line-height: 1.5;
        word-wrap: break-word;
        hyphens: auto;
    }

    /* Cards grid - ensure proper stacking */
    .col-md-6.col-lg-3 {
        width: 100%;
        margin-bottom: 16px;
    }

    .col-md-6.col-lg-3:last-child {
        margin-bottom: 0;
    }
}

/* === 5. Stats/Trust Stats Grid - Mobile optimization === */
@media (max-width: 576px) {
    /* Stats section - 2x2 grid with better spacing */
    .trust-stat {
        padding: 12px 8px;
    }

    .trust-stat-number {
        font-size: 1.75rem;
        line-height: 1.2;
        margin-bottom: 4px;
    }

    .trust-stat-label {
        font-size: 12px;
        line-height: 1.3;
        word-wrap: break-word;
    }

    /* Ensure 2-column layout on small mobile */
    .row.g-4.text-center > .col-6 {
        padding: 6px;
    }

    /* Stats with larger numbers */
    section.py-5.bg-white .trust-stat-number {
        font-size: 1.6rem;
    }

    /* guards.php stats section specific */
    .bg-white .trust-stat {
        padding: 10px 6px;
    }
}

/* Very small screens (< 375px) - switch to single column if needed */
@media (max-width: 374px) {
    .trust-stat-number {
        font-size: 1.5rem;
    }

    .trust-stat-label {
        font-size: 12px; /* A3 a11y: min readable size (was 11px) */
    }
}

/* === 6. General Mobile Polish === */
@media (max-width: 767px) {
    /* Container padding */
    .container {
        padding-left: 16px;
        padding-right: 16px;
    }

    /* Section padding reduction */
    section.py-5 {
        padding-top: 2.5rem !important;
        padding-bottom: 2.5rem !important;
    }

    section .py-5,
    section .py-4 {
        padding-top: 1.5rem !important;
        padding-bottom: 1.5rem !important;
    }

    /* Headings - reduce size on mobile */
    .display-4 {
        font-size: 1.75rem;
    }

    .display-5 {
        font-size: 1.5rem;
    }

    /* Lead text */
    .lead {
        font-size: 1rem;
    }

    /* Row gap adjustment */
    .row.g-5 {
        --bs-gutter-y: 1.5rem;
    }

    .row.g-4 {
        --bs-gutter-y: 1rem;
    }

    /* Hero section mobile */
    .hero-section,
    .hero {
        padding: 40px 0;
    }

    .hero-title {
        font-size: 1.75rem;
        line-height: 1.2;
        margin-bottom: 1rem;
    }

    .hero-subtitle {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }

    /* Hero buttons */
    .hero-buttons {
        gap: 12px;
    }

    .hero-buttons .btn {
        width: 100%;
        min-width: auto;
        padding: 14px 20px;
        font-size: 15px;
    }

    /* CTA section */
    .cta-section {
        padding: 40px 0;
    }

    .cta-section h2 {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }

    .cta-section .lead {
        font-size: 0.95rem;
        margin-bottom: 1.5rem;
    }
}

/* === 7. Employers page specific fixes === */
@media (max-width: 767px) {
    /* Hero card on employers.php */
    .hero-section .card.bg-white {
        margin-top: 24px;
    }

    .hero-section .card .card-body {
        padding: 20px !important;
    }

    .hero-section .card h3.h4 {
        font-size: 1.15rem;
        margin-bottom: 16px;
    }

    /* Benefits cards grid */
    .col-md-6.col-lg-4 {
        margin-bottom: 16px;
    }

    .col-md-6.col-lg-4:last-child {
        margin-bottom: 0;
    }

    /* Benefits card content */
    .col-md-6.col-lg-4 .card {
        height: auto;
    }

    .col-md-6.col-lg-4 .card .card-body {
        padding: 20px;
    }

    .col-md-6.col-lg-4 .card i {
        font-size: 2.5rem !important;
    }
}

/* === 8. Guards page specific fixes === */
@media (max-width: 767px) {
    /* Testimonial cards */
    .col-lg-4 .card {
        margin-bottom: 16px;
    }

    .col-lg-4:last-child .card {
        margin-bottom: 0;
    }

    /* FAQ accordion */
    .accordion-button {
        padding: 14px 16px;
        font-size: 14px;
    }

    .accordion-body {
        padding: 14px 16px;
        font-size: 14px;
    }
}

/* === 9. Fix Bootstrap column text centering on mobile === */
@media (max-width: 767px) {
    /* Ensure all step sections are centered */
    [class*="col-md-"].text-center,
    [class*="col-lg-"].text-center {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    /* Step descriptions - limit width for readability */
    .col-md-4 .text-center p,
    .col-md-6.col-lg-3 .text-center p {
        max-width: 300px;
    }

    /* Price card - full width on mobile */
    .col-lg-8 {
        padding-left: 0;
        padding-right: 0;
    }

    .col-lg-8 .card {
        border-radius: 12px;
    }
}

/* === 10. Touch-friendly improvements === */
@media (max-width: 767px) {
    /* Ensure minimum tap target sizes */
    .btn,
    .nav-link,
    a.btn {
        min-height: 44px;
        min-width: 44px;
    }

    /* Accordion buttons */
    .accordion-button {
        min-height: 48px;
    }

    /* Smooth scrolling for iOS */
    html {
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
    }
}

/* === 11. Employers.php - Hero card checkmarks fix === */
@media (max-width: 767px) {
    /* Fix the card inside hero with checklist */
    .hero-section .card.bg-white.text-dark {
        margin-top: 20px;
    }

    .hero-section .card.bg-white .card-body {
        padding: 20px;
    }

    /* Checklist items alignment */
    .hero-section .card .list-unstyled .mb-3.d-flex.align-items-start,
    .hero-section .card .list-unstyled .d-flex.align-items-start {
        display: flex !important;
        align-items: flex-start !important;
        gap: 10px;
        padding: 10px 0;
        margin-bottom: 0 !important;
    }

    .hero-section .card .list-unstyled .mb-3.d-flex.align-items-start i,
    .hero-section .card .list-unstyled .d-flex.align-items-start i {
        flex-shrink: 0;
        width: 20px;
        min-width: 20px;
        margin-right: 0 !important;
        margin-top: 2px;
    }

    .hero-section .card .list-unstyled .mb-3.d-flex.align-items-start span,
    .hero-section .card .list-unstyled .d-flex.align-items-start span {
        flex: 1;
        line-height: 1.4;
        font-size: 14px;
    }
}

/* === 12. Explicit step-number mobile centering === */
@media (max-width: 767px) {
    /* Force step numbers to center */
    .step-number {
        margin: 0 auto 16px auto !important;
    }

    /* Flex container for steps */
    .text-center.d-flex.flex-column.align-items-center {
        width: 100%;
    }

    /* Step text containers */
    .text-center.d-flex.flex-column.align-items-center h3,
    .text-center.d-flex.flex-column.align-items-center p {
        text-align: center;
        width: 100%;
        max-width: 280px;
    }
}

/* === 13. guards.php stats section specific === */
@media (max-width: 576px) {
    /* Trust stats on guards page - smaller viewport */
    .py-5.bg-white .row.g-4.text-center {
        margin: 0;
    }

    .py-5.bg-white .row.g-4.text-center .col-6 {
        padding: 8px;
    }

    .py-5.bg-white .trust-stat {
        padding: 10px 4px;
    }

    .py-5.bg-white .trust-stat-number {
        font-size: 1.5rem;
        white-space: nowrap;
    }

    .py-5.bg-white .trust-stat-label {
        font-size: 12px; /* A3 a11y: min readable size (was 11px) */
        line-height: 1.25;
    }
}

/* === 14. Feature cards grid on mobile === */
@media (max-width: 767px) {
    /* 2-column grid for feature cards on tablet/large mobile */
    .row.g-4 > .col-md-6.col-lg-3 {
        flex: 0 0 50%;
        max-width: 50%;
    }
}

@media (max-width: 575px) {
    /* Single column on small mobile */
    .row.g-4 > .col-md-6.col-lg-3 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .feature-card {
        margin-bottom: 12px;
    }
}

/* === 15. Employers 4-step grid - 2x2 on mobile === */
@media (max-width: 991px) and (min-width: 576px) {
    .bg-light .row.g-4.g-lg-5 > .col-6.col-lg-3 {
        flex: 0 0 50%;
        max-width: 50%;
    }
}

@media (max-width: 575px) {
    .bg-light .row.g-4.g-lg-5 > .col-6.col-lg-3 {
        flex: 0 0 50%;
        max-width: 50%;
        padding: 8px;
    }

    .bg-light .row.g-4.g-lg-5 > .col-6.col-lg-3 .step-number {
        width: 60px !important;
        height: 60px !important;
    }

    .bg-light .row.g-4.g-lg-5 > .col-6.col-lg-3 .step-number span {
        font-size: 1.25rem !important;
    }

    .bg-light .row.g-4.g-lg-5 > .col-6.col-lg-3 h3 {
        font-size: 0.85rem;
        margin-bottom: 0.5rem;
    }

    .bg-light .row.g-4.g-lg-5 > .col-6.col-lg-3 p {
        font-size: 0.75rem;
        line-height: 1.3;
    }
}
