/**
 * Cart Drawer & Horizontal Product Card Styles
 * Integrates with Alsaadhome Design System
 */

/* Cart Drawer Container */
.cart-drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    display: none;
    z-index: 1050;
    transition: opacity 0.3s ease;
}

.cart-drawer {
    position: fixed;
    top: 0;
    right: -100%;
    /* Hidden by default */
    width: 400px;
    height: 100%;
    background: #fff;
    z-index: 1051;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
    transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
}

.cart-drawer.open {
    right: 0;
}

/* Header */
.cart-drawer-header {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f1f5f9;
}

.cart-drawer-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: var(--clr-text-main);
}

.close-cart-drawer {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--clr-text-muted);
    padding: 5px;
    line-height: 0;
}

/* Body */
.cart-drawer-body {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
}

/* Horizontal Product Card */
.product-card-horizontal {
    display: flex;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    margin-bottom: 15px;
    border: 1px solid #f1f5f9;
    position: relative;
    transition: transform 0.2s ease;
}

.product-card-horizontal:hover {
    transform: translateY(-2px);
}

.product-card-img {

    padding: 8px 0px 0px 8px;
    flex: 0 0 40%;
    position: relative;
}

.product-card-img img {

    object-fit: contain;
    border-radius: 8px;
}

/* Badges */
.cart-badge {
    position: absolute;
    top: 5px;
    left: 5px;
    z-index: 2;
    max-width: 60px;
}

.cart-badge img {
    width: 100%;
    height: auto;
    object-fit: contain;
}

.product-card-details {
    flex: 1;
    padding: 12px 15px 12px 5px;
    display: flex;
    flex-direction: column;
}

.product-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--clr-text-main);
    margin: 0 0 6px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
    padding-right: 35px;
    /* Avoid overlap with absolute remove button */
}

.price-section {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.discount-price {
    font-size: 18px;
    font-weight: 700;
    color: var(--clr-primary);
}

.original-price {
    font-size: 13px;
    color: var(--clr-text-muted);
    text-decoration: line-through;
}

.discount-pct {
    font-size: 11px;
    font-weight: 600;
    color: var(--clr-success-premium);
    background: #f0fdf4;
    padding: 2px 6px;
    border-radius: 4px;
}

.card-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    font-size: 12px;
}

.label-muted {
    color: var(--clr-text-muted);
    font-weight: 500;
}

.pattern-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1px solid #e2e8f0;
    object-fit: cover;
}

/* Quantity Display */
.drawer-quantity-wrapper {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.drawer-qty-display {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.drawer-qty-display .qty-value {
    font-weight: 700;
    color: var(--clr-primary);
    font-size: 15px;
}

/* Stock Messages */
.stock-message {
    font-size: 11px;
    margin-top: 4px;
    font-weight: 500;
}

.stock-error {
    color: var(--clr-primary);
}

.btn-remove-item {
    position: absolute;
    top: 10px;
    right: 10px;
    color: #94a3b8;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    padding: 6px;
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.btn-remove-item:hover {
    color: #ef4444;
    background: #fef2f2;
    border-color: #fee2e2;
    transform: scale(1.05);
}

.btn-remove-item svg {
    width: 16px;
    height: 16px;
}

/* Footer */
.cart-drawer-footer {
    padding: 20px;
    border-top: 1px solid #f1f5f9;
    background: #f8fafc;
}

.drawer-subtotal {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-size: 16px;
    font-weight: 700;
    color: var(--clr-text-main);
}

.drawer-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.drawer-actions .btn {
    padding: 12px;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    border-radius: 8px;
}

.btn-view-cart {
    background: #fff;
    border: 1px solid #e2e8f0;
    color: var(--clr-text-main);
}

.btn-checkout-drawer {
    background: var(--clr-primary);
    color: #fff;
    border: none;
}

/* Responsive */
@media (max-width: 480px) {
    .cart-drawer {
        width: 100%;
    }



    .product-name {
        font-size: 13px;
    }

    .discount-price {
        font-size: 16px;
    }
}

/* RTL Support */
[dir="rtl"] .cart-drawer {
    right: auto;
    left: -100%;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.1);
}

[dir="rtl"] .cart-drawer.open {
    left: 0;
}

[dir="rtl"] .product-card-details {
    padding: 12px 5px 12px 15px;
}

[dir="rtl"] .btn-remove-item {
    right: auto;
    left: 8px;
}