/* Cart Drawer V5 Premium Styles */
#cart-drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 110000;
    visibility: hidden;
    opacity: 0;
    transition: 0.3s;
    backdrop-filter: blur(3px);
}

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

.drawer {
    position: fixed;
    top: 0;
    width: 420px;
    max-width: 100%;
    height: 100%;
    background: #fff;
    z-index: 110001;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
}

.drawer-right {
    right: 0;
    transform: translateX(100%);
}

.drawer-right.active {
    transform: translateX(0);
}

.drawer-inner-v5 {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    position: relative;
    overflow: hidden;
}

.drawer-step-v5 {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
    background: #fff;
    transition: transform 0.4s ease-in-out;
    z-index: 5;
}

#checkout-drawer-step {
    transform: translateX(100%);
}

[dir="rtl"] #checkout-drawer-step {
    transform: translateX(-100%);
}

#cart-drawer.show-checkout #cart-main-container {
    transform: translateX(-100%);
}

[dir="rtl"] #cart-drawer.show-checkout #cart-main-container {
    transform: translateX(100%);
}

#cart-drawer.show-checkout #checkout-drawer-step {
    transform: translateX(0);
}

/* Header */
.drawer-header-v5 {
    flex: 0 0 70px;
    padding: 0 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #f5f5f5;
    background: #fff;
    position: relative;
    z-index: 10;
}

.drawer-title-v5 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 800;
    color: #333;
    font-family: 'Cairo', sans-serif !important;
}

.drawer-close-btn-v5,
.back-link-v5 {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: #f8f8f8;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #444;
    transition: 0.2s;
}

.drawer-close-btn-v5:hover {
    background: #eee;
}

/* Body Area (Scrollable) */
.drawer-body-v5 {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 20px 25px;
    background: #fff;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
}

/* Empty Cart View */
.empty-cart-v5 {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 20px;
}

.empty-icon-wrap {
    width: 120px;
    height: 120px;
    background: #f9f9f9;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 25px;
    color: #ddd;
}

.empty-cart-v5 p {
    font-size: 1.25rem;
    font-weight: 800;
    color: #444;
    margin: 0 0 25px 0;
    font-family: 'Cairo', sans-serif !important;
}

.shop-btn-v5 {
    padding: 15px 45px;
    background: var(--primary);
    color: #fff;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 800;
    font-size: 1.1rem;
    font-family: 'Cairo', sans-serif !important;
    transition: 0.3s;
    box-shadow: 0 10px 20px rgba(19, 133, 133, 0.15);
}

.shop-btn-v5:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 25px rgba(19, 133, 133, 0.2);
    color: #fff;
}

