/* Styles pour le système de panier */

/* Lien Panier dans la navigation */
.cart-link-container,
.cart-icon-container {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.cart-link,
.cart-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--accent-color);
    text-decoration: none;
    font-weight: bold;
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 5px 15px;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
    position: relative;
}

.cart-link:hover,
.cart-icon:hover {
    color: var(--accent-color);
    border-bottom: 2px solid var(--accent-color);
}

.cart-link:active,
.cart-icon:active {
    opacity: 0.8;
}

.cart-count {
    position: absolute;
    top: -8px;
    right: -5px;
    background: linear-gradient(135deg, var(--accent-color) 0%, #c82333 100%);
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: none; /* Caché par défaut */
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
    font-family: 'Roboto', sans-serif;
    border: 2px solid var(--main-bg-color);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    animation: bounceIn 0.5s ease;
}

@keyframes bounceIn {
    0% { 
        transform: scale(0);
        opacity: 0;
    }
    50% { 
        transform: scale(1.3);
    }
    100% { 
        transform: scale(1);
        opacity: 1;
    }
}

/* Modal du panier */
.cart-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.cart-modal-content {
    background-color: var(--main-bg-color);
    border: 10px solid var(--border-color);
    box-shadow: 0 0 0 3px var(--accent-color), 0 10px 40px rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cart-modal-header {
    padding: 25px 30px;
    border-bottom: 3px dashed var(--accent-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.3);
}

.cart-modal-header h2 {
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    color: var(--text-color);
    margin: 0;
}

.cart-close {
    background: none;
    border: none;
    font-size: 2.5rem;
    color: var(--text-color);
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
    line-height: 1;
}

.cart-close:hover {
    background-color: var(--accent-color);
    color: white;
    transform: rotate(90deg);
}

.cart-modal-body {
    padding: 20px 30px;
    overflow-y: auto;
    flex: 1;
    min-height: 200px;
}

/* Message panier vide */
.empty-cart-message {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-color);
}

.empty-cart-message p {
    font-size: 1.3rem;
    margin-bottom: 20px;
    opacity: 0.7;
}

.empty-cart-message .btn {
    display: inline-block;
    padding: 12px 30px;
    background-color: var(--accent-color);
    color: white;
    text-decoration: none;
    border-radius: 25px;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    border: 2px solid var(--accent-color);
}

.empty-cart-message .btn:hover {
    background-color: transparent;
    color: var(--accent-color);
    transform: translateY(-2px);
}

/* Articles du panier */
.cart-items {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.cart-item {
    display: grid;
    grid-template-columns: 80px 1fr auto auto;
    gap: 15px;
    align-items: center;
    padding: 15px;
    background-color: rgba(255, 255, 255, 0.6);
    border-radius: 8px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.cart-item:hover {
    border-color: var(--accent-color);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.cart-item-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 5px;
    border: 2px solid var(--border-color);
}

.cart-item-details {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.cart-item-details h4 {
    margin: 0;
    color: var(--text-color);
    font-size: 1.1rem;
    font-weight: bold;
}

.cart-item-price {
    color: var(--accent-color);
    font-weight: bold;
    font-size: 1rem;
    margin: 0;
}

.cart-item-quantity {
    display: flex;
    align-items: center;
    gap: 5px;
    background-color: white;
    padding: 5px;
    border-radius: 25px;
    border: 2px solid var(--border-color);
}

.quantity-btn {
    width: 30px;
    height: 30px;
    border: none;
    background-color: var(--accent-color);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-weight: bold;
}

.quantity-btn:hover {
    background-color: #c82333;
    transform: scale(1.1);
}

.quantity-input {
    width: 50px;
    text-align: center;
    border: none;
    background: transparent;
    font-size: 1rem;
    font-weight: bold;
    color: var(--text-color);
}

.quantity-input:focus {
    outline: none;
}

.remove-btn {
    width: 35px;
    height: 35px;
    border: 2px solid var(--accent-color);
    background-color: white;
    color: var(--accent-color);
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.remove-btn:hover {
    background-color: var(--accent-color);
    color: white;
    transform: scale(1.1);
}

/* Footer du panier */
.cart-modal-footer {
    padding: 20px 30px;
    border-top: 3px dashed var(--accent-color);
    background-color: rgba(255, 255, 255, 0.3);
}

.cart-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text-color);
}

.cart-total span:last-child {
    color: var(--accent-color);
    font-size: 1.8rem;
}

.delivery-note {
    text-align: center;
    padding: 10px 15px;
    margin-bottom: 15px;
    background-color: rgba(40, 167, 69, 0.1);
    border: 2px dashed #28a745;
    border-radius: 8px;
    color: #28a745;
    font-weight: bold;
    font-size: 0.95rem;
}

.cart-actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.cart-btn {
    flex: 1;
    min-width: 150px;
    padding: 12px 25px;
    border: none;
    border-radius: 25px;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Roboto', sans-serif;
}

.cart-btn-primary {
    background-color: var(--accent-color);
    color: white;
    border: 2px solid var(--accent-color);
}

.cart-btn-primary:hover {
    background-color: transparent;
    color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(230, 57, 70, 0.3);
}

.cart-btn-secondary {
    background-color: transparent;
    color: var(--text-color);
    border: 2px solid var(--border-color);
}

.cart-btn-secondary:hover {
    background-color: var(--border-color);
    color: white;
}

/* Notification */
.cart-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: #28a745;
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    z-index: 10001;
    font-weight: bold;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s ease;
}

.cart-notification.show {
    opacity: 1;
    transform: translateX(0);
}

/* Intégration dans la navigation */
nav .cart-link-container,
nav .cart-icon-container {
    display: inline-flex;
    align-items: center;
}

/* Effet de pulse sur le badge */
@keyframes pulse {
    0% { box-shadow: 0 2px 8px rgba(230, 57, 70, 0.4); }
    50% { box-shadow: 0 2px 15px rgba(230, 57, 70, 0.8); }
    100% { box-shadow: 0 2px 8px rgba(230, 57, 70, 0.4); }
}

.cart-count {
    animation: bounceIn 0.5s ease, pulse 2s infinite 1s;
}

/* Responsive */
@media (max-width: 768px) {
    .cart-modal-content {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .cart-item {
        grid-template-columns: 60px 1fr;
        gap: 10px;
    }

    .cart-item-image {
        width: 60px;
        height: 60px;
    }

    .cart-item-quantity {
        grid-column: 2;
        justify-self: start;
    }

    .remove-btn {
        grid-column: 2;
        justify-self: end;
    }

    .cart-actions {
        flex-direction: column;
    }

    .cart-btn {
        min-width: 100%;
    }

    .cart-link,
    .cart-icon {
        font-size: 1rem;
        padding: 5px 10px;
    }

    .cart-count {
        width: 20px;
        height: 20px;
        font-size: 0.65rem;
        top: -6px;
        right: -4px;
    }
}

/* Adaptation pour petits écrans */
@media (max-width: 480px) {
    .cart-link,
    .cart-icon {
        font-size: 0.9rem;
        padding: 5px 8px;
    }
    
    .cart-count {
        width: 18px;
        height: 18px;
        font-size: 0.6rem;
        top: -5px;
        right: -3px;
    }
}
