/* ==========================================================================
   Widgets Devis - Frontend Styles
   ========================================================================== */

/* Sélecteur de produits - Grille
   ========================================================================== */

.wed-products-grid {
    display: grid;
    gap: 20px;
    margin: 20px 0;
}

.wed-columns-1 .wed-products-grid { grid-template-columns: 1fr; }
.wed-columns-2 .wed-products-grid { grid-template-columns: repeat(2, 1fr); }
.wed-columns-3 .wed-products-grid { grid-template-columns: repeat(3, 1fr); }
.wed-columns-4 .wed-products-grid { grid-template-columns: repeat(4, 1fr); }
.wed-columns-5 .wed-products-grid { grid-template-columns: repeat(5, 1fr); }
.wed-columns-6 .wed-products-grid { grid-template-columns: repeat(6, 1fr); }

@media (max-width: 1024px) {
    .wed-columns-4 .wed-products-grid,
    .wed-columns-5 .wed-products-grid,
    .wed-columns-6 .wed-products-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .wed-columns-3 .wed-products-grid,
    .wed-columns-4 .wed-products-grid,
    .wed-columns-5 .wed-products-grid,
    .wed-columns-6 .wed-products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .wed-products-grid {
        grid-template-columns: 1fr !important;
    }
}

/* Carte produit par défaut
   ========================================================================== */

.wed-product-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.3s ease;
}

.wed-product-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.wed-product-image {
    position: relative;
    overflow: hidden;
    aspect-ratio: 1;
}

.wed-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.wed-product-card:hover .wed-product-image img {
    transform: scale(1.05);
}

.wed-product-details {
    padding: 15px;
}

.wed-product-title {
    margin: 0 0 10px 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.wed-product-price {
    margin: 10px 0;
    font-size: 18px;
    font-weight: bold;
    color: #0066cc;
}

.wed-product-excerpt {
    margin: 10px 0;
    font-size: 14px;
    color: #666;
    line-height: 1.5;
}

/* Bouton Ajouter au devis
   ========================================================================== */

.wed-add-to-quote {
    display: inline-block;
    width: 100%;
    padding: 12px 20px;
    margin-top: 10px;
    background: #0066cc;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.wed-add-to-quote:hover {
    background: #0052a3;
    transform: translateY(-2px);
}

.wed-add-to-quote:active {
    transform: translateY(0);
}

.wed-add-to-quote.loading {
    opacity: 0.6;
    cursor: not-allowed;
}

.wed-add-to-quote.added {
    background: #28a745;
}

.wed-add-to-quote .spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: wed-spin 0.6s linear infinite;
}

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

/* Layout Liste
   ========================================================================== */

.wed-products-list .wed-products-grid {
    grid-template-columns: 1fr;
}

.wed-products-list .wed-product-card {
    display: flex;
    flex-direction: row;
}

.wed-products-list .wed-product-image {
    width: 200px;
    flex-shrink: 0;
}

.wed-products-list .wed-product-details {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.wed-products-list .wed-add-to-quote {
    width: auto;
    align-self: flex-start;
}

/* Layout Accordéon
   ========================================================================== */

.wed-products-accordion {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

.wed-accordion-item {
    border-bottom: 1px solid #e0e0e0;
}

.wed-accordion-item:last-child {
    border-bottom: none;
}

.wed-accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #f8f9fa;
    cursor: pointer;
    transition: background 0.3s ease;
}

.wed-accordion-header:hover {
    background: #e9ecef;
}

.wed-accordion-header.active {
    background: #0066cc;
    color: #fff;
}

.wed-accordion-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.wed-accordion-icon {
    font-size: 24px;
    font-weight: bold;
    line-height: 1;
}

.wed-accordion-content {
    padding: 20px;
    background: #fff;
}

/* Compteur Devis (Menu)
   ========================================================================== */

.wed-quote-counter-widget {
    display: inline-block;
}

.wed-quote-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
}

.wed-quote-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.wed-quote-icon-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.wed-quote-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1em;
    height: 1em;
}

.wed-quote-icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

.wed-quote-count {
    position: absolute;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: 11px;
    font-weight: bold;
    line-height: 1;
}

