/**
 * CSS frontend pour Elementor Enhanced Cart Button
 */

/* Container principal */
.eecb-enhanced-cart-wrapper {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-width: 100%;
}

/* Section prix */
.eecb-price-wrapper {
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.eecb-price {
    font-size: 24px;
    font-weight: 600;
    color: #2c3e50;
    line-height: 1.2;
}

.eecb-price .woocommerce-Price-amount {
    font-weight: inherit;
}

.eecb-price-from {
    font-size: 16px;
    font-weight: 400;
    color: #6c757d;
    margin-right: 8px;
    display: inline-block;
}

/* Section stock */
.eecb-stock-wrapper {
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.eecb-stock-status {
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.eecb-stock-status.in-stock {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.eecb-stock-status.out-of-stock {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.eecb-stock-status.low-stock {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* Section variations */
.eecb-variations-wrapper {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.eecb-variations-form {
    width: 100%;
}

.eecb-variations {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.eecb-variation-attribute {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.eecb-variation-attribute label {
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
    margin: 0;
}

.eecb-variation-select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 14px;
    background-color: #ffffff;
    color: #2c3e50;
    transition: all 0.2s ease;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px 12px;
    padding-right: 40px;
}

.eecb-variation-select:hover {
    border-color: #3498db;
}

.eecb-variation-select:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.1);
}


/* Section bouton */
.eecb-button-wrapper {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-top: 10px;
}

.eecb-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    background-color: #2271b1;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 160px;
    text-align: center;
    line-height: 1.2;
}

.eecb-button:hover {
    background-color: #1e5f8c;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(34, 113, 177, 0.3);
}

.eecb-button:active {
    transform: translateY(0);
}

.eecb-button:disabled,
.eecb-button.disabled {
    background-color: #6c757d;
    color: #ffffff;
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
    box-shadow: none;
}

.eecb-button:disabled:hover,
.eecb-button.disabled:hover {
    background-color: #6c757d;
    transform: none;
    box-shadow: none;
}

/* États de chargement */
.eecb-button.loading {
    position: relative;
    color: transparent;
}

.eecb-button.loading::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: eecb-spin 1s linear infinite;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .eecb-enhanced-cart-wrapper {
        gap: 12px;
    }
    
    .eecb-price {
        font-size: 20px;
    }
    
    .eecb-price-from {
        font-size: 14px;
    }
    
    .eecb-variation-select {
        padding: 10px 14px;
        font-size: 14px;
        padding-right: 35px;
        background-size: 14px 10px;
        background-position: right 10px center;
    }
    
    .eecb-button {
        padding: 12px 24px;
        font-size: 14px;
        min-width: 180px;
    }
    
    .eecb-variations {
        gap: 12px;
    }
    
    .eecb-variation-attribute {
        gap: 6px;
    }
}

@media (max-width: 480px) {
    .eecb-enhanced-cart-wrapper {
        gap: 10px;
    }
    
    .eecb-price {
        font-size: 18px;
    }
    
    .eecb-price-from {
        font-size: 13px;
        margin-right: 6px;
    }
    
    .eecb-variation-select {
        padding: 8px 12px;
        font-size: 13px;
        padding-right: 32px;
        background-size: 12px 8px;
        background-position: right 8px center;
    }
    
    .eecb-button {
        padding: 10px 20px;
        font-size: 13px;
        min-width: 160px;
        letter-spacing: 0.3px;
    }
    
    .eecb-stock-status {
        padding: 4px 8px;
        font-size: 12px;
    }
}

/* Intégration avec les thèmes communs */
.elementor-widget-eecb-enhanced-cart-button {
    /* Styles spécifiques au contexte Elementor si nécessaire */
}

/* Support pour les thèmes sombres */
@media (prefers-color-scheme: dark) {
    .eecb-price {
        color: #ffffff;
    }
    
    .eecb-price-from {
        color: #cccccc;
    }
    
    .eecb-variation-attribute label {
        color: #ffffff;
    }
    
    .eecb-variation-select {
        background-color: #2c3e50;
        color: #ffffff;
        border-color: #495057;
    }
    
    .eecb-variation-select:hover {
        border-color: #74b9ff;
    }
    
    .eecb-variation-select:focus {
        border-color: #74b9ff;
        box-shadow: 0 0 0 3px rgba(116, 185, 255, 0.1);
    }
}

/* Animations d'entrée */
.eecb-enhanced-cart-wrapper {
    animation: eecb-fadeIn 0.3s ease-out;
}

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

/* Transitions pour les changements de prix/stock */
.eecb-price,
.eecb-stock-status {
    transition: all 0.2s ease;
}

/* Focus visible pour l'accessibilité */
.eecb-variation-select:focus-visible,
.eecb-button:focus-visible {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

/* Amélioration de l'accessibilité */
.eecb-variation-select[aria-invalid="true"] {
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

.eecb-button[aria-busy="true"] {
    pointer-events: none;
}

/* Support pour les boutons de différentes tailles */
.eecb-button.size-small {
    padding: 8px 16px;
    font-size: 12px;
    min-width: 120px;
}

.eecb-button.size-large {
    padding: 18px 36px;
    font-size: 18px;
    min-width: 240px;
}

/* Style pour les messages d'erreur */
.eecb-error-message {
    color: #dc3545;
    font-size: 14px;
    margin-top: 8px;
    padding: 8px 12px;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
}

/* Style pour les messages de succès */
.eecb-success-message {
    color: #155724;
    font-size: 14px;
    margin-top: 8px;
    padding: 8px 12px;
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 4px;
}

/* Styles personnalisés pour SweetAlert */
.eecb-swal-popup {
    border-radius: 16px !important;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15) !important;
}

.eecb-swal-title {
    font-size: 24px !important;
    font-weight: 600 !important;
    color: #2c3e50 !important;
    margin-bottom: 20px !important;
}

.eecb-swal-content {
    text-align: left !important;
    padding: 0 !important;
}

.eecb-cart-summary {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
    margin: 10px 0 20px 0;
}

.eecb-product-image {
    flex-shrink: 0;
}

.eecb-product-image img {
    border: 2px solid #e9ecef;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.eecb-product-details {
    flex: 1;
    min-width: 0;
}

.eecb-product-details h4 {
    font-weight: 600;
    line-height: 1.3;
    word-wrap: break-word;
}

.eecb-swal-confirm {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%) !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 12px 24px !important;
    font-weight: 600 !important;
    font-size: 14px !important;
    transition: all 0.2s ease !important;
    text-decoration: none !important;
}

.eecb-swal-confirm:hover {
    color: #ffffff !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3) !important;
    text-decoration: none !important;
}

.eecb-swal-confirm:focus {
    color: #ffffff !important;
    text-decoration: none !important;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.25) !important;
}

.eecb-swal-cancel {
    background: #6c757d !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 12px 24px !important;
    font-weight: 600 !important;
    font-size: 14px !important;
    transition: all 0.2s ease !important;
    text-decoration: none !important;
}

.eecb-swal-cancel:hover {
    background: #545b62 !important;
    color: #ffffff !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3) !important;
    text-decoration: none !important;
}

.eecb-swal-cancel:focus {
    color: #ffffff !important;
    text-decoration: none !important;
    box-shadow: 0 0 0 3px rgba(108, 117, 125, 0.25) !important;
}

/* Animation d'apparition du SweetAlert */
.swal2-popup.swal2-show.eecb-swal-popup {
    animation: eecb-swal-show 0.3s ease-out !important;
}

@keyframes eecb-swal-show {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Style pour bouton stock insuffisant */
.eecb-button.stock-insufficient {
    background-color: #dc3545 !important;
    color: #ffffff !important;
    border-color: #dc3545 !important;
    cursor: not-allowed !important;
    opacity: 0.9 !important;
}

.eecb-button.stock-insufficient:hover {
    background-color: #c82333 !important;
    transform: none !important;
    box-shadow: none !important;
}

.eecb-button.stock-insufficient:disabled {
    background-color: #dc3545 !important;
    opacity: 0.7 !important;
}

/* Styles pour les alertes de stock */
.eecb-stock-checking {
    color: #6c757d !important;
    font-size: 14px !important;
    display: flex !important;
    align-items: center !important;
    margin-top: 10px !important;
}

.eecb-stock-warning {
    margin-top: 10px !important;
    padding: 12px !important;
    background: #fff3cd !important;
    border: 1px solid #ffeaa7 !important;
    border-radius: 6px !important;
    color: #856404 !important;
}

.eecb-stock-warning svg {
    flex-shrink: 0;
}

/* Animation pour le spinner */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.eecb-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #ddd;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

/* Responsive pour le SweetAlert */
@media (max-width: 480px) {
    .eecb-swal-popup {
        width: 95% !important;
        margin: 0 auto !important;
    }
    
    .eecb-cart-summary {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .eecb-product-image {
        align-self: center;
    }
    
    .eecb-product-details h4 {
        font-size: 14px !important;
    }
    
    .eecb-stock-warning {
        padding: 10px !important;
        font-size: 13px !important;
    }
}