/**
 * Funnel Configurator Pro - Funnel Styles
 *
 * Styles pour le système multi-étapes du funnel
 * avec animations et transitions fluides
 */

/* ============================================
   Color Filter - Hide products by color
   ============================================ */
.fcp-product-item.fcp-hidden-by-color-filter,
.fcpm-product.fcp-hidden-by-color-filter,
.fcpm-container .fcpm-product.fcp-hidden-by-color-filter,
.fcp-configurator-wrapper .fcpm-product.fcp-hidden-by-color-filter,
.fcp-funnel-container .fcpm-product.fcp-hidden-by-color-filter,
.fcpm-products .fcpm-product.fcp-hidden-by-color-filter {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Placeholder when no products match color filter */
.fcp-no-products-placeholder {
    padding: 20px;
    text-align: center;
    color: #888;
    font-size: 14px;
    font-style: italic;
    background: #f9f9f9;
    border-radius: 8px;
    margin: 10px 0;
}

/* ============================================
   Container Principal
   ============================================ */

.fcp-funnel-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
    position: relative;
    min-height: 600px;
    background: #ffffff;
    z-index: 100;
    isolation: isolate;
}

/* ============================================
   Gestion des étapes
   ============================================ */

.fcp-funnel-step {
    opacity: 0;
    visibility: hidden;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    transition: opacity 0.4s ease-in-out, visibility 0.4s ease-in-out;
    pointer-events: none;
}

.fcp-funnel-step.active {
    opacity: 1;
    visibility: visible;
    position: relative;
    pointer-events: auto;
}

.fcp-step-content {
    width: 100%;
}

/* ============================================
   Header commun des étapes
   ============================================ */

.fcp-step-header {
    text-align: center;
    margin-bottom: 3rem;
}

.fcp-step-title {
    font-family: 'Playfair Display', serif !important;
    font-size: 35px !important;
    font-weight: 700 !important;
    font-style: italic !important;
    color: #171717 !important;
    margin: 0 0 0.5rem 0;
    line-height: 1.3;
}

.fcp-step-description {
    font-family: 'Poppins', sans-serif !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    color: #171717 !important;
    margin: 0;
    line-height: 1.6;
}

/* ============================================
   STEP 1: Bag Size Selection
   ============================================ */

.fcp-bag-size-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.fcp-bag-size-option {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.fcp-bag-size-option:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.fcp-bag-size-image {
    width: 100%;
    aspect-ratio: 4/3;
    overflow: hidden;
    position: relative;
    background: #F8F9FA;
}

.fcp-bag-size-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.fcp-bag-size-image.fcp-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
}

.fcp-placeholder-content {
    text-align: center;
}

.fcp-placeholder-content span {
    font-size: 1.5rem;
    font-weight: 600;
    color: #BDC3C7;
}

.fcp-bag-size-info {
    padding: 1.5rem;
    text-align: center;
}

.fcp-bag-size-label {
    font-size: 1.25rem;
    font-weight: 600;
    color: #2C3E50;
    margin: 0 0 1rem 0;
}

.fcp-bag-size-btn {
    display: inline-block;
    padding: 0.875rem 2rem;
    background: #2C3E50;
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.fcp-bag-size-btn:hover {
    background: #1A252F;
    transform: scale(1.05);
}

.fcp-bag-size-btn:active {
    transform: scale(0.98);
}

/* ============================================
   Out of Stock Options (All step types)
   ============================================ */

.fcp-bag-size-option.fcp-out-of-stock,
.fcp-image-choice-option.fcp-out-of-stock {
    opacity: 0.8;
    cursor: not-allowed;
    pointer-events: none;
}

.fcp-bag-size-option.fcp-out-of-stock:hover,
.fcp-image-choice-option.fcp-out-of-stock:hover {
    transform: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.fcp-bag-size-option.fcp-out-of-stock .fcp-bag-size-image,
.fcp-image-choice-option.fcp-out-of-stock .fcp-option-image {
    position: relative;
}

.fcp-bag-size-option.fcp-out-of-stock .fcp-bag-size-image img,
.fcp-image-choice-option.fcp-out-of-stock .fcp-option-image img {
    filter: grayscale(60%);
}

.fcp-out-of-stock-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(249, 246, 244, 0.6);
    pointer-events: none;
}

.fcp-bag-size-option.fcp-out-of-stock,
.fcp-image-choice-option.fcp-out-of-stock {
    background: #f9f6f4;
}

.fcp-out-of-stock-message {
    color: #666;
    font-family: 'Poppins', sans-serif;
    font-size: 0.875rem;
    font-weight: 400;
    font-style: italic;
    line-height: 1.4;
}

/* ============================================
   STEP 2: Wardrobe Colors Selection
   ============================================ */

.fcp-colors-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    max-width: calc(6 * 60px + 5 * 1.5rem);
    margin-left: auto;
    margin-right: auto;
}

