/* =======================================================
   VF Page Builder – v2.0.1 (PC Gap Fix)
   ======================================================= */

:root {
    --vfp-primary: #1464f4;
    --vfp-primary-hover: #0d51c9;
    --vfp-text-main: #1e293b;
    --vfp-text-muted: #64748b;
    --vfp-bg-white: #ffffff;
    --vfp-bg-light: #f8fafc;
    --vfp-border: #e2e8f0;
    --vfp-radius-lg: 16px;
    --vfp-radius-md: 12px;
    --vfp-gap-mob: 20px;
    --vfp-gap-desk: 30px;
    --vfp-font: 'Be Vietnam Pro', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --vfp-touch-target: 44px;
}

/* ── 1. BASE & RESET ────────────────────────────────── */
.vfpb-s, .vfpb-s * {
    box-sizing: border-box;
}

.vfpb-s {
    width: 100%;
    font-family: var(--vfp-font);
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
    position: relative;
    color: var(--vfp-text-main);
}

.vfpb-full-width-canvas {
    width: 100% !important;
    max-width: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* WP Theme Integration */
.entry-content:has(.vfpb-full-width-canvas), 
/* ── 2. LAYOUT SYSTEM (MOBILE FIRST) ────────────────── */

/* VinFast 3S Theme Fix: Remove/Reduce extra space */
.vfpb-active-page .header-spacer {
    height: 60px !important; /* Sit closer to the fixed header */
}

@media (max-width: 600px) {
    .vfpb-active-page .header-spacer {
        height: 50px !important;
    }
}

/* ── Sections ────────────────────────────────────────── */
.vfpb-section-fe {
    padding: 15px 15px; /* ULTRA-TIGHT mobile padding */
}

.vfpb-section-fh {
    min-height: auto; 
}

.vfpb-section-full {
    padding: 0 !important;
    max-width: none !important;
}

.vfpb-row-fw {
    max-width: none !important;
    width: 100% !important;
    margin: 0 !important;
}

.vfpb-no-pt { padding-top: 0 !important; }
.vfpb-no-pb { padding-bottom: 0 !important; }

/* Rows - Mobile First: Vertical Stack */
.vfpb-row-fe {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    gap: 10px; /* Reduced from 20px */
}

/* Columns - Default (allows inline styles from PHP to work) */
.vfpb-col-fe {
    min-width: 0;
    box-sizing: border-box;
}

@media (max-width: 600px) {
    .vfpb-col-fe {
        width: 100% !important;
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }
}

/* Image-Text & Slider-Text stacking */
.vfpb-fe-it, .vfpb-fe-st {
    display: flex;
    flex-direction: column;
    gap: 24px;
    width: 100%;
}

.vfpb-it-img, .vfpb-st-img { width: 100%; }
.vfpb-it-text-wrap, .vfpb-st-text-wrap { width: 100%; text-align: center; }

/* Mobile Slider Logic (Scoped strictly to Mobile) */
@media (max-width: 600px) {
    .vfpb-row-mob-slider {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        padding: 0 15px 20px !important;
        gap: 15px !important;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
    }

    .vfpb-row-mob-slider .vfpb-col-fe {
        flex: 0 0 85% !important;
        width: 85% !important;
        max-width: 85% !important;
        scroll-snap-align: center;
    }

    .vfpb-s .vfpb-multi-grid {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        gap: 15px !important;
        padding: 0 0 15px !important;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
    }

    .vfpb-s .vfpb-multi-grid > div {
        flex: 0 0 85% !important;
        max-width: 85% !important;
        scroll-snap-align: center;
    }

    /* Slider fallbacks if JS fails or before init */
    .vfpb-multi-slider:not(.swiper-initialized) .swiper-wrapper,
    .vfpb-features-slider:not(.swiper-initialized) .swiper-wrapper {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        gap: 15px !important;
        padding-bottom: 15px !important;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
    }
    .vfpb-multi-slider:not(.swiper-initialized) .swiper-slide,
    .vfpb-features-slider:not(.swiper-initialized) .swiper-slide {
        flex: 0 0 85% !important;
        max-width: 85% !important;
        scroll-snap-align: center;
    }
    
    /* Hide scrollbar for slider */
    .vfpb-row-mob-slider::-webkit-scrollbar, .vfpb-multi-grid::-webkit-scrollbar { display: none !important; }
}

/* ── 3. DESKTOP ADAPTATION (MIN-WIDTH) ──────────────── */

@media (min-width: 600px) {
    .vfpb-section-fe {
        padding: 20px 20px;
    }
    
    /* Extra tight for first section to avoid double space with header-spacer */
    .vfpb-active-page .vfpb-section-fe:first-of-type {
        padding-top: 10px !important;
    }
    
    .vfpb-section-fh {
        min-height: 100vh !important;
        display: flex;
        align-items: center;
    }

    .vfpb-row-fe {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        gap: 0; /* Default to 0, backend will override if needed */
    }

    /* Standard Column Logic */
    .vfpb-col-fe {
        flex: 1; 
        width: auto;
        max-width: none;
    }

    /* Grid adaptation for desktop */
    .vfpb-fe-it {
        display: grid;
        grid-template-columns: var(--vfp-it-cols, 1fr 1fr);
        gap: var(--vfp-it-gap, 40px);
        align-items: center;
    }

    .vfpb-fe-st {
        display: grid;
        grid-template-columns: var(--vfp-st-cols, 1fr 1fr);
        gap: var(--vfp-st-gap, 40px);
        align-items: center;
    }

    .vfpb-it-text-wrap, .vfpb-st-text-wrap {
        text-align: left;
    }
    
    /* Explicit Grid for multi-grid on PC */
    .vfpb-s .vfpb-multi-grid {
        display: grid !important;
        overflow: visible !important;
    }


}

/* ── 4. WIDGETS & UI COMPONENTS ─────────────────────── */

/* Typography */
.vfpb-heading-fe {
    font-size: clamp(1.5rem, 4vw, 2.8rem);
    line-height: 1.2;
    margin-bottom: 0.5em;
    font-weight: 700;
}

.vfpb-text-fe {
    font-size: 1rem;
    line-height: 1.7;
    margin-bottom: 1rem;
    color: var(--vfp-text-muted);
}

/* Images */
.vfpb-fe-fig img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: var(--vfp-radius-md);
}

