/* =======================================================
   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 */
    position: relative;
}

.vfpb-overlay-layer {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

.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 */
    position: relative;
    z-index: 2;
    justify-content: center;
}

/* 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;
    }

    /* Equal Height Columns */
    .vfpb-section-eqh .vfpb-row-fe { align-items: stretch !important; }
    .vfpb-section-eqh .vfpb-col-fe { display: flex !important; flex-direction: column !important; }
    .vfpb-section-eqh .vfpb-fe-w-spacer { flex: 1 !important; display: flex !important; flex-direction: column !important; }
    .vfpb-section-eqh .vfpb-widget-icon_box { height: 100% !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);
}

/* ── 7. LIST STYLING (BULLET FIX) ──────────────────── */
/* Restore standard list behavior stripped by resets */
.vfpb-s ul, .vfpb-s ol {
    margin-top: 10px !important;
    margin-bottom: 15px !important;
    padding-left: 25px !important; /* Critical: restores bullet indentation */
    list-style-position: outside !important;
}

.vfpb-s ul { list-style-type: disc !important; }
.vfpb-s ol { list-style-type: decimal !important; }

.vfpb-s li {
    display: list-item !important;
    margin-bottom: 8px !important;
    line-height: 1.6 !important;
    text-align: left !important; /* Keep text next to bullet regardless of parent alignment */
}

/* Symmetrical alignment for lists inside centered containers */
@media (max-width: 600px) {
    .vfpb-text-fe ul, .vfpb-text-fe ol,
    .vfpb-ib-content ul, .vfpb-ib-content ol,
    .vfpb-it-text ul, .vfpb-it-text ol {
        display: inline-block;
        text-align: left;
        max-width: 100%;
    }
}

/* 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;
}

/* ── 8. NEWS & POST GRID ENHANCEMENTS ──────────────── */
.vfpb-widget-post_grid h3 a,
.vfpb-news-slider h3 a,
.news-cat-section h3 a {
    color: #0f172a !important; /* Ultra-dark for maximum contrast */
    font-weight: 800 !important;   /* Thicker font for better prominence */
    transition: color 0.3s ease !important;
}

.vfpb-widget-post_grid h3 a:hover,
.vfpb-news-slider h3 a:hover,
.news-cat-section h3 a:hover {
    color: var(--vfp-primary) !important; /* VinFast Blue on hover */
}

/* Slider Centering Fix */
.vfpb-features-slider, .vfpb-multi-slider {
    width: 100%;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 0;
    padding-right: 0;
}
.vfpb-features-slider .swiper-wrapper, .vfpb-multi-slider .swiper-wrapper {
    display: flex;
}

/* ── 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;
    }
}

/* ── 9. VIDEO WIDGET ENHANCEMENTS ─────────────────── */
.vfpb-video-wrap {
    position: relative;
    width: 100%;
}

.vfpb-video-mute-btn {
    position: absolute;
    bottom: 20px;
    right: 20px;
    z-index: 10;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
}

.vfpb-video-mute-btn:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

.vfpb-mute-icon {
    font-size: 18px;
    line-height: 1;
}

@media (max-width: 600px) {
    .vfpb-video-mute-btn {
        bottom: 15px;
        right: 15px;
        width: 38px;
        height: 38px;
    }
    .vfpb-mute-icon {
        font-size: 16px;
    }
}

/* ── 10. LINKS & HYPERLINKS ENHANCEMENTS ─────────────── */
.vfpb-s a {
    color: var(--vfp-primary, #1464f4);
    text-decoration: none;
    font-weight: 600;
    border-bottom: 1.5px solid transparent;
    transition: all 0.2s ease-in-out;
}

.vfpb-s a:hover {
    color: var(--vfp-primary-hover, #0d51c9);
    border-bottom-color: var(--vfp-primary-hover, #0d51c9);
}

.vfpb-s a:active {
    opacity: 0.85;
}

/* ── 11. RESPONSIVE IMAGE SUPPORT ──────────────────── */
.vfpb-responsive-img-wrapper {
    position: relative;
    display: inline-block;
    vertical-align: middle;
    width: 100%;
}
.vfpb-responsive-img-wrapper .vfpb-desktop-img {
    display: block !important;
}
.vfpb-responsive-img-wrapper .vfpb-mobile-img {
    display: none !important;
}
@media (max-width: 768px) {
    .vfpb-responsive-img-wrapper .vfpb-desktop-img {
        display: none !important;
    }
    .vfpb-responsive-img-wrapper .vfpb-mobile-img {
        display: block !important;
    }
}

