/**
 * Mini Cart Styles
 * CSS cho mini cart với hiển thị giá gốc và giá khuyến mãi
 * 
 * @package SCode_Theme
 */

/* Mini Cart Container */
.mini-cart-container {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    max-width: 400px;
    height: 100vh;
    background: white;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
    z-index: 9999;
    transition: right 0.3s ease;
    overflow-y: auto;
}

.mini-cart-container.open {
    right: 0;
}

/* Mini Cart Header */
.mini-cart-header {
    background: linear-gradient(135deg, #ff6b35, #f7931e);
    color: white;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.mini-cart-title {
    font-size: 1.2rem;
    font-weight: bold;
    margin: 0;
}

.mini-cart-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.mini-cart-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Mini Cart Content */
.mini-cart-content {
    padding: 1rem;
    min-height: calc(100vh - 200px);
}

/* Cart Items */
.cart-items {
    margin-bottom: 1rem;
}

.cart-item {
    display: flex;
    align-items: flex-start;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f0f0f0;
    position: relative;
}

.cart-item:last-child {
    border-bottom: none;
}

/* Item Image */
.item-image {
    width: 60px;
    height: 60px;
    margin-right: 0.75rem;
    flex-shrink: 0;
}

.item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

/* Item Details */
.item-details {
    flex: 1;
    min-width: 0;
}

.item-name {
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
    line-height: 1.3;
}

.item-name a {
    color: #333;
    text-decoration: none;
}

.item-name a:hover {
    color: #ff6b35;
}

/* Price Display */
.item-price {
    margin-bottom: 0.5rem;
}

.price-details {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.price-details .flex {
    align-items: center;
}

.price-details .line-through {
    text-decoration: line-through;
    opacity: 0.7;
}

.price-details .font-bold {
    font-weight: 700;
}

.price-details .text-green-600 {
    color: #16a34a;
    font-weight: 500;
}

.item-subtotal {
    font-size: 0.85rem;
    color: #666;
    margin: 0.5rem 0;
    font-weight: 600;
}

/* Quantity Controls */
.quantity-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.qty-btn {
    width: 24px;
    height: 24px;
    border: 1px solid #ddd;
    background: white;
    color: #333;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.qty-btn:hover {
    background: #f5f5f5;
    border-color: #ff6b35;
    color: #ff6b35;
}

.qty-display {
    min-width: 30px;
    text-align: center;
    font-weight: 600;
    font-size: 0.9rem;
}

/* Remove Item Button */
.remove-item {
    position: absolute;
    top: 0.5rem;
    right: 0;
    background: #ff4757;
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.remove-item:hover {
    background: #ff3742;
}

/* Cart Summary */
.cart-summary {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
}

.cart-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.1rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 1rem;
}

.cart-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.cart-btn {
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    transition: all 0.2s;
    cursor: pointer;
}

.cart-btn.primary {
    background: linear-gradient(135deg, #ff6b35, #f7931e);
    color: white;
}

.cart-btn.primary:hover {
    background: linear-gradient(135deg, #e55a2b, #e0841a);
    transform: translateY(-1px);
}

.cart-btn.secondary {
    background: white;
    color: #333;
    border: 2px solid #ddd;
}

.cart-btn.secondary:hover {
    border-color: #ff6b35;
    color: #ff6b35;
}

/* Empty Cart */
.empty-cart {
    text-align: center;
    padding: 2rem 1rem;
    color: #666;
}

.empty-cart p {
    margin: 0;
    font-size: 1rem;
}

/* Loading State */
.cart-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.cart-loading::after {
    content: '';
    width: 24px;
    height: 24px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #ff6b35;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 480px) {
    .mini-cart-container {
        width: 100%;
        max-width: 100%;
        right: 0;
        left: 0;
        height: 85vh;
        margin: 0;
        border-radius: 16px 16px 0 0;
        z-index: 9999;
    }
    
    .cart-item {
        padding: 0.5rem 0;
    }
    
    .item-image {
        width: 50px;
        height: 50px;
        margin-right: 0.5rem;
    }
    
    .item-name {
        font-size: 0.85rem;
    }
    
    .price-details {
        font-size: 0.8rem;
    }
    
    .quantity-controls {
        gap: 0.25rem;
    }
    
    .qty-btn {
        width: 20px;
        height: 20px;
        font-size: 0.7rem;
    }
    
    .qty-display {
        min-width: 25px;
        font-size: 0.8rem;
    }

    .mini-cart-content {
        max-height: 60vh;
        overflow-y: auto;
    }

    .mini-cart-footer {
        position: sticky;
        bottom: 0;
        background: #fff;
        padding-bottom: env(safe-area-inset-bottom, 12px);
        z-index: 1;
    }
}

/* Animation for price changes */
.price-details {
    transition: all 0.3s ease;
}

.price-details.updated {
    animation: priceUpdate 0.5s ease;
}

@keyframes priceUpdate {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Badge for sale items */
.sale-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4757;
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    padding: 0.2rem 0.4rem;
    border-radius: 10px;
    z-index: 1;
}

/* Hover effects */
.cart-item:hover {
    background-color: #f8f9fa;
    border-radius: 4px;
    margin: 0 -0.5rem;
    padding: 0.75rem 0.5rem;
}

.cart-item:hover .remove-item {
    opacity: 1;
}

.remove-item {
    opacity: 1;
    transition: opacity 0.2s;
}

