/**
 * FluentForm Custom Validation - Radio Card Selector
 * Version: 1.2.0
 *
 * Styles pour les cartes sélectionnables qui remplacent les radio buttons
 * Converti depuis le projet React OfferCard.tsx
 */

/* ========================================
   Container pour les cartes radio
   ======================================== */

.ffcv-radio-cards-container {
    display: flex;
    flex-wrap: nowrap;
    gap: 1rem;
    margin: 1rem 0;
    justify-content: center;
    align-items: stretch;
}

/* Masquer les radio buttons natifs mais les garder accessibles pour la validation FluentForm */
.ffcv-radio-cards-container input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
}

/* Masquer les labels natifs des radio buttons */
.ffcv-radio-cards-container .ff-el-form-check-label {
    display: none;
}

/* ========================================
   Carte de base
   ======================================== */

.ffcv-radio-card {
    position: relative;
    display: flex;
    flex-direction: column;
    border: 2px solid #6c757d;
    border-radius: 1.5rem;
    margin: 0;
    padding: 0.25rem 1rem 1rem;
    align-items: center;
    color: #6c757d;
    cursor: pointer;
    flex: 1;
    min-width: 150px;
    max-width: 400px;
    transition: all 0.3s ease-in-out;
    background-color: #fff;
    box-sizing: border-box;
}

@media (min-width: 768px) {
    .ffcv-radio-card {
        min-width: 280px;
        max-width: 400px;
    }
}