.fcp-color-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: transform 0.2s ease;
    width: 60px;
}

.fcp-color-option:hover {
    transform: scale(1.05);
}

.fcp-color-visual {
    position: relative;
    width: 60px;
    height: 60px;
    min-width: 60px;
    min-height: 60px;
    max-width: 60px;
    max-height: 60px;
    border-radius: 50%;
    overflow: visible;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    flex-shrink: 0;
    aspect-ratio: 1 / 1;
}

.fcp-color-option.selected .fcp-color-visual {
    border-color: transparent;
    border-width: 2px;
    box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px #000000;
}

/* Bordure grise pour les couleurs blanches */
.fcp-color-visual.fcp-color-white {
    border: 1px solid #d0d0d0;
}

.fcp-color-option.selected .fcp-color-visual.fcp-color-white {
    border-color: transparent;
}

.fcp-color-circle {
    width: 100%;
    height: 100%;
}

.fcp-color-image {
    overflow: visible;
    background: transparent;
}

.fcp-color-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

/* Fix: supprimer la bordure par défaut sur les images pour éviter la ligne noire */
.fcp-color-option.selected .fcp-color-visual.fcp-color-image {
    border: none;
    box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px #000000;
}

.fcp-color-checkmark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
    opacity: 0;
    pointer-events: none;
}

.fcp-color-option.selected .fcp-color-checkmark {
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
}

.fcp-color-checkmark svg {
    color: #27AE60;
}

.fcp-color-label {
    font-size: 0.875rem;
    color: #2C3E50;
    text-align: center;
    font-weight: 500;
}

.fcp-step-footer {
    text-align: center;
    margin-top: 3rem;
}

