/**
 * Bexep Cart System - Centralized Cart Styling
 * 
 * This file contains all cart-related styles for a consistent
 * appearance across all pages in the Bexep platform.
 */

/* =============================================
   1. Quantity Controls 
   ============================================= */

.quantity-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 38px;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid #ced4da;
    max-width: 120px;
    margin: 0 auto;
}

.quantity-btn {
    width: 32px;
    height: 100%;
    background: #f8f9fa;
    border: none;
    font-size: 16px;
    line-height: 1;
    transition: background-color 0.2s;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quantity-btn:hover {
    background-color: #e9ecef;
}

.quantity-btn:active {
    background-color: #dce0e5;
}

.quantity-decrease {
    border-radius: 4px 0 0 4px;
}

.quantity-increase {
    border-radius: 0 4px 4px 0;
}

.quantity-input {
    width: 50px !important;
    height: 100%;
    text-align: center;
    border: none;
    border-left: 1px solid #ced4da;
    border-right: 1px solid #ced4da;
    padding: 0;
    flex-grow: 0;
    border-radius: 0;
}

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

/* =============================================
   2. Add to Cart Feedback 
   ============================================= */

.add-to-cart-feedback {
    min-height: 24px;
    margin-left: 8px;
    font-size: 14px;
    display: flex;
    align-items: center;
}

.btn-success-pulse {
    animation: success-pulse 1s;
}

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

/* =============================================
   3. Product In-Cart Indicators 
   ============================================= */

.product-card {
    position: relative;
}

.in-cart-indicator {
    position: absolute;
    top: 8px;
    right: 8px;
    background-color: rgba(25, 135, 84, 0.8);
    color: white;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0);
    transition: all 0.3s;
    z-index: 2;
}

.in-cart .in-cart-indicator {
    opacity: 1;
    transform: scale(1);
}

/* =============================================
   4. Cart Badge Animations 
   ============================================= */

.cart-count-badge {
    position: absolute;
    top: -10px;
    right: -10px;
    background-color: #dc3545;
    color: white;
    border-radius: 50%;
    min-width: 20px;
    height: 20px;
    padding: 0 4px;
    font-size: 12px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.badge-pulse {
    animation: badge-pulse 0.8s;
}

@keyframes badge-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.5); }
    100% { transform: scale(1); }
}

/* =============================================
   5. Cart Page Specific Styles 
   ============================================= */

/* Cart item row styles */
.cart-item-row {
    transition: all 0.3s;
}

.cart-item-row.updating {
    background-color: rgba(0, 123, 255, 0.05);
}

.cart-item-row.removing {
    background-color: rgba(220, 53, 69, 0.05);
}

.cart-item-row.removed {
    overflow: hidden;
    transition: all 0.3s;
}

/* Cart item image */
.cart-item-image {
    width: 80px;
    height: 80px;
    object-fit: contain;
}

/* Cart item details */
.cart-item-details {
    display: flex;
    flex-direction: column;
}

.cart-item-title {
    font-weight: 500;
    margin-bottom: 4px;
}

.cart-item-variant {
    font-size: 14px;
    color: #6c757d;
}

/* Price updates animations */
.cart-item-price,
.cart-item-subtotal,
.cart-total-amount {
    position: relative;
}

.flash {
    animation: price-flash 1s ease-out;
}

@keyframes price-flash {
    0% { background-color: rgba(25, 135, 84, 0.3); }
    100% { background-color: transparent; }
}

/* Quick remove button */
.cart-item-remove {
    background: none;
    border: none;
    color: #dc3545;
    padding: 6px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
    border-radius: 50%;
}

.cart-item-remove:hover {
    opacity: 1;
    background-color: rgba(220, 53, 69, 0.1);
}

.cart-item-feedback {
    min-height: 24px;
    display: inline-block;
}

/* Empty cart message */
.empty-cart-message {
    padding: 3rem 1rem;
    text-align: center;
}

.empty-cart-icon {
    font-size: 3rem;
    color: #6c757d;
    opacity: 0.5;
    margin-bottom: 1rem;
}

/* Cart summary and totals */
.cart-summary {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 1.5rem;
}

.cart-summary-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
}

.cart-summary-row.total {
    border-top: 1px solid #dee2e6;
    margin-top: 0.5rem;
    padding-top: 1rem;
    font-weight: 700;
}

/* =============================================
   6. Variant Selectors (Product Details Page) 
   ============================================= */

.variant-select-area {
    margin: 1rem 0;
}

.variant-card {
    transition: all 0.2s;
    cursor: pointer;
    border-radius: 4px;
    border: 1px solid #dee2e6;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
}

.variant-card:hover {
    background-color: #f8f9fa;
}

.variant-card .form-check-input:checked ~ .form-check-label {
    font-weight: 600;
}

.variant-card .form-check-input:checked + .form-check-label + .variant-price {
    font-weight: 600;
    color: #0d6efd;
}

/* Selected variant display */
.selected-variant-display {
    min-height: 60px;
    padding: 0.75rem;
    background-color: #f8f9fa;
    border-radius: 4px;
    margin-bottom: 1rem;
    transition: all 0.3s;
}

/* =============================================
   7. Cart Mini Dropdown (Header) 
   ============================================= */

.cart-mini-dropdown {
    width: 320px;
    padding: 0;
    overflow: hidden;
}

.cart-mini-header {
    padding: 0.75rem 1rem;
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    font-weight: 500;
}

.cart-mini-body {
    max-height: 300px;
    overflow-y: auto;
}

.cart-mini-item {
    display: flex;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f8f9fa;
}

.cart-mini-image {
    width: 50px;
    height: 50px;
    object-fit: contain;
    margin-right: 1rem;
}

.cart-mini-details {
    flex-grow: 1;
}

.cart-mini-title {
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.cart-mini-price {
    font-size: 0.875rem;
}

.cart-mini-quantity {
    font-size: 0.75rem;
    color: #6c757d;
}

.cart-mini-footer {
    padding: 0.75rem 1rem;
    background-color: #f8f9fa;
    border-top: 1px solid #dee2e6;
}

.cart-mini-total {
    display: flex;
    justify-content: space-between;
    font-weight: 500;
    margin-bottom: 0.75rem;
}

/* =============================================
   8. Mobile Responsiveness
   ============================================= */

@media (max-width: 768px) {
    .cart-item-image {
        width: 60px;
        height: 60px;
    }
    
    .cart-summary {
        margin-top: 1.5rem;
    }
    
    .quantity-wrapper {
        margin: 0;
    }
    
    .cart-mini-dropdown {
        width: 100%;
        position: fixed;
        top: auto !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        transform: none !important;
        max-height: 60vh;
        border-radius: 1rem 1rem 0 0;
    }
}

@media (max-width: 576px) {
    .cart-item-row {
        padding-top: 1rem;
        padding-bottom: 1rem;
    }
    
    .cart-item-details {
        margin-bottom: 0.5rem;
    }
}
