/* القائمة الجانبية للسلة */
.cart-sidebar {
    position: fixed;
    top: 0;
    right: -380px;
    width: 380px;
    height: 100vh;
    z-index: 10000;
    transition: right 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.cart-sidebar.active {
    right: 0;
}

.cart-sidebar-content {
    width: 100%;
    height: 100%;
    background: #ffffff;
    box-shadow: -3px 0 15px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    border-left: 1px solid #e9ecef;
    position: relative;
    z-index: 10001;
}

.cart-sidebar-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
}

.cart-sidebar-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.cart-sidebar-close {
    background: #fff;
    border: 1px solid #ddd;
    width: 30px;
    height: 30px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.cart-sidebar-close:hover {
    background: #f8f9fa;
    color: #333;
}

.cart-sidebar-body {
    flex: 1;
    overflow-y: auto;
    background: #fff;
}

.cart-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #666;
    gap: 10px;
}

.cart-empty {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.cart-empty i {
    font-size: 48px;
    margin-bottom: 15px;
    color: #ddd;
}

/* عنصر السلة */
.cart-item {
    display: flex;
    align-items: flex-start;
    padding: 15px 20px;
    border-bottom: 1px solid #f0f0f0;
    gap: 15px;
    transition: background-color 0.2s ease;
    position: relative;
}

.cart-item:hover {
    background: #f8f9fa;
}

.cart-item-content {
    display: flex;
    flex: 1;
    gap: 15px;
    align-items: flex-start;
}

.cart-item-image {
    width: 65px;
    height: 65px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid #e9ecef;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.cart-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cart-item-details {
    flex: 1;
    min-width: 0;
}

.cart-item-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 6px;
    font-size: 14px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cart-item-variants {
    font-size: 11px;
    color: #666;
    margin-bottom: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.cart-item-variant {
    background: linear-gradient(135deg, #e3f2fd 0%, #f1f8ff 100%);
    color: #1976d2;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 500;
    border: 1px solid #bbdefb;
}

.cart-item-price {
    font-weight: 700;
    color: #007cba;
    font-size: 14px;
    margin-bottom: 8px;
    text-shadow: 0 1px 2px rgba(0,124,186,0.1);
}

/* عرض الخصومات على المنتجات */
.cart-item-price-wrapper {
    margin-bottom: 8px;
}

.cart-item-price.original-price {
    font-size: 12px;
    color: #999;
    text-decoration: line-through;
    font-weight: 500;
    margin-bottom: 4px;
}

.cart-item-price.discounted-price {
    font-size: 14px;
    color: #dc3545;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
}

.discount-badge {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 9px;
    font-weight: 600;
    white-space: nowrap;
}

.cart-item-quantity {
    display: flex;
    align-items: center;
}

.qty-controls {
    display: flex;
    align-items: center;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    overflow: hidden;
    background: #f8f9fa;
    font-size: 11px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.qty-btn {
    background: linear-gradient(135deg, #007cba 0%, #005a87 100%);
    border: none;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 12px;
    color: white;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    border-radius: 50%;
    margin: 2px;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.qty-btn:hover {
    background: linear-gradient(135deg, #005a87 0%, #004066 100%);
}

.qty-btn:active {
    background: linear-gradient(135deg, #004066 0%, #003050 100%);
}

.qty-display {
    padding: 0 8px;
    font-size: 12px;
    min-width: 20px;
    text-align: center;
    background: white;
    color: #333;
    font-weight: 600;
    line-height: 24px;
    transition: all 0.2s ease;
}

.cart-item-remove {
    background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
    border: 1px solid #dc3545;
    color: #dc3545;
    cursor: pointer;
    position: absolute;
    top: 15px;
    left: 10px;
    padding: 6px 8px;
    border-radius: 8px;
    transition: background-color 0.2s ease, color 0.2s ease;
    font-size: 12px;
    height: fit-content;
    margin-top: 2px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.cart-item-remove:hover {
    background: #dc3545;
    color: white;
}

.cart-sidebar-footer {
    border-top: 1px solid #e9ecef;
    padding: 20px;
    background: #f8f9fa;
}

/* قسم الكوبون */
.cart-coupon-section {
    padding: 8px 12px;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
}

.cart-coupon-form {
    display: flex;
    gap: 5px;
}

.cart-coupon-input {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    transition: all 0.2s;
    font-family: inherit;
    height: 32px;
}

.cart-coupon-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.cart-coupon-btn {
    padding: 6px 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    height: 32px;
}

.cart-coupon-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(102, 126, 234, 0.3);
}

.cart-coupon-applied {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border: 1px solid #28a745;
    border-radius: 4px;
    font-size: 12px;
    color: #155724;
    font-weight: 500;
    animation: slideIn 0.3s ease-out;
}

.cart-coupon-applied i {
    margin-left: 6px;
}

.cart-coupon-remove {
    background: none;
    border: none;
    color: #721c24;
    cursor: pointer;
    padding: 2px 6px;
    font-size: 16px;
    transition: all 0.2s;
    border-radius: 3px;
}

.cart-coupon-remove:hover {
    background: rgba(114, 28, 36, 0.1);
    transform: scale(1.1);
}

/* قسم الملخص */
.cart-summary {
    padding: 12px 15px;
    border-bottom: 1px solid #e9ecef;
    background: white;
    display: none;
}

.cart-summary.show {
    display: block;
}

.cart-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 13px;
}

.cart-summary-row.subtotal {
    color: #666;
    font-weight: 500;
}

.cart-summary-row.discount {
    color: #dc3545;
    font-weight: 600;
    background: none !important;
    padding: 6px 0 !important;
    border-radius: 0 !important;
}

.cart-summary-row.discount span {
    background: none !important;
}

.cart-summary-row.discount .discount-percentage {
    font-size: 11px;
    color: #999;
    margin-right: 4px;
    font-weight: 400;
    background: none !important;
}

.cart-summary-row.shipping {
    color: #666;
    font-weight: 500;
}

.cart-summary-row.total {
    font-size: 14px;
    font-weight: 700;
    color: #28a745;
    padding-top: 12px;
    border-top: 2px solid #e9ecef;
    margin-top: 8px;
}

.cart-summary-row span:last-child {
    font-weight: 600;
}

.cart-summary-row.total span:last-child {
    font-size: 15px;
}

.cart-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    font-size: 16px;
    font-weight: 600;
}

.cart-total span:last-child {
    transition: all 0.2s ease;
}

.cart-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 15px;
}

.cart-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    transition: all 0.2s;
    font-size: 14px;
}

.cart-btn-primary {
    background: linear-gradient(135deg, #007cba 0%, #005a87 100%);
    color: white;
    box-shadow: 0 3px 6px rgba(0,124,186,0.3);
    transition: background-color 0.2s ease;
}

.cart-btn-primary:hover {
    background: linear-gradient(135deg, #005a87 0%, #004066 100%);
}

/* استجابة للشاشات الصغيرة */
@media (max-width: 768px) {
    .cart-sidebar {
        right: -100%;
        width: 100%;
    }
    
    .cart-sidebar.active {
        right: 0;
    }
    
    .cart-coupon-section {
        padding: 6px 10px;
    }
    
    .cart-coupon-input {
        font-size: 11px;
        padding: 5px 8px;
        height: 30px;
    }
    
    .cart-coupon-btn {
        font-size: 11px;
        padding: 5px 12px;
        height: 30px;
    }
    
    .cart-summary {
        padding: 10px 12px;
    }
    
    .cart-summary-row {
        padding: 5px 0;
        font-size: 12px;
    }
    
    .cart-summary-row.total {
        font-size: 13px;
    }
    
    .cart-summary-row.total span:last-child {
        font-size: 14px;
    }
    
    .cart-actions {
        padding: 12px;
    }
    
    .cart-btn {
        padding: 10px 18px;
        font-size: 13px;
    }
}

/* عداد السلة */
.cart-count {
    background: #dc3545;
    color: white;
    border-radius: 50%;
    padding: 3px 6px;
    font-size: 12px;
    font-weight: 600;
    position: absolute;
    top: -8px;
    right: -8px;
    min-width: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

/* أنيميشن */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
