/* views/css/front_v2.css */

.product-customization-item-custom-ral {
    margin-bottom: 25px;
}

.product-customization-label {
    display: block;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #333;
}

.required-field {
    color: #ff0000;
    font-weight: bold;
}

/* Sélecteur personnalisé */
.ral-custom-select-wrapper {
    position: relative;
}

.ral-custom-select {
    position: relative;
    width: 100%;
    cursor: pointer;
    user-select: none;
}

.ral-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    transition: all 0.3s ease;
    min-height: 48px;
}

.ral-custom-select:hover .ral-select-trigger {
    border-color: #2093be;
}

.ral-custom-select:focus .ral-select-trigger,
.ral-custom-select.open .ral-select-trigger {
    border-color: #2093be;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
    outline: none;
}

.ral-select-placeholder {
    color: #6c757d;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.ral-select-arrow {
    display: flex;
    align-items: center;
    color: #6c757d;
    transition: transform 0.3s ease;
}

.ral-custom-select.open .ral-select-arrow {
    transform: rotate(180deg);
}

/* Liste des options */
.ral-options-list {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #2093be;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.ral-custom-select.open .ral-options-list {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.ral-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
}

.ral-option:last-child {
    border-bottom: none;
}

.ral-option:hover {
    background-color: #f0f8ff;
}

.ral-option.selected {
    background-color: #e3f2fd;
    font-weight: 600;
}

.ral-option.selected::after {
    content: "✓";
    margin-left: auto;
    color: #2093be;
    font-weight: bold;
}

/* Point de couleur */
.ral-color-dot {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 2px solid #ddd;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.ral-option-text {
    font-size: 15px;
    color: #333;
}

/* Scrollbar personnalisée pour la liste */
.ral-options-list::-webkit-scrollbar {
    width: 8px;
}

.ral-options-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.ral-options-list::-webkit-scrollbar-thumb {
    background: #2093be;
    border-radius: 4px;
}

.ral-options-list::-webkit-scrollbar-thumb:hover {
    background: #2093be;
}

/* Message d'erreur */
.ral-error-message {
    color: #dc3545;
    font-size: 13px;
    margin-top: 8px;
    padding: 10px;
    background: #f8d7da;
    border-radius: 6px;
    border-left: 4px solid #dc3545;
    animation: slideDown 0.3s ease;
}

.ral-error-message::before {
    content: "⚠️ ";
    margin-right: 5px;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* État d'erreur */
.product-customization-item-custom-ral.has-error .ral-select-trigger {
    border-color: #dc3545;
    border-width: 2px;
}

.product-customization-item-custom-ral.has-error .ral-custom-select:hover .ral-select-trigger {
    border-color: #dc3545;
}

/* Animation de validation */
.ral-custom-select.valid .ral-select-trigger {
    border-color: #28a745;
    animation: validPulse 0.5s;
}

@keyframes validPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(40, 167, 69, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0);
    }
}

/* Couleur dans le trigger quand sélectionnée */
.ral-selected-color {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    color: #333;
}

/* Responsive */
@media (max-width: 768px) {
    .ral-select-trigger {
        padding: 10px 14px;
    }
    
    .ral-option {
        padding: 10px 14px;
    }
    
    .ral-color-dot {
        width: 28px;
        height: 28px;
    }
    
    .ral-option-text {
        font-size: 14px;
    }
    
    .ral-options-list {
        max-height: 250px;
    }
}

/* Intégration avec le style PrestaShop par défaut */
.product-customization .product-customization-item-custom-ral {
    /* padding: 20px;
    background: #f8f9fa; */
    border-radius: 8px;
    margin-bottom: 20px;
}

.product-customization .form-control-label {
    font-weight: 600;
}

/* Animation shake pour erreur */
.has-error .ral-custom-select {
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* Focus accessible */
.ral-custom-select:focus {
    outline: none;
}

.ral-custom-select:focus .ral-select-trigger {
    border-color: #2093be;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.2);
}

/* Cacher le champ texte natif de PrestaShop pour ce champ */
input[name="customization[{$id_customization_field}][{$id_product}]"]:not(#ral_customization_input) {
    display: none !important;
}
textarea[name="customization[{$id_customization_field}][{$id_product}]"] {
    display: none !important;
}