/* Hover state */
.ffcv-radio-card:hover {
    background-color: var(--ffcv-card-bg-color, rgba(53, 176, 139, 0.06));
    border-color: var(--ffcv-card-main-color, #35B08B);
}

/* Focus visible pour accessibilité clavier */
/* .ffcv-radio-card:focus {
    outline: 3px solid #007bff;
    outline-offset: 2px;
} */

/* ========================================
   Carte sélectionnée
   ======================================== */

.ffcv-radio-card-selected {
    border-width: 4px;
    border-color: var(--ffcv-card-main-color, #35B08B);
    background-color: var(--ffcv-card-bg-color, rgba(53, 176, 139, 0.06));
    box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.25);
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

@media (min-width: 768px) {
    .ffcv-radio-card-selected {
        margin-top: 0.3125rem;
        margin-bottom: 0.3125rem;
    }
}

/* ========================================
   Éléments de la carte - Icône
   ======================================== */

.ffcv-radio-card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 5rem;
    width: 5rem;
    margin-bottom: 0.5rem;
    margin-top: 0.5rem;
}

.ffcv-radio-card-icon svg {
    width: 100%;
    height: 100%;
}

/* Background circle pour l'icône quand sélectionnée */
.ffcv-radio-card-selected .ffcv-radio-card-icon-bg {
    fill: var(--ffcv-card-main-color, #35B08B);
}

/* Icône non sélectionnée - background transparent */
.ffcv-radio-card:not(.ffcv-radio-card-selected) .ffcv-radio-card-icon-bg {
    fill: transparent;
}

/* ========================================
   Éléments de la carte - Titre
   ======================================== */

.ffcv-radio-card-title {
    font-weight: 700;
    font-size: 1.25rem;
    line-height: 1.5rem;
    color: var(--ffcv-card-main-color, #35B08B);
    margin-bottom: 0.5rem;
    text-align: center;
}

/* ========================================
   Éléments de la carte - Prix
   ======================================== */

.ffcv-radio-card-price {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 1.5rem 1.5rem 0.5rem;
}

.ffcv-radio-card-price-label {
    line-height: 1;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.ffcv-radio-card-price-value {
    font-weight: 900;
    font-size: 1.875rem;
    line-height: 1;
    color: var(--ffcv-card-main-color, #35B08B);
}

.ffcv-radio-card-price-unit {
    margin-left: 0.25rem;
    font-weight: 400;
}

/* Prix avec réduction */
.ffcv-radio-card-price-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0;
}

.ffcv-radio-card-price-crossed {
    position: relative;
    margin-top: -0.375rem;
    margin-bottom: -0.375rem;
}

.ffcv-radio-card-price-crossed-value {
    font-weight: 900;
    font-size: 1.25rem;
}

.ffcv-radio-card-price-crossed::before {
    content: "";
    border-top: 2px solid #6c757d;
    width: 100%;
    height: 100%;
    top: 50%;
    transform: rotate(-4deg);
    position: absolute;
    left: 0;
}

.ffcv-radio-card-price-reduced {
    font-weight: 900;
    font-size: 1.5rem;
    color: var(--ffcv-card-main-color, #35B08B);
}

.ffcv-radio-card-price-note {
    font-size: 0.75rem;
    line-height: 1rem;
    margin-top: 0.25rem;
    text-align: center;
}

/* Prix Plug & Play */
.ffcv-radio-card-price-plugplay {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 0.25rem;
    padding-top: 0.375rem;
    border-top: 1px solid rgba(108, 117, 125, 0.3);
}

.ffcv-radio-card-price-plugplay-label {
    font-size: 0.875rem;
    line-height: 1.25;
    margin-bottom: 0.25rem;
}

.ffcv-radio-card-price-plugplay-value {
    font-weight: 900;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--ffcv-card-main-color, #35B08B);
}

/* ========================================
   Éléments de la carte - Descriptions
   ======================================== */

.ffcv-radio-card-description {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.ffcv-radio-card-description-item {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0.75rem 0.5rem;
    border-bottom: 1px solid rgba(108, 117, 125, 0.3);
    width: 80%;
    white-space: nowrap;
    font-size: 0.9rem;
    text-align: center;
}

.ffcv-radio-card-description-item:last-child {
    border-bottom: none;
}

/* ========================================
   Couleurs personnalisables (Variables CSS)
   ======================================== */

/* Couleurs par défaut */
.ffcv-radio-cards-container {
    --ffcv-card-main-color: #35B08B;
    --ffcv-card-bg-color: rgba(53, 176, 139, 0.06);
}

/* Variantes de couleur par type d'offre - BMS (Boost Mon Surplus) */
.ffcv-radio-card[data-offer="BMS"] {
    --ffcv-card-main-color: #35B08B;
    --ffcv-card-bg-color: rgba(53, 176, 139, 0.06);
}

/* Variantes de couleur par type d'offre - SV (Stockage Virtuel) */
.ffcv-radio-card[data-offer="SV"] {
    --ffcv-card-main-color: #35B08B;
    --ffcv-card-bg-color: rgba(53, 176, 139, 0.06);
}

/* ========================================
   État d'erreur (Intégration FluentForm)
   ======================================== */

.ff-el-is-error .ffcv-radio-card {
    border-color: #dc3545 !important;
}

.ff-el-is-error .ffcv-radio-card-selected {
    border-color: #dc3545 !important;
    background-color: rgba(220, 53, 69, 0.05) !important;
}

.ff-el-is-error .ffcv-radio-card-title,
.ff-el-is-error .ffcv-radio-card-price-value,
.ff-el-is-error .ffcv-radio-card-price-reduced,
.ff-el-is-error .ffcv-radio-card-price-plugplay-value {
    color: #dc3545 !important;
}

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

@media (max-width: 768px) {
    .ffcv-radio-cards-container {
        gap: 1rem;
        /* Gardé en flex-row pour afficher les cartes côte à côte */
        flex-direction: row;
    }

    .ffcv-radio-card {
        padding: 0.75rem;
        margin: 0;
    }

    .ffcv-radio-card-selected {
        margin: 0.125rem 0;
    }

    .ffcv-radio-card-title {
        font-size: 1.125rem;
    }

    .ffcv-radio-card-description-item {
        font-size: 0.875rem;
        white-space: normal;
        text-align: center;
    }

    .ffcv-radio-card-icon {
        height: 4rem;
        width: 4rem;
    }
}

/* ========================================
   Animation d'apparition
   ======================================== */

.ffcv-radio-card {
    animation: ffcvCardFadeIn 0.3s ease-in-out;
}

@keyframes ffcvCardFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   États interactifs pour accessibilité
   ======================================== */

.ffcv-radio-card:active {
    transform: scale(0.98);
}

.ffcv-radio-card-selected:active {
    transform: scale(0.98);
}

/* Amélioration de la lisibilité sur petits écrans */
@media (max-width: 480px) {
    .ffcv-radio-card-price-value {
        font-size: 1.5rem;
    }

    .ffcv-radio-card-title {
        font-size: 1rem;
    }
}
