/* ========================================
   Side Cart - Apple-style Minimal Design
   v2.0 - Clean & Professional
   ======================================== */

/* Overlay */
.side-cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.side-cart-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Side Cart Container */
.side-cart {
    position: fixed;
    top: 0;
    right: -450px;
    width: 420px;
    max-width: 100%;
    height: 100%;
    background-color: #fff;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    box-shadow: -2px 0 20px rgba(0, 0, 0, 0.08);
    transition: right 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.side-cart.active {
    right: 0;
}

/* Header - Apple Style */
.side-cart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    background: #1d1d1f;
    color: #fff;
    border-bottom: none;
}

.side-cart-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.01em;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
}

.side-cart-title i {
    font-size: 20px;
    opacity: 0.9;
}

.side-cart-count {
    font-weight: 400;
    opacity: 0.7;
    font-size: 15px;
}

.side-cart-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.side-cart-close:hover {
    background: rgba(255, 255, 255, 0.15);
}

.side-cart-close i {
    font-size: 12px;
}

/* Body */
.side-cart-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    background-color: #f5f5f7;
}

.side-cart-body::-webkit-scrollbar {
    width: 6px;
}

.side-cart-body::-webkit-scrollbar-track {
    background: transparent;
}

.side-cart-body::-webkit-scrollbar-thumb {
    background: #d2d2d7;
    border-radius: 3px;
}

.side-cart-body::-webkit-scrollbar-thumb:hover {
    background: #86868b;
}

/* Loading */
.side-cart-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
}

.side-cart-loading .spinner-border {
    color: #1d1d1f;
    width: 36px;
    height: 36px;
}

/* Cart Items */
.side-cart-items {
    padding: 0;
}

.side-cart-item {
    display: flex;
    padding: 16px 20px;
    background: #fff;
    border-bottom: 1px solid #e8e8ed;
    transition: background-color 0.15s ease;
    position: relative;
}

.side-cart-item:hover {
    background-color: #fbfbfd;
}

.side-cart-item-image {
    width: 72px;
    height: 72px;
    flex-shrink: 0;
    border-radius: 12px;
    overflow: hidden;
    background: #f5f5f7;
    border: none;
}

.side-cart-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.side-cart-item:hover .side-cart-item-image img {
    transform: scale(1.02);
}

.side-cart-item-details {
    flex: 1;
    padding-left: 14px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.side-cart-item-title {
    font-size: 14px;
    font-weight: 500;
    color: #1d1d1f;
    line-height: 1.4;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-decoration: none;
    transition: color 0.2s ease;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
}

.side-cart-item-title:hover {
    color: #06c;
    text-decoration: none;
}

.side-cart-item-price {
    font-size: 15px;
    font-weight: 600;
    color: #1d1d1f;
    margin-bottom: 8px;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
}

.side-cart-item-quantity {
    display: flex;
    align-items: center;
    gap: 0;
}

.side-cart-item-quantity button {
    width: 28px;
    height: 28px;
    border: 1px solid #d2d2d7;
    background: #fff;
    color: #1d1d1f;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s ease;
}

.side-cart-item-quantity button:first-child {
    border-radius: 6px 0 0 6px;
}

.side-cart-item-quantity button:last-child {
    border-radius: 0 6px 6px 0;
}

.side-cart-item-quantity button:hover {
    background: #f5f5f7;
    border-color: #86868b;
}

.side-cart-item-quantity input {
    width: 36px;
    height: 28px;
    border: 1px solid #d2d2d7;
    border-left: none;
    border-right: none;
    text-align: center;
    font-size: 13px;
    font-weight: 500;
    color: #1d1d1f;
    background: #fff;
}

.side-cart-item-quantity input:focus {
    outline: none;
}

.side-cart-item-remove {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    color: #86868b;
    cursor: pointer;
    padding: 4px;
    font-size: 12px;
    transition: all 0.15s ease;
    opacity: 0;
}

.side-cart-item:hover .side-cart-item-remove {
    opacity: 1;
}

.side-cart-item-remove:hover {
    color: #ff3b30;
}

/* Out of Stock Badge */
.side-cart-out-of-stock {
    display: inline-block;
    background: #ff3b30;
    color: #fff;
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 4px;
    margin-top: 4px;
    font-weight: 500;
}

/* Digital Product Badge */
.side-cart-digital-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #5856d6;
    color: #fff;
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 4px;
    margin-bottom: 6px;
    font-weight: 500;
}

.side-cart-digital-badge i {
    font-size: 10px;
}

/* Footer */
.side-cart-footer {
    padding: 20px 24px;
    background: #fff;
    border-top: 1px solid #e8e8ed;
}

