/**
 * Стилі для системи кошика
 */

/* Модальне вікно кошика */
.cart-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.cart-modal {
    background: white;
    border-radius: 12px;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.cart-modal-header {
    padding: 20px 30px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
}

.cart-modal-header h2 {
    margin: 0;
    color: #262251;
    font-size: 24px;
    font-weight: 600;
}

.cart-modal-close {
    background: none;
    border: none;
    font-size: 30px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.cart-modal-close:hover {
    background-color: #f0f0f0;
    color: #262251;
}

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

.cart-modal-footer {
    padding: 20px 30px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
}

/* Товари в кошику */
#cart-items-container {
    margin-bottom: 20px;
}

.cart-item {
    display: flex;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #f0f0f0;
    gap: 15px;
}

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

.cart-item-image {
    flex-shrink: 0;
}

.cart-item-image img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
}

.cart-item-details {
    flex: 1;
    min-width: 0;
}

.cart-item-details h4 {
    margin: 0 0 5px 0;
    font-size: 16px;
    font-weight: 600;
    color: #262251;
}

.cart-item-ingredient {
    margin: 0 0 5px 0;
    font-size: 14px;
    color: #666;
}

.cart-item-price {
    margin: 0;
    font-size: 14px;
    color: #888;
}

.cart-item-quantity {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 15px;
}

.cart-quantity-btn {
    background: #262251;
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
}

.cart-quantity-btn:hover {
    background: #1a1640;
    transform: scale(1.1);
}

.cart-item-quantity input {
    width: 50px;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 5px;
    font-size: 14px;
}

.cart-item-total {
    font-weight: 600;
    color: #262251;
    margin-right: 15px;
    font-size: 16px;
}

.cart-item-remove {
    flex-shrink: 0;
}

.cart-remove-btn {
    background: #f44336;
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.cart-remove-btn:hover {
    background: #d32f2f;
    transform: scale(1.1);
}

/* Загальна сума */
.cart-total {
    text-align: right;
    padding: 15px 0;
    border-top: 2px solid #262251;
    font-size: 18px;
    color: #262251;
}

/* Порожній кошик */
.empty-cart {
    text-align: center;
    padding: 40px 20px;
    color: #999;
    font-size: 16px;
}

/* Кнопки */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: #262251;
    color: white;
}

.btn-primary:hover {
    background: #1a1640;
    transform: translateY(-1px);
    box-shadow: 0 5px 15px rgba(38, 34, 81, 0.3);
}

.btn-secondary {
    background: transparent;
    color: #262251;
    border: 2px solid #262251;
}

.btn-secondary:hover {
    background: #262251;
    color: white;
}

/* Адаптивні стилі */
@media (max-width: 768px) {
    .cart-modal {
        width: 95%;
        max-height: 95vh;
    }
    
    .cart-modal-header,
    .cart-modal-body,
    .cart-modal-footer {
        padding: 15px 20px;
    }
    
    .cart-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .cart-item-image {
        align-self: center;
    }
    
    .cart-item-details {
        text-align: center;
        width: 100%;
    }
    
    .cart-item-quantity {
        align-self: center;
        margin: 0;
    }
    
    .cart-item-total {
        align-self: center;
        margin: 0;
    }
    
    .cart-item-remove {
        align-self: center;
    }
    
    .cart-modal-footer {
        flex-direction: column;
        gap: 10px;
    }
    
    .btn {
        width: 100%;
    }
}

/* Кнопки додавання в кошик */
.add-to-cart-btn {
    background: transparent;
    color: #262251;
    border: 2px solid #262251;
    padding: 12px 32px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.add-to-cart-btn:hover {
    background: #262251;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(38, 34, 81, 0.3);
}

/* Лічильник товарів в кошику */
.cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: #262251;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    z-index: 1;
}

/* Сповіщення */
.cart-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 4px;
    color: white;
    font-weight: 500;
    z-index: 10001;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    transform: translateX(400px);
    animation: slideIn 0.3s ease forwards;
}

.cart-notification.success {
    background-color: #4CAF50;
}

.cart-notification.error {
    background-color: #f44336;
}

@keyframes slideIn {
    to {
        transform: translateX(0);
    }
}

/* Додаткові стилі для інтеграції з існуючою темою */
.buy-section .add-to-cart-btn {
    margin-right: 15px;
}

/* Анімація завантаження для кнопок */
.add-to-cart-btn.loading {
    opacity: 0.7;
    pointer-events: none;
}

.add-to-cart-btn.loading::after {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 8px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
