/**
 * Product Grid - Design Référence
 * Style correspondant exactement à la maquette fournie
 */

/* Container principal */
.electwatch-immersive-view {
    width: 100%;
    min-height: 100vh;
    background: #000;
    position: relative;
    overflow: hidden;
}

.ew-products-container {
    width: 100%;
    height: 100vh;
    overflow-y: auto;
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* Chaque produit = 1 slide fullscreen */
.ew-product-slide {
    width: 100%;
    height: 100vh;
    position: relative;
    scroll-snap-align: start;
    scroll-snap-stop: always;
}

/* Image de fond */
.ew-bg-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.ew-bg-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom,
            rgba(0, 0, 0, 0.5) 0%,
            rgba(0, 0, 0, 0.1) 30%,
            rgba(0, 0, 0, 0.1) 70%,
            rgba(0, 0, 0, 0.6) 100%);
}

/* =========================
   BADGE ROUGE HAUT GAUCHE (Référence)
   ========================= */
.ew-badge-reference {
    position: absolute;
    top: 20px;
    left: 16px;
    background: #EF4444;
    color: white;
    padding: 6px 14px;
    border-radius: 16px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 160;
    /* Augmenté pour passer devant overlay vidéo (150) */
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
}

/* =========================
   TITRE COMPACT EN HAUT (Référence)
   ========================= */
.ew-top-title {
    position: absolute;
    top: 60px;
    left: 16px;
    right: 100px;
    z-index: 160;
    /* Augmenté pour passer devant overlay vidéo (150) */
    color: white;
}