/* Positions du compteur */
.wed-counter-top-right .wed-quote-count {
    top: -8px;
    right: -8px;
}

.wed-counter-top-left .wed-quote-count {
    top: -8px;
    left: -8px;
}

.wed-counter-bottom-right .wed-quote-count {
    bottom: -8px;
    right: -8px;
}

.wed-counter-bottom-left .wed-quote-count {
    bottom: -8px;
    left: -8px;
}

.wed-counter-inline .wed-quote-count {
    position: static;
    margin-left: 5px;
}

.wed-quote-empty {
    font-size: 12px;
    color: #999;
    margin-left: 5px;
}

.wed-quote-text {
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
}

/* Notifications
   ========================================================================== */

.wed-notification {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 15px 30px;
    background: #fdc300;
    color: #333;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(253, 195, 0, 0.4);
    z-index: 99999;
    transition: transform 0.3s ease, opacity 0.3s ease;
    max-width: 90%;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    opacity: 0;
}

.wed-notification.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.wed-notification-success {
    background: #fdc300;
    color: #333;
}

.wed-notification-error {
    background: #e74c3c;
    color: #fff;
}

.wed-notification-info {
    background: #3498db;
    color: #fff;
}

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

@media (max-width: 768px) {
    .wed-notification {
        bottom: 20px;
        max-width: calc(100% - 40px);
        font-size: 14px;
        padding: 12px 20px;
    }
}

/* Bouton Ajouter au Devis (widget standalone)
   ========================================================================== */

.wed-atq-button-wrapper {
    display: block;
}

.wed-add-to-quote-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    cursor: pointer;
    font-family: inherit;
    text-align: center;
    transition: all 0.3s ease;
    text-decoration: none;
    line-height: 1;
}

.wed-add-to-quote-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.3);
}