.side-cart-subtotal {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 15px;
}

.side-cart-subtotal span:first-child {
    font-weight: 500;
    color: #86868b;
}

.side-cart-price {
    font-weight: 600;
    color: #1d1d1f;
    font-size: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
}

/* Free Shipping Note - Apple Style */
.side-cart-shipping-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #f5f5f7;
    color: #1d1d1f;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 16px;
    border: 1px solid #e8e8ed;
}

.side-cart-shipping-note i {
    font-size: 16px;
    color: #34c759;
}

.side-cart-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.btn-side-cart-view,
.btn-side-cart-checkout {
    flex: 1;
    padding: 14px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
}

.btn-side-cart-view {
    background: #fff;
    color: #1d1d1f;
    border: 1px solid #1d1d1f;
}

.btn-side-cart-view:hover {
    background: #1d1d1f;
    color: #fff;
    text-decoration: none;
}

/* Primary Button - Apple Blue */
.btn-side-cart-checkout {
    background: #0071e3;
    color: #fff;
    border: none;
}

.btn-side-cart-checkout:hover {
    background: #0077ed;
    color: #fff;
    text-decoration: none;
}

.side-cart-continue {
    display: block;
    text-align: center;
    color: #06c;
    font-size: 13px;
    text-decoration: none;
    padding: 8px;
    transition: color 0.15s ease;
    font-weight: 500;
}

.side-cart-continue:hover {
    color: #0077ed;
    text-decoration: underline;
}

.side-cart-continue i {
    margin-right: 6px;
    transition: transform 0.2s ease;
}

.side-cart-continue:hover i {
    transform: translateX(-3px);
}

/* Empty Cart */
.side-cart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: calc(100% - 80px);
    padding: 40px;
    text-align: center;
    background: #f5f5f7;
}

.side-cart-empty-icon {
    width: 80px;
    height: 80px;
    background: #e8e8ed;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.side-cart-empty-icon i {
    font-size: 32px;
    color: #86868b;
}

.side-cart-empty-text {
    font-size: 17px;
    font-weight: 500;
    color: #1d1d1f;
    margin-bottom: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
}

.btn-side-cart-shop {
    background: #0071e3;
    color: #fff;
    padding: 14px 28px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-side-cart-shop:hover {
    background: #0077ed;
    color: #fff;
    text-decoration: none;
}

/* Progress Bar for Free Shipping */
.side-cart-progress-container {
    padding: 16px 20px;
    background: #fff;
    border-bottom: 1px solid #e8e8ed;
}

.side-cart-progress-text {
    font-size: 13px;
    color: #86868b;
    margin-bottom: 10px;
    text-align: center;
}

.side-cart-progress-text strong {
    color: #1d1d1f;
    font-weight: 600;
}

.side-cart-progress-bar {
    height: 4px;
    background: #e8e8ed;
    border-radius: 2px;
    overflow: hidden;
}

.side-cart-progress-fill {
    height: 100%;
    background: #34c759;
    border-radius: 2px;
    transition: width 0.4s ease;
}

.side-cart-progress-complete {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #1d1d1f;
    font-weight: 500;
    font-size: 13px;
}

.side-cart-progress-complete i {
    color: #34c759;
}

/* Added to Cart Animation */
@keyframes cartPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

.cart-icon-pulse {
    animation: cartPulse 0.4s ease;
}

/* Item Added Animation */
@keyframes slideInItem {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.side-cart-item.new-item {
    animation: slideInItem 0.3s ease;
}

/* Responsive */
@media (max-width: 480px) {
    .side-cart {
        width: 100%;
        right: -100%;
    }
    
    .side-cart-header {
        padding: 16px 20px;
    }
    
    .side-cart-title {
        font-size: 16px;
    }
    
    .side-cart-item {
        padding: 14px 16px;
    }
    
    .side-cart-item-image {
        width: 64px;
        height: 64px;
    }
    
    .side-cart-footer {
        padding: 16px 20px;
    }
    
    .side-cart-buttons {
        flex-direction: column;
    }
    
    .btn-side-cart-view,
    .btn-side-cart-checkout {
        width: 100%;
    }
}

/* Body scroll lock when side cart is open */
body.side-cart-open {
    overflow: hidden;
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .side-cart,
    .side-cart-overlay,
    .side-cart-item,
    .side-cart-item-image img,
    .side-cart-item-remove,
    .btn-side-cart-view,
    .btn-side-cart-checkout,
    .side-cart-progress-fill {
        transition: none;
    }
    
    .cart-icon-pulse,
    .side-cart-item.new-item {
        animation: none;
    }
}