.ew-top-title h2 {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 4px 0;
    line-height: 1.2;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

/* Support pour titre enrichi */
.ew-rich-title,
.ew-rich-title * {
    direction: inherit;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.ew-rich-title strong,
.ew-rich-title b {
    font-weight: 900;
}

.ew-rich-title em,
.ew-rich-title i {
    font-style: italic;
}

.ew-rich-title u {
    text-decoration: underline;
}

.ew-top-title p {
    font-size: 12px;
    font-weight: 400;
    margin: 0;
    line-height: 1.3;
    opacity: 0.9;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* =========================
   PRIX EN GRAND AU CENTRE (Référence)
   ========================= */
.ew-price-center {
    position: absolute;
    top: 65%;
    /* Position par défaut (modifiable en admin) */
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 160;
    /* Augmenté pour passer devant overlay vidéo (150) */
    text-align: center;
}

.ew-price-big {
    font-size: 52px;
    font-weight: 900;
    color: white;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.7);
    line-height: 1;
    letter-spacing: -1px;
}

.ew-price-old-small {
    font-size: 16px;
    color: #EF4444;
    text-decoration: line-through;
    opacity: 0.8;
    margin-top: 4px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* =========================
   BOUTON BLANC BAS CENTRE (Référence)
   ========================= */
.ew-bottom-button {
    position: absolute;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 170;
    /* Augmenté pour être cliquable au-dessus de tout */
    text-align: center;
}

.ew-btn-white {
    padding: 14px 60px;
    background: white;
    color: #1f2937;
    border: none;
    border-radius: 24px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

.ew-btn-white:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.ew-btn-white:active {
    transform: translateY(0);
}

.ew-custom-text {
    font-size: 11px;
    color: white;
    margin-top: 10px;
    opacity: 0.8;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* =========================
   ACTIONS DROITE COLORÉES (Référence)
   =========================/* Sidebar actions - Style Outline (TikTok) */
.ew-actions-right {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 24px;
    z-index: 200;
}

.ew-action-icon-color {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ew-action-icon-color:active {
    transform: scale(0.95);
}

/* Background circulaire OUTLINE blanc */
.ew-icon-bg {
    width: 48px;
    height: 48px;
    background: transparent !important;
    /* Pas de fond coloré */
    border: 2px solid white;
    /* Contour blanc */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.2s ease;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* Hover effect subtil */
.ew-action-icon-color:hover .ew-icon-bg {
    background: rgba(255, 255, 255, 0.15) !important;
    transform: scale(1.05);
}

/* Icônes blanches */
.ew-icon-bg svg {
    filter: none !important;
}

.ew-icon-bg svg path {
    fill: white !important;
}

/* Compteur (pour likes, etc) */
.ew-mini-count {
    position: absolute;
    bottom: -2px;
    right: -2px;
    background: white;
    color: #000;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* Label sous l'icône */
.ew-action-icon-color .ew-label {
    color: white;
    font-size: 11px;
    margin-top: 6px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Suppression des couleurs spécifiques (rouge, violet, etc) */
.ew-icon-bg.red,
.ew-icon-bg.violet,
.ew-icon-bg.blue,
.ew-icon-bg.yellow {
    background: transparent !important;
    border-color: white !important;
}

/* Couleurs des icônes (Référence) */
.ew-icon-bg.white {
    background: rgba(255, 255, 255, 0.95);
    color: #1f2937;
}

.ew-icon-bg.purple {
    background: #8B5CF6;
    color: white;
}

.ew-icon-bg.red {
    background: #EF4444;
    color: white;
}

.ew-icon-bg.cyan {
    background: #06B6D4;
    color: white;
}

/* Mini compteur dans l'icône */
.ew-mini-count {
    position: absolute;
    bottom: 0;
    right: -2px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 8px;
    min-width: 16px;
    text-align: center;
    border: 2px solid currentColor;
}

.ew-label {
    font-size: 10px;
    color: white;
    margin-top: 4px;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Like button special */
.ew-like-btn.liked .ew-icon-bg.red {
    animation: heartBeat 0.4s ease;
}

/* =========================
   WHATSAPP FLOTTANT (Référence - Bas Gauche)
   ========================= */
.ew-whatsapp-float {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #25D366;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
    z-index: 9999;
    transition: all 0.3s ease;
}

.ew-whatsapp-float:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.6);
}

.ew-notification-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 12px;
    height: 12px;
    background: #EF4444;
    border-radius: 50%;
    border: 2px solid white;
    animation: pulse 2s infinite;
}

/* =========================
   INDICATEUR DE SCROLL
   ========================= */
.ew-scroll-indicator {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    animation: bounce 2s infinite;
    opacity: 0.7;
}

/* =========================
   INDICATEURS DE PROGRESSION
   ========================= */
.ew-progress-indicators {
    position: fixed;
    top: 50%;
    left: 8px;
    transform: translateY(-50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ew-indicator {
    width: 3px;
    height: 40px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.ew-indicator.active {
    background: white;
    height: 50px;
}

/* =========================
   ANIMATIONS
   ========================= */
@keyframes bounce {

    0%,
    100% {
        transform: translate(-50%, 0);
    }

    50% {
        transform: translate(-50%, -10px);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

@keyframes heartBeat {
    0% {
        transform: scale(1);
    }

    25% {
        transform: scale(1.2);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

/* Animation du coeur like (double-tap) */
.ew-like-heart {
    position: fixed;
    font-size: 80px;
    pointer-events: none;
    z-index: 10000;
    animation: likeHeart 1s ease forwards;
}

@keyframes likeHeart {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(0);
    }

    50% {
        opacity: 1;
        transform: translate(-50%, -70px) scale(1.2);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -100px) scale(1);
    }
}

/* =========================
   RESPONSIVE
   ========================= */
@media (max-width: 768px) {

    /* Fluid Mobile & Tablet Layout */
    .ew-top-title {
        top: 20px;
        left: 16px;
        right: 60px;
        /* Leave space for right actions */
    }

    .ew-top-title h2 {
        font-size: clamp(16px, 4vw, 20px);
        /* Responsive Font */
        line-height: 1.2;
    }

    .ew-top-title p {
        font-size: 12px;
        opacity: 0.8;
    }

    /* Price Positioned above bottom UI */
    .ew-price-center {
        /* Position relative to bottom to avoid overlapping content */
        position: absolute;
        top: auto;
        bottom: 15vh;
        left: 50%;
        transform: translateX(-50%);
        width: 100%;
        text-align: center;
        z-index: 160;
    }

    .ew-price-big {
        font-size: clamp(36px, 8vw, 50px);
    }

    .ew-price-old-small {
        font-size: 14px;
        display: block;
    }

    /* Bottom Button - Always Visible & Reachable */
    .ew-bottom-button {
        bottom: 30px;
        /* Safe area from bottom */
        left: 50%;
        transform: translateX(-50%);
        width: 90%;
        /* 90% view width */
        max-width: 400px;
        z-index: 180;
    }

    .ew-btn-white {
        width: 100%;
        padding: 14px 0;
        font-size: 16px;
        height: auto;
        min-height: 48px;
        /* Touch target */
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    }

    /* Right Actions - prevent overlap */
    .ew-actions-right {
        top: auto;
        bottom: 25vh;
        /* Push up above price area */
        right: 12px;
        transform: none;
        gap: 16px;
    }

    .ew-icon-bg {
        width: 42px;
        height: 42px;
    }
}

/* Désactiver le scroll classique sur desktop */
@media (min-width: 769px) {
    .ew-products-container::-webkit-scrollbar {
        display: none;
    }

    .ew-products-container {
        -ms-overflow-style: none;
        scrollbar-width: none;
    }
}

/* Message "Aucun produit" */
.ew-no-products {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    color: white;
    font-size: 18px;
}

/* =========================
   RICH TEXT DESCRIPTION STYLES
   ========================= */
/* Support des polices Google Fonts pour éditeur enrichi */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;700&family=Noto+Naskh+Arabic:wght@400;700&display=swap');

.ew-rich-description {
    font-size: 12px;
    font-weight: 400;
    margin: 0;
    line-height: 1.4;
    opacity: 0.9;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* Préserver la direction du texte (LTR/RTL) */
.ew-rich-description * {
    direction: inherit;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.ew-rich-description strong,
.ew-rich-description b {
    font-weight: 700;
}

.ew-rich-description em,
.ew-rich-description i {
    font-style: italic;
}

.ew-rich-description u {
    text-decoration: underline;
}

/* Listes dans description */
.ew-rich-description ul,
.ew-rich-description ol {
    margin: 4px 0;
    padding-left: 16px;
}

.ew-rich-description li {
    margin: 2px 0;
}

/* Liens dans description */
.ew-rich-description a {
    color: inherit;
    text-decoration: underline;
}

/* Animation pour l'indicateur de son */
@keyframes fadeInOut {
    90% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }

    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px);
    }
}

/* =========================
   NEW TIKTOK STYLE CONTROLS
   ========================= */
.ew-center-play {
    /* Positioning & Size (Moved from inline) */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    z-index: 155;

    /* Appearance */
    background: rgba(0, 0, 0, 0.4);
    color: white;
    font-size: 40px;
    border-radius: 50%;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);

    /* Layout */
    align-items: center;
    justify-content: center;
    cursor: pointer;

    /* Visibility State (Hidden by default) */
    display: none;
    opacity: 0;

    /* Transitions */
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.2s;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

/* Show when parent has 'show-play' class */
.ew-video-container.ew-show-play .ew-center-play {
    display: flex !important;
    opacity: 1 !important;
}

.ew-center-play:active {
    transform: translate(-50%, -50%) scale(0.9) !important;
}

/* Make sound hint clearly actionable */
.ew-sound-hint {
    transition: transform 0.1s, background-color 0.2s;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.ew-sound-hint:active {
    transform: translateX(-50%) scale(0.95) !important;
    background-color: rgba(0, 0, 0, 0.9) !important;
}

/* ========================================
   SMARTPHONE OPTIMIZATIONS (Max 480px)
   ======================================== */
@media (max-width: 480px) {

    /* 1. Titre Haut */
    .ew-top-title {
        top: 20px !important;
        right: 60px !important;
        left: 10px !important;
    }

    .ew-top-title h2 {
        font-size: 16px !important;
    }

    /* 2. Prix Central */
    .ew-price-center {
        top: auto !important;
        bottom: 160px !important;
        /* Calé par rapport au bas pour la constance */
        transform: translate(-50%, 0) !important;
    }

    .ew-price-big {
        font-size: 36px !important;
    }

    /* 3. Bouton "Voir Détails" / "Panier" */
    .ew-bottom-button {
        bottom: 20px !important;
        /* Bien remonté du bas */
        left: 50% !important;
        transform: translateX(-50%) !important;
        width: 90% !important;
    }

    .ew-btn-white {
        width: 100% !important;
        padding: 12px 0 !important;
        font-size: 14px !important;
        height: 48px !important;
    }

    /* 4. Actions Droite */
    .ew-actions-right {
        right: 8px !important;
        gap: 12px !important;
    }
}