.fcp-colors-submit-btn,
.fcp-color-choice-submit-btn {
    display: inline-block;
    background: #171717;
    color: #fff;
    border: none;
    padding: 9px 2rem;
    font-family: 'Poppins', sans-serif !important;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 0;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.fcp-colors-submit-btn:not(:disabled):hover,
.fcp-color-choice-submit-btn:not(:disabled):hover {
    background: #333333;
    transform: scale(1.02);
}

.fcp-colors-submit-btn:disabled,
.fcp-color-choice-submit-btn:disabled {
    background: #BDC3C7;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Rappel des couleurs sélectionnées (Step 4) */
.fcp-selected-colors-reminder {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.fcp-colors-reminder-swatches {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.fcp-reminder-swatch {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 1px solid rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    position: relative;
}

/* Swatch sélectionné (état par défaut) */
.fcp-reminder-swatch.selected {
    opacity: 1;
    transform: scale(1);
    box-shadow: 0 0 0 2px #fff, 0 0 0 3px #171717;
}

/* Swatch désélectionné */
.fcp-reminder-swatch:not(.selected) {
    opacity: 0.4;
    transform: scale(0.85);
    box-shadow: none;
}

/* Barre diagonale sur les swatches désélectionnés */
.fcp-reminder-swatch:not(.selected)::after {
    content: '';
    position: absolute;
    top: 50%;
    left: -2px;
    right: -2px;
    height: 2px;
    background: #171717;
    transform: rotate(-45deg);
    border-radius: 1px;
}

.fcp-reminder-swatch:hover {
    transform: scale(1.1);
}

.fcp-reminder-swatch:not(.selected):hover {
    opacity: 0.6;
}

.fcp-reminder-swatch.fcp-reminder-swatch-white {
    border: 1px solid #d0d0d0;
}

.fcp-reminder-swatch.fcp-reminder-swatch-white.selected {
    box-shadow: 0 0 0 2px #fff, 0 0 0 3px #d0d0d0;
}

.fcp-reminder-swatch-image {
    background-size: cover;
    background-position: center;
}

/* Label sous les swatches de rappel */
.fcp-colors-reminder-label {
    font-family: 'Poppins', sans-serif;
    font-size: 10px;
    font-weight: 400;
    color: #171717;
    margin: 8px 0 0 0;
    text-align: center;
    width: 100%;
}

.fcp-colors-helper {
    margin-top: 1rem;
    font-size: 0.875rem;
    color: #7F8C8D;
}

/* ============================================
   STEP 3: Loader Animation (Elegant)
   ============================================ */

.fcp-step-loader {
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fcp-loader-container.fcp-loader-elegant {
    text-align: center;
    max-width: 500px;
    margin: 0 auto;
    padding: 2rem;
}

/* Message texte élégant */
.fcp-loader-message {
    font-family: 'Poppins', sans-serif !important;
    font-size: 16px;
    font-weight: 400;
    font-style: italic;
    color: #171717;
    margin: 0 0 0.5rem 0;
    line-height: 1.5;
}

/* Logo cœur avec animation respiration */
.fcp-loader-heart-breathing {
    display: flex;
    justify-content: center;
    align-items: center;
}

.fcp-loader-heart-breathing svg {
    width: 32px;
    height: 32px;
    animation: breathing 2s ease-in-out infinite;
}

/* Animation respiration douce */
@keyframes breathing {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.15);
        opacity: 0.85;
    }
}

/* Legacy styles (conservés pour compatibilité) */
.fcp-loader-container:not(.fcp-loader-elegant) {
    text-align: center;
    max-width: 400px;
    margin: 0 auto;
}

.fcp-loader-heart {
    width: 80px;
    height: 80px;
    margin: 0 auto 2rem;
    color: #E74C3C;
    animation: heartbeat 800ms ease-in-out infinite;
}

.fcp-loader-heart svg {
    width: 100%;
    height: 100%;
}

@keyframes heartbeat {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.06);
    }
}

.fcp-loader-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #2C3E50;
    margin: 0 0 0.5rem 0;
}

.fcp-loader-subtitle {
    font-size: 1rem;
    color: #7F8C8D;
    margin: 0;
}

/* ============================================
   STEP 4: Configurator
   ============================================ */

.fcp-step-configurator {
    width: 100%;
}

.fcp-configurator-wrapper {
    width: 100%;
}

#fcp-configurator-placeholder {
    width: 100%;
    min-height: 400px;
}

.fcp-configurator-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    font-size: 1.125rem;
    color: #7F8C8D;
}

/* ============================================
   Responsive Mobile
   ============================================ */

@media (max-width: 768px) {
    .fcp-funnel-container {
        padding: 1rem 0.5rem;
    }

    .fcp-step-title {
        font-size: 25px !important;
        line-height: 1.1 !important;
    }

    .fcp-step-description {
        font-size: 12px !important;
        line-height: 1.3;
    }

    .fcp-bag-size-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .fcp-colors-grid {
        max-width: calc(4 * 60px + 3 * 1rem);
        gap: 1rem;
    }

    .fcp-color-visual {
        width: 60px;
        height: 60px;
    }

    .fcp-color-label {
        font-size: 0.75rem;
    }

    /* Color choice step - button below colors (no sticky) */
    .fcp-funnel-step[data-step-type="color_choice"] .fcp-step-footer {
        margin-top: 20px;
    }

    .fcp-funnel-step[data-step-type="color_choice"] .fcp-step-footer .fcp-colors-submit-btn,
    .fcp-funnel-step[data-step-type="color_choice"] .fcp-step-footer .fcp-color-choice-submit-btn {
        width: auto;
        padding: 15px 2rem;
        font-size: 0.875rem;
    }

    .fcp-colors-submit-btn,
    .fcp-color-choice-submit-btn {
        padding: 9px 1.5rem;
        font-size: 0.875rem;
    }

    .fcp-loader-heart {
        width: 60px;
        height: 60px;
    }

    .fcp-loader-title {
        font-size: 1.25rem;
    }

    /* Step 1 - Image Choice blocks mobile */
    .fcp-step-content[class*="image_choice"],
    .fcp-funnel-step[data-step-type="image_choice"] .fcp-step-content {
        padding-left: 17px;
        padding-right: 17px;
    }

    .fcp-image-choice-grid {
        gap: 1rem;
    }

    .fcp-option-image {
        height: auto;
    }

    .fcp-option-image img {
        width: 100%;
        height: auto;
        object-fit: contain;
    }

    .fcp-option-info {
        padding: 10px 1rem 1rem !important;
    }

    .fcp-option-label,
    h3.fcp-option-label,
    .fcp-image-choice-option .fcp-option-label,
    .fcp-funnel-step .fcp-option-label {
        font-size: 17px !important;
        margin: 0 0 0.75rem 0 !important;
    }

    .fcp-image-choice-btn {
        padding: 8px 1.5rem;
        font-size: 0.75rem;
    }
}