/* Items List */
.cart-items-v5 {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.item-card-v5 {
    display: flex;
    gap: 15px;
    padding: 15px;
    border: 1px solid #f0f0f0;
    border-radius: 12px;
    background: #fff;
    position: relative;
}

.item-thumb {
    width: 75px;
    height: 75px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #eee;
    flex-shrink: 0;
}

.item-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.item-details {
    flex: 1;
    min-width: 0;
}

.item-name {
    margin: 0 0 5px 0;
    font-size: 0.95rem;
    font-weight: 800;
    color: #333;
    line-height: 1.4;
    font-family: 'Cairo', sans-serif !important;
}

.item-price {
    font-weight: 900;
    color: var(--primary);
    font-size: 1.1rem;
}

.item-qty {
    font-size: 0.85rem;
    color: #999;
    font-weight: 700;
    margin-top: 3px;
    font-family: 'Cairo', sans-serif !important;
}

.item-remove-v5 {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid #ff5b5b;
    color: #ff5b5b;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(255, 0, 0, 0.15);
    z-index: 5;
    transition: all 0.2s ease;
}

.item-remove-v5:hover {
    background: #ff5b5b;
    color: #fff;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(255, 0, 0, 0.25);
}

.item-remove-v5:active {
    transform: scale(0.95);
}

.item-remove-v5.removing {
    pointer-events: none;
    opacity: 0.5;
}

/* Item Card Removal Animation */
.item-card-v5 {
    transition: all 0.25s ease-out;
}

.item-card-v5.removing-fade {
    opacity: 0.4 !important;
    transform: scale(0.95) !important;
    pointer-events: none !important;
}

/* Footer (Fixed at bottom) */
.drawer-footer-v5 {
    flex: 0 0 auto;
    padding: 20px 25px;
    background: #fff;
    border-top: 1px solid #f5f5f5;
    box-shadow: 0 -10px 20px rgba(0, 0, 0, 0.02);
}

.total-row-v5 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.total-row-v5 .label {
    font-size: 1.1rem;
    font-weight: 800;
    color: #666;
    font-family: 'Cairo', sans-serif !important;
}

.total-row-v5 .value {
    font-size: 1.4rem;
    font-weight: 900;
    color: #333;
    font-family: 'Cairo', sans-serif !important;
}

.order-btn-v5 {
    width: 100%;
    padding: 11px;
    border-radius: 10px;
    background: var(--primary);
    color: #fff;
    font-size: 1.1rem;
    font-weight: 800;
    border: none;
    cursor: pointer;
    transition: 0.3s;
    box-shadow: 0 6px 15px rgba(19, 133, 133, 0.15);
    font-family: 'Cairo', sans-serif !important;
}

.order-btn-v5:active {
    transform: scale(0.98);
}

/* Form Elements - Handled Globally in main.css */


.inputs-stack-v5 {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}

.final-summary-v5 {
    background: #fcfcff;
    padding: 15px;
    border-radius: 10px;
    border: 1px solid #f0f0ff;
    margin-bottom: 15px;
}

.summary-line {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-weight: 700;
    color: #777;
    font-family: 'Cairo', sans-serif !important;
    font-size: 0.9rem;
}

.summary-line.grand-total {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 2px solid #fff;
    font-size: 1.15rem;
    color: #333;
    font-weight: 900;
    font-family: 'Cairo', sans-serif !important;
}

.submit-order-v5 {
    width: 100%;
    padding: 13px;
    border-radius: 10px;
    background: var(--primary);
    color: #fff;
    font-size: 1.15rem;
    font-weight: 800;
    border: none;
    cursor: pointer;
    position: relative;
    box-shadow: 0 6px 15px rgba(19, 133, 133, 0.15);
    font-family: 'Cairo', sans-serif !important;
}

.form-error-v5 {
    background: #fff1f1;
    border: 1px solid #ffcccc;
    color: #cc0000;
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 15px;
    text-align: center;
    font-weight: 700;
    font-size: 0.9rem;
    font-family: 'Cairo', sans-serif !important;
}

@media (max-width: 480px) {
    .drawer {
        width: 100%;
    }

    .drawer-header-v5 {
        height: 60px;
        padding: 0 15px;
    }

    .drawer-body-v5 {
        padding: 15px;
    }

    .drawer-footer-v5 {
        padding: 15px;
    }
}

/* Spinner */
.submit-order-v5.loading .btn-text {
    visibility: hidden;
}

.submit-order-v5.loading::after {
    content: '';
    position: absolute;
    width: 24px;
    height: 24px;
    top: 50%;
    left: 50%;
    margin: -12px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: btn-spin 0.6s linear infinite;
}

@keyframes btn-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Skeleton Loader */
.skeleton-v5 {
    background: #f0f0f0;
    background: linear-gradient(90deg, #f0f0f0 25%, #f8f8f8 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 8px;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.skeleton-card {
    height: 100px;
    margin-bottom: 15px;
    border-radius: 12px;
}

/* ====== Body Scroll Lock when Drawer is Open ====== */
body.drawer-open {
    overflow: hidden !important;
    height: 100vh;
}

/* iOS Safari Fix for scroll lock */
@supports (-webkit-touch-callout: none) {
    body.drawer-open {
        position: fixed;
        width: 100%;
        height: 100%;
    }
}