/* Buttons & Touch Targets */
.vfpb-btn {
    min-height: var(--vfp-touch-target);
    padding: 12px 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.2s ease;
}

/* Accordion */
.vfpb-acc-head {
    min-height: var(--vfp-touch-target);
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    background: var(--vfp-bg-white);
    border-bottom: 1px solid var(--vfp-border);
}

/* ── 5. PERFORMANCE & UTILITIES ────────────────────── */

.vfpb-fe-w-spacer {
    display: block;
    width: 100%;
    margin-top: var(--vfp-w-mt, 0);
    margin-bottom: var(--vfp-w-mb, 10px);
    padding-left: var(--vfp-w-pl, 0);
    padding-right: var(--vfp-w-pr, 0);
}

@media (max-width: 600px) {
    .vfpb-fe-w-spacer {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
}

@media (min-width: 600px) {
    .vfpb-fe-w-spacer { margin-bottom: 40px; }
}

/* Lazy load opacity transition */
img[loading="lazy"] {
    transition: opacity 0.3s;
}

/* Swiper Pagination (Mobile Fixed) */
.vfpb-s .swiper-pagination {
    position: relative !important;
    bottom: auto !important;
    margin-top: 15px !important;
    text-align: center;
}

.vfpb-s .swiper-pagination-bullet {
    width: 8px;
    height: 8px;
    background: var(--vfp-primary);
    opacity: 0.3;
}

.vfpb-s .swiper-pagination-bullet-active {
    width: 24px;
    border-radius: 4px;
    opacity: 1;
}

/* ── 6. AGGRESSIVE RESETS (V1.3.1 LEGACY SUPPORT) ──── */
@media (max-width: 600px) {
    .vfpb-fe-w-spacer, .vfpb-mb-item, .vfpb-fs-item {
        height: auto !important;
        min-height: 0 !important;
    }
}
