/* ========== UNIVERSAL CART SLIDER ========== */

/* Overlay */
.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1001;
    display: none;
    transition: all 0.3s ease;
}

.cart-overlay.active {
    display: block;
}

/* Cart Slider */
.cart-slider {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    max-width: 450px;
    height: 100%;
    background: var(--white);
    z-index: 1002;
    transition: right 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
    box-shadow: -2px 0 20px rgba(0, 0, 0, 0.1);
}

.cart-slider.open {
    right: 0;
}

/* Header */
.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--accent);
    background: var(--white);
}

.cart-header h3 {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 600;
    color: var(--primary);
    margin: 0;
}

.cart-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--secondary);
    transition: all 0.3s ease;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.cart-close:hover {
    color: var(--primary);
    background: var(--accent);
}

/* Cart Items Container */
.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--white);
}

/* Custom Scrollbar */
.cart-items::-webkit-scrollbar {
    width: 4px;
}

.cart-items::-webkit-scrollbar-track {
    background: var(--accent);
}

.cart-items::-webkit-scrollbar-thumb {
    background: var(--secondary);
    border-radius: 4px;
}

/* Empty Cart */
.empty-cart {
    text-align: center;
    padding: 60px 20px;
}

.empty-cart i {
    font-size: 64px;
    color: var(--accent);
    margin-bottom: 20px;
}

.empty-cart p {
    font-family: var(--font-body);
    font-size: 16px;
    color: var(--secondary);
    margin-bottom: 20px;
}

.continue-shopping-btn {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
    padding: 10px 24px;
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 25px;
}

.continue-shopping-btn:hover {
    background: var(--primary);
    color: var(--white);
}

