/**
 * ================================================================
 * SHOPPING CART STYLES
 * ================================================================
 */

/* ========== CART BADGE (Header) ========== */
.cart-icon-wrapper {
    position: relative;
    display: inline-block;
}

#cart-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: linear-gradient(135deg, #ff4757, #ff6348);
    color: white;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    box-shadow: 0 2px 8px rgba(255, 71, 87, 0.4);
    animation: badgePulse 2s ease-in-out infinite;
    z-index: 10;
}

@keyframes badgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.badge-bounce {
    animation: badgeBounce 0.5s ease !important;
}

@keyframes badgeBounce {
    0%, 100% { transform: scale(1); }
    25% { transform: scale(1.3); }
    50% { transform: scale(0.9); }
    75% { transform: scale(1.2); }
}

/* ========== MINI CART DROPDOWN ========== */
#mini-cart-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 350px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
    max-height: 500px;
    overflow-y: auto;
}

#mini-cart-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Dark Mode - Mini Cart */
body.dark-mode #mini-cart-dropdown {
    background: #2d3238;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.mini-cart-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s ease;
}

.mini-cart-item:hover {
    background: #f8f9fa;
}

.mini-cart-item img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
}

.mini-item-info {
    flex: 1;
}

.mini-item-info h4 {
    font-size: 14px;
    margin: 0 0 5px 0;
    color: #2d3436;
}

.mini-item-info p {
    font-size: 12px;
    color: #636e72;
    margin: 0;
}

.mini-remove-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: #b2bec3;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.mini-remove-btn:hover {
    background: #ff4757;
    color: white;
}

.mini-cart-footer {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 0 0 12px 12px;
}

.mini-cart-total {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 16px;
}

.empty-cart {
    padding: 40px 20px;
    text-align: center;
    color: #636e72;
}

.empty-cart p {
    margin: 0;
    font-size: 14px;
}

.mini-cart-more {
    text-align: center;
    padding: 10px;
    color: #636e72;
    font-size: 13px;
    margin: 0;
}

/* ========== CART PAGE ========== */
.cart-page-container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 30px;
}

.cart-items-section h2 {
    font-size: 28px;
    margin-bottom: 20px;
    color: #2d3436;
}

#cart-items-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Cart Item */
.cart-item {
    background: white;
    border-radius: 12px;
    padding: 20px;
    display: grid;
    grid-template-columns: 100px 1fr auto auto auto;
    gap: 20px;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    position: relative;
}

.cart-item:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.cart-item-image img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
}

.cart-item-details h3 {
    font-size: 18px;
    margin: 0 0 8px 0;
    color: #2d3436;
}

.cart-item-type {
    font-size: 13px;
    color: #636e72;
    margin: 0 0 5px 0;
}

.cart-item-price {
    font-size: 16px;
    font-weight: 600;
    color: #0984e3;
    margin: 0;
}

/* Quantity Controls */
.cart-item-quantity {
    display: flex;
    align-items: center;
    gap: 5px;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 5px;
}

.qty-btn {
    width: 32px;
    height: 32px;
    background: white;
    border: 1px solid #dfe6e9;
    border-radius: 6px;
    font-size: 18px;
    font-weight: 600;
    color: #2d3436;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qty-btn:hover {
    background: #0984e3;
    color: white;
    border-color: #0984e3;
}

.cart-item-quantity input {
    width: 50px;
    height: 32px;
    text-align: center;
    border: 1px solid #dfe6e9;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
}

.cart-item-subtotal {
    min-width: 100px;
    text-align: right;
}

.cart-item-subtotal strong {
    font-size: 18px;
    color: #2d3436;
}

.cart-item-remove {
    background: none;
    border: none;
    color: #b2bec3;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.cart-item-remove:hover {
    background: #ff4757;
    color: white;
}

/* Cart Sidebar */
.cart-sidebar {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    position: sticky;
    top: 20px;
    height: fit-content;
}

.cart-sidebar h3 {
    font-size: 22px;
    margin: 0 0 20px 0;
    color: #2d3436;
}

.cart-summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 15px;
    color: #636e72;
}

.cart-summary-row.total {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 2px solid #f0f0f0;
    font-size: 20px;
    font-weight: 700;
    color: #2d3436;
}

.checkout-btn {
    width: 100%;
    margin-top: 20px;
    padding: 15px;
    background: linear-gradient(135deg, #0984e3, #00b894);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.checkout-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(9, 132, 227, 0.4);
}

.continue-shopping-btn {
    width: 100%;
    margin-top: 10px;
    padding: 12px;
    background: white;
    color: #0984e3;
    border: 2px solid #0984e3;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    display: block;
    text-decoration: none;
}

.continue-shopping-btn:hover {
    background: #0984e3;
    color: white;
}

#clear-cart-btn {
    width: 100%;
    margin-top: 15px;
    padding: 10px;
    background: white;
    color: #ff4757;
    border: 1px solid #ff4757;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

#clear-cart-btn:hover {
    background: #ff4757;
    color: white;
}

/* Empty Cart */
.empty-cart-page {
    text-align: center;
    padding: 80px 20px;
    grid-column: 1 / -1;
}

.empty-cart-icon {
    font-size: 80px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-cart-page h2 {
    font-size: 32px;
    margin: 0 0 15px 0;
    color: #2d3436;
}

.empty-cart-page p {
    font-size: 16px;
    color: #636e72;
    margin: 0 0 30px 0;
}

/* Toast Notification */
.cart-toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: white;
    padding: 15px 25px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    font-size: 14px;
    font-weight: 600;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s ease;
    z-index: 10000;
}

.cart-toast.show {
    opacity: 1;
    transform: translateX(0);
}

.cart-toast-success {
    border-left: 4px solid #00b894;
    color: #00b894;
}

.cart-toast-error {
    border-left: 4px solid #ff4757;
    color: #ff4757;
}

.cart-toast-info {
    border-left: 4px solid #0984e3;
    color: #0984e3;
}

/* Animations */
@keyframes slideOutRight {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* ========== RESPONSIVE ========== */
@media (max-width: 992px) {
    .cart-page-container {
        grid-template-columns: 1fr;
    }
    
    .cart-sidebar {
        position: static;
        order: 2;
    }
    
    #mini-cart-dropdown {
        width: 300px;
    }
}

@media (max-width: 768px) {
    .cart-item {
        grid-template-columns: 80px 1fr;
        gap: 15px;
    }
    
    .cart-item-quantity,
    .cart-item-subtotal {
        grid-column: 2;
    }
    
    .cart-item-remove {
        position: absolute;
        top: 10px;
        right: 10px;
    }
    
    #mini-cart-dropdown {
        width: 280px;
        right: -50px;
    }
}

/* Dark Mode Support */
body.dark-mode .cart-item,
body.dark-mode .cart-sidebar,
body.dark-mode #mini-cart-dropdown {
    background: #2d3436;
    color: #dfe6e9;
}

body.dark-mode .cart-item-details h3,
body.dark-mode .cart-item-subtotal strong {
    color: #dfe6e9;
}

body.dark-mode .qty-btn {
    background: #636e72;
    color: white;
    border-color: #636e72;
}

body.dark-mode .mini-cart-footer {
    background: #1e272e;
}