/* ============================================
   Animations d'entrée/sortie
   ============================================ */

.fcp-funnel-step.fading-out {
    animation: fadeOut 0.4s ease-in-out forwards;
}

.fcp-funnel-step.fading-in {
    animation: fadeIn 0.4s ease-in-out forwards;
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ============================================
   Generic Templates Styles (Dynamic Version)
   ============================================ */

/* Image Choice Grid (Generic) */
.fcp-image-choice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.fcp-image-choice-option {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

.fcp-image-choice-option:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.fcp-option-image {
    width: 100%;
    overflow: hidden;
    position: relative;
    background: #F8F9FA;
    margin: 0 !important;
    padding: 0 !important;
}

.fcp-option-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    margin: 0 !important;
    padding: 0 !important;
}

.fcp-option-image.fcp-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
}

.fcp-placeholder-content {
    text-align: center;
    color: #95A5A6;
}

.fcp-placeholder-content .dashicons {
    font-size: 3rem;
    width: 3rem;
    height: 3rem;
    display: block;
    margin: 0 auto 0.5rem;
}

.fcp-option-info {
    padding: 15px 1.5rem 1.5rem !important;
    text-align: center;
    margin: 0 !important;
}

.fcp-option-label,
h3.fcp-option-label {
    font-family: 'Poppins', sans-serif !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    font-style: normal !important;
    color: #171717 !important;
    margin: 0 0 1rem 0 !important;
    padding: 0 !important;
}

.fcp-image-choice-btn {
    background: #171717;
    color: #fff;
    border: none;
    padding: 9px 2rem;
    font-family: 'Poppins', sans-serif !important;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 0;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.fcp-image-choice-btn:hover {
    background: #333333;
    transform: scale(1.02);
}

.fcp-image-choice-btn.loading {
    background: #95A5A6;
    cursor: not-allowed;
}

/* Configurator Summary */
.fcp-configurator-summary {
    background: #F8F9FA;
    padding: 2rem;
    border-radius: 12px;
    max-width: 600px;
    margin: 2rem auto;
}

.fcp-configurator-summary h3 {
    font-size: 1.5rem;
    color: #2C3E50;
    margin: 0 0 1.5rem 0;
}

.fcp-choices-list {
    list-style: none;
    padding: 0;
    margin: 0 0 1.5rem 0;
}

.fcp-choices-list li {
    padding: 0.75rem 0;
    border-bottom: 1px solid #E0E0E0;
    font-size: 1rem;
    color: #34495E;
}

.fcp-choices-list li:last-child {
    border-bottom: none;
}

.fcp-config-note {
    font-style: italic;
    color: #7F8C8D;
    font-size: 0.9rem;
    margin: 0;
}

/* Configurator Loading State */
.fcp-configurator-loading {
    text-align: center;
    padding: 3rem 1rem;
}

.fcp-loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #E0E0E0;
    border-top-color: #44C8BC;
    border-radius: 50%;
    margin: 0 auto 1rem;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Funnel Error Message */
.fcp-funnel-error {
    background: #FFF3CD;
    border: 1px solid #FFC107;
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    max-width: 600px;
    margin: 2rem auto;
}

.fcp-funnel-error p {
    margin: 0;
    color: #856404;
    font-size: 1rem;
}