.wed-add-to-quote-btn.loading {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.wed-add-to-quote-btn .wed-atq-text {
    display: inline-block;
}

.wed-add-to-quote-btn .wed-atq-icon-left,
.wed-add-to-quote-btn .wed-atq-icon-right {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.wed-add-to-quote-btn svg {
    display: block;
}

/* Animation lors de l'ajout */
@keyframes wed-bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.wed-add-to-quote-btn.added {
    animation: wed-bounce 0.5s ease;
}

/* Formulaire Devis Avancé - Layout en colonnes
   ========================================================================== */

.wed-advanced-quote-form {
    width: 100%;
}

.wed-form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

.wed-form-field {
    display: flex;
    flex-direction: column;
}

.wed-form-field.wed-full-width {
    grid-column: 1 / -1;
}

.wed-form-field.wed-half-width {
    grid-column: span 1;
}

.wed-form-field label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.wed-form-field input,
.wed-form-field textarea {
    width: 100%;
    box-sizing: border-box;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.wed-form-field input:focus,
.wed-form-field textarea:focus {
    outline: none;
    border-color: #0066cc;
}

.wed-form-field textarea {
    resize: vertical;
    min-height: 100px;
}

.wed-form-actions {
    text-align: center;
    margin-top: 30px;
}

.wed-submit-quote {
    display: inline-block;
    padding: 15px 40px;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wed-submit-quote:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.wed-submit-quote:active {
    transform: translateY(0);
}

.wed-notice {
    padding: 20px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 4px;
    color: #856404;
    text-align: center;
}

/* Responsive */
@media (max-width: 768px) {
    .wed-form-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .wed-form-field.wed-half-width {
        grid-column: 1 / -1;
    }
}

/* Liste Sélection Devis - Améliorée
   ========================================================================== */

.wed-quote-list-wrapper {
    margin: 20px 0;
}

.wed-quote-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #f8f9fa;
    border-radius: 8px 8px 0 0;
    margin-bottom: 0;
}

.wed-quote-counter-text {
    font-size: 16px;
    font-weight: 600;
}

.wed-toggle-list-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #fff;
    border: 2px solid #ddd;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.wed-toggle-list-btn:hover {
    border-color: #0066cc;
    color: #0066cc;
}

.wed-quote-list-content {
    transition: all 0.3s ease;
    overflow: hidden;
}

.wed-quote-items-grid {
    display: grid;
    gap: 20px;
    padding: 20px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-top: none;
}

.wed-quote-items-grid.wed-layout-grid.wed-columns-1 {
    grid-template-columns: 1fr;
}

.wed-quote-items-grid.wed-layout-grid.wed-columns-2 {
    grid-template-columns: repeat(2, 1fr);
}

.wed-quote-items-grid.wed-layout-grid.wed-columns-3 {
    grid-template-columns: repeat(3, 1fr);
}

.wed-quote-items-grid.wed-layout-grid.wed-columns-4 {
    grid-template-columns: repeat(4, 1fr);
}

.wed-quote-items-grid.wed-layout-list {
    grid-template-columns: 1fr;
}

.wed-quote-item-card {
    position: relative;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.wed-quote-item-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.wed-remove-btn-top {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 15px;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid #ffc107;
    border-radius: 25px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: #856404;
    transition: all 0.3s ease;
}

.wed-remove-btn-top:hover {
    background: #ffc107;
    color: #fff;
    transform: scale(1.05);
}

.wed-remove-btn-top svg {
    width: 18px;
    height: 18px;
}

.wed-remove-text {
    display: inline;
}

.wed-quote-item-image {
    position: relative;
    overflow: hidden;
    aspect-ratio: 1;
}

.wed-quote-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wed-quote-item-details {
    padding: 15px;
}

.wed-quote-item-title {
    margin: 0 0 10px 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.wed-quote-item-attributes {
    margin: 8px 0;
    font-size: 14px;
    color: #666;
    line-height: 1.5;
}

.wed-quote-item-attributes strong {
    color: #444;
}

.wed-quote-item-description {
    margin: 10px 0;
    font-size: 14px;
    color: #666;
    line-height: 1.5;
}

.wed-quote-item-quantity {
    margin: 10px 0;
    font-size: 14px;
    color: #666;
}

.wed-quote-item-price {
    margin: 10px 0;
    font-size: 20px;
    font-weight: bold;
    color: #0066cc;
}

/* Layout Liste */
.wed-layout-list .wed-quote-item-card {
    display: flex;
    flex-direction: row;
    align-items: center;
}

.wed-layout-list .wed-quote-item-image {
    width: 200px;
    flex-shrink: 0;
    aspect-ratio: 1;
}

.wed-layout-list .wed-quote-item-details {
    flex: 1;
}

/* Responsive Liste */
@media (max-width: 1024px) {
    .wed-quote-items-grid.wed-layout-grid.wed-columns-3,
    .wed-quote-items-grid.wed-layout-grid.wed-columns-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .wed-quote-list-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .wed-toggle-list-btn {
        width: 100%;
        justify-content: center;
    }
    
    .wed-quote-items-grid {
        grid-template-columns: 1fr !important;
    }
    
    .wed-layout-list .wed-quote-item-card {
        flex-direction: column;
    }
    
    .wed-layout-list .wed-quote-item-image {
        width: 100%;
    }
}

/* Popup de confirmation d'envoi
   ========================================================================== */

.wed-success-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.wed-success-popup-overlay.show {
    opacity: 1;
}

.wed-success-popup {
    background: #fff;
    border-radius: 12px;
    padding: 40px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    transform: translateY(-50px);
    transition: transform 0.3s ease;
}

.wed-success-popup-overlay.show .wed-success-popup {
    transform: translateY(0);
}

.wed-success-icon {
    width: 80px;
    height: 80px;
    background: #28a745;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 50px;
    margin: 0 auto 20px;
    animation: wed-success-pulse 0.6s ease;
}

@keyframes wed-success-pulse {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

.wed-success-popup h2 {
    margin: 0 0 15px 0;
    font-size: 28px;
    color: #333;
}

.wed-success-popup p {
    margin: 0 0 30px 0;
    font-size: 16px;
    line-height: 1.6;
    color: #666;
}

.wed-popup-close {
    display: inline-block;
    padding: 12px 40px;
    background: #0066cc;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.wed-popup-close:hover {
    background: #0052a3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.3);
}

.wed-popup-close:active {
    transform: translateY(0);
}