/* Cart Item */
.cart-item {
    display: flex;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 1px solid var(--accent);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.cart-item-image {
    width: 80px;
    height: 80px;
    background: var(--accent);
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}

.cart-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.cart-item-image:hover img {
    transform: scale(1.05);
}

.cart-item-details {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.cart-item-title {
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 5px;
}

.cart-item-price {
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
}

.cart-item-quantity {
    display: flex;
    align-items: center;
    gap: 12px;
}

.quantity-btn {
    width: 28px;
    height: 28px;
    border: 1px solid var(--accent);
    background: var(--white);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quantity-btn:hover {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.quantity-value {
    font-size: 14px;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}

.cart-item-remove {
    color: var(--secondary);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    margin-left: auto;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.cart-item-remove:hover {
    color: #ff4444;
    background: rgba(255, 68, 68, 0.1);
}

/* Footer */
.cart-footer {
    padding: 20px;
    border-top: 1px solid var(--accent);
    background: var(--white);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.02);
}

.cart-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-family: var(--font-body);
    font-size: 16px;
    font-weight: 600;
    color: var(--primary);
}

.total-amount {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}

.checkout-btn {
    width: 100%;
    background: var(--primary);
    color: var(--white);
    border: none;
    padding: 14px;
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 1px;
    cursor: pointer;
    margin-top: 15px;
    transition: all 0.3s ease;
    border-radius: 25px;
}

.checkout-btn:hover {
    background: var(--secondary);
    transform: translateY(-2px);
}

.checkout-btn:active {
    transform: translateY(0);
}

.secure-checkout {
    text-align: center;
    margin-top: 12px;
    font-size: 11px;
    color: var(--secondary);
}

.secure-checkout i {
    margin-right: 5px;
}

/* ========== RESPONSIVE STYLES ========== */

/* Tablet (768px - 1024px) */
@media (max-width: 1024px) {
    .cart-slider {
        max-width: 400px;
    }
}

/* Mobile (up to 768px) */
@media (max-width: 768px) {
    .cart-slider {
        max-width: 100%;
        right: -100%;
    }
    
    .cart-slider.open {
        right: 0;
    }
    
    .cart-header {
        padding: 15px;
    }
    
    .cart-header h3 {
        font-size: 18px;
    }
    
    .cart-close {
        font-size: 24px;
    }
    
    .cart-items {
        padding: 15px;
    }
    
    .cart-item {
        gap: 12px;
        padding: 12px 0;
    }
    
    .cart-item-image {
        width: 65px;
        height: 65px;
    }
    
    .cart-item-title {
        font-size: 13px;
    }
    
    .cart-item-price {
        font-size: 13px;
    }
    
    .quantity-btn {
        width: 25px;
        height: 25px;
        font-size: 12px;
    }
    
    .quantity-value {
        font-size: 13px;
    }
    
    .cart-footer {
        padding: 15px;
    }
    
    .cart-total {
        font-size: 14px;
    }
    
    .total-amount {
        font-size: 18px;
    }
    
    .checkout-btn {
        padding: 12px;
        font-size: 13px;
    }
    
    .empty-cart {
        padding: 40px 15px;
    }
    
    .empty-cart i {
        font-size: 50px;
    }
    
    .empty-cart p {
        font-size: 14px;
    }
    
    .continue-shopping-btn {
        padding: 8px 20px;
        font-size: 12px;
    }
}

/* Small Mobile (up to 480px) */
@media (max-width: 480px) {
    .cart-header {
        padding: 12px;
    }
    
    .cart-header h3 {
        font-size: 16px;
    }
    
    .cart-items {
        padding: 12px;
    }
    
    .cart-item {
        gap: 10px;
        padding: 10px 0;
    }
    
    .cart-item-image {
        width: 55px;
        height: 55px;
    }
    
    .cart-item-title {
        font-size: 12px;
    }
    
    .cart-item-price {
        font-size: 12px;
        margin-bottom: 6px;
    }
    
    .cart-item-quantity {
        gap: 8px;
    }
    
    .quantity-btn {
        width: 22px;
        height: 22px;
        font-size: 11px;
    }
    
    .quantity-value {
        font-size: 12px;
    }
    
    .cart-item-remove {
        font-size: 12px;
        width: 24px;
        height: 24px;
    }
    
    .cart-footer {
        padding: 12px;
    }
    
    .cart-total {
        font-size: 13px;
    }
    
    .total-amount {
        font-size: 16px;
    }
    
    .checkout-btn {
        padding: 10px;
        font-size: 12px;
    }
    
    .secure-checkout {
        font-size: 10px;
    }
    
    .empty-cart {
        padding: 30px 12px;
    }
    
    .empty-cart i {
        font-size: 40px;
    }
    
    .empty-cart p {
        font-size: 13px;
    }
    
    .continue-shopping-btn {
        padding: 7px 16px;
        font-size: 11px;
    }
}

/* Landscape Mode for Mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .cart-slider {
        max-width: 60%;
    }
    
    .cart-items {
        max-height: calc(100vh - 120px);
    }
    
    .cart-item-image {
        width: 50px;
        height: 50px;
    }
}

/* Large Desktop (1200px+) */
@media (min-width: 1200px) {
    .cart-slider {
        max-width: 500px;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    .quantity-btn:active {
        background: var(--primary);
        color: var(--white);
    }
    
    .cart-item-remove:active {
        background: rgba(255, 68, 68, 0.2);
    }
    
    .checkout-btn:active {
        transform: scale(0.98);
    }
}

/* RTL Support (for Arabic) */
[dir="rtl"] .cart-slider {
    right: auto;
    left: -100%;
}

[dir="rtl"] .cart-slider.open {
    right: auto;
    left: 0;
}

[dir="rtl"] .cart-item-remove {
    margin-left: 0;
    margin-right: auto;
}

/* Dark Mode Support (if needed) */
@media (prefers-color-scheme: dark) {
    .cart-slider {
        background: #1a1a2e;
    }
    
    .cart-header {
        border-bottom-color: rgba(255, 255, 255, 0.1);
    }
    
    .cart-item {
        border-bottom-color: rgba(255, 255, 255, 0.1);
    }
    
    .cart-item-title {
        color: var(--white);
    }
    
    .cart-item-price {
        color: var(--accent);
    }
}

/* Loading State for Cart */
.cart-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.cart-loading::after {
    content: '';
    width: 30px;
    height: 30px;
    border: 2px solid var(--accent);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: block;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}