/**
 * Styles frontend pour les bandeaux publicitaires
 *
 * @package Contextual_Ads_Plugin
 */

/* Import de la police Open Sans depuis Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@400&display=swap');

.cap-ad-container {
    margin: 20px 0;
    clear: both;
}

/* En-tête du bandeau : titre en haut, flèches en dessous (desktop uniquement) */
.cap-ad-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    margin-bottom: 10px;
}

/* Titre du bandeau publicitaire */
.cap-ad-banner-title {
    background: #ffffff;
    color: #000000;
    padding: 0;
    font-family: 'Open Sans', sans-serif;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: .3px;
    margin-bottom: 0;
}
.cap-ad-banner-title__text {
    display: block;
}

/* Flèches de navigation desktop (sous le titre) — masquées en desktop */
.cap-ad-nav-desktop {
    display: none;
}

/* Wrapper produits (sans flèches latérales) */
.cap-ad-wrapper {
    position: relative;
    display: flex;
    align-items: stretch;
}
.cap-ad-wrapper .product-list {
    flex: 1;
    min-width: 0;
}
.cap-nav-btn {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 50%;
    background: #1a3a5c;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s, opacity .2s;
    padding: 0;
    z-index: 2;
}
.cap-nav-btn:hover {
    background: #d03a0c;
}
.cap-nav-btn:disabled {
    opacity: .3;
    cursor: default;
    pointer-events: none;
}

/* Espacement header sur mobile */
@media (max-width: 768px) {
    .cap-ad-header {
        margin-bottom: 6px;
    }
}

.product-list {
    display: flex;
    gap: 15px;
    justify-content: flex-start;
    flex-wrap: nowrap;
    padding: 0;
    margin: 0;
    list-style: none;
}

/* Centrage quand le nombre de produits est inférieur au nombre visible (ex: 2 ou 3 produits) */
.product-list.cap-few-products {
    justify-content: center;
}

.product-card {
    padding: 10px 10px 12px 10px;
    text-align: center;
    width: calc(25% - 12px);
    min-width: 200px;
    max-width: 280px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    flex-shrink: 1;
    font-family: 'Open Sans', sans-serif;
    font-weight: 400;
    font-size: 14px;
}

.product-card img {
    display: block;
    margin: 0 auto 10px;
    max-width: 100%;
    height: auto;
}

.product-info ul.wp-product-list {
    text-align: left !important;
    list-style: none !important;
    list-style-type: none !important;
    padding-left: 0 !important;
    margin-top: 5px !important;
    margin-left: 0 !important;
    margin-bottom: 10px !important;
    font-size: 13px !important;
    line-height: normal;
}

.product-info ul.wp-product-list li {
    margin-bottom: 2px !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    padding-left: 20px !important;
    position: relative;
    display: list-item !important;
}

/* Puce carrée personnalisée avec ::before */
.product-info ul.wp-product-list li::before {
    content: '■' !important;
    position: absolute;
    left: 5px;
    color: inherit;
    font-size: 1em;
    line-height: 1.4;
}

.product-card .price {
    font-weight: bold;
    color: #d9534f;
    margin-top: 0;
    margin-bottom: 0;
    display: block;
    font-size: 18px;
}

/* Bouton fixé en bas de la carte */
.product-card a.product-link {
    display: block;
    margin-top: auto;
    margin-bottom: 0;
    text-decoration: none !important;
    background-color: #d03a0c !important;
    color: white !important;
    padding: 5px;
    border-radius: 4px;
    transition: background-color 0.3s ease;
    position: relative;
    height: 45px;
    line-height: 35px;
    box-sizing: border-box;
    font-size: 14px;
    font-weight:bold !important;
}

.product-card a.product-link:hover {
    background-color: #80b601 !important;
}

.product-card .product-name {
    flex-grow: 1;
    font-weight: 500;
    margin-bottom: 0;
    line-height: 1.3;
}

/* =============================================
   MOBILE : Carrousel swipeable (≤ 768px)
   ============================================= */
@media (max-width: 768px) {

    /* Conteneur principal : masque ce qui déborde */
    .cap-ad-container {
        position: relative;
        overflow: hidden;
        padding-bottom: 35px; /* Espace pour les points */
    }

    /* Piste du carrousel : largeur = nb_cartes × 100% */
    .product-list {
        display: flex;
        flex-wrap: nowrap;
        gap: 0;
        padding: 0;
        margin: 0;
        justify-content: flex-start;
        /* La largeur et le transform sont gérés par JS */
        transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
        will-change: transform;
        cursor: grab;
    }

    .product-list.cap-no-transition {
        transition: none !important;
    }

    .product-list.cap-dragging {
        cursor: grabbing;
    }

    /* Chaque carte = 100% de la largeur visible */
    .product-card {
        flex: 0 0 100%;
        width: 100%;
        min-width: 0;
        max-width: 100%;
        box-sizing: border-box;
        padding: 10px 15px 12px 15px;
    }

    /* Flèches de navigation */
    /* Bug 7 : masquées par défaut, affichées par JS via .toggle() dans goTo() */
    .cap-carousel-prev,
    .cap-carousel-next {
        display: none;
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        width: 32px;
        height: 32px;
        background: rgba(208, 58, 12, 0.9);
        color: white;
        border: none;
        border-radius: 50%;
        font-size: 22px;
        font-family: Arial, sans-serif;
        font-weight: 300;
        line-height: 1;
        cursor: pointer;
        z-index: 20;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0;
        margin: 0;
        text-align: center;
        box-shadow: 0 2px 4px rgba(0,0,0,0.3);
        /* Correction centrage flèche SVG */
        -webkit-appearance: none;
        appearance: none;
        vertical-align: middle;
    }

    .cap-carousel-prev svg,
    .cap-carousel-next svg {
        display: block;
        flex-shrink: 0;
    }

    .cap-carousel-prev {
        left: 4px;
    }

    .cap-carousel-next {
        right: 4px;
    }

    .cap-carousel-prev:hover,
    .cap-carousel-next:hover {
        background: rgba(128, 182, 1, 0.9);
    }

    /* Points de pagination */
    .cap-carousel-dots {
        position: absolute;
        bottom: 8px;
        left: 0;
        right: 0;
        display: flex;
        justify-content: center;
        gap: 6px;
    }

    .cap-carousel-dot {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: #ccc;
        border: none;
        padding: 0;
        cursor: pointer;
        transition: background 0.2s ease;
    }

    .cap-carousel-dot.cap-active {
        background: #d03a0c;
        transform: scale(1.2);
    }
}

@media (max-width: 480px) {
    .product-card .product-name {
        font-size: 0.9em;
    }

    .product-info ul {
        font-size: 0.8em;
    }
}

/* ============================================================
   Bandeau vidéo YouTube — cap-youtube-banner (iframe)
   ============================================================ */
.cap-youtube-banner {
    margin: 24px 0;
    width: 100%;
    max-width: 100%;
    line-height: 0; /* évite l'espace sous l'iframe */
}
.cap-youtube-banner__iframe {
    display: block;
    width: 100%;
    height: 450px;
    border: 0;
    border-radius: 6px;
    overflow: hidden;
}
/* ── Responsive ── */
@media (max-width: 768px) {
    .cap-youtube-banner__iframe {
        height: 280px;
    }
}
@media (max-width: 480px) {
    .cap-youtube-banner__iframe {
        height: 220px;
    }
}


/* Bouton play centré */


/* Titre de la vidéo */

/* ── Responsive ── */
@media (max-width: 480px) {
    .cap-youtube-banner {
        max-width: 100%;
    }

}
