/* =========================================================
   RAFAH PREMIUM CART DRAWER
========================================================= */

:root {
    --rcd-primary: var(--rk-primary, #000000);
    --rcd-primary-dark: #000000;

    --rcd-secondary: var(--rk-secondary, #FEBEE8);
    --rcd-secondary-soft: #000000;

    --rcd-white: #ffffff;
    --rcd-background: #ffffff;
    --rcd-surface-soft: #f7f8fa;

    --rcd-text: #000000;
    --rcd-muted: #717784;
    --rcd-border: #e5e8ed;
    --rcd-danger: #c62828;
    --rcd-success: #18864b;

    --rcd-panel-width: 440px;

    --rcd-radius-small: 8px;
    --rcd-radius: 13px;
    --rcd-radius-large: 18px;
    --rcd-radius-round: 999px;

    --rcd-shadow:
        -24px 0 70px rgba(5, 16, 31, 0.18);

    --rcd-transition: 0.32s ease;
}

html.rcd-open,
body.rcd-open {
    overflow: hidden !important;
}

body.rcd-open {
    width: 100%;
    padding-right: 0 !important;
}

.rcd-drawer,
.rcd-drawer * {
    box-sizing: border-box;
}

.rcd-drawer {
    position: fixed;
    inset: 0;
    z-index: 999999;

    visibility: hidden;
    pointer-events: none;
}

.rcd-drawer.active {
    visibility: visible;
    pointer-events: auto;
}

/* Overlay */

.rcd-overlay {
    position: absolute;
    inset: 0;

    width: 100%;
    height: 100%;
    padding: 0;

    border: 0;

    background: rgba(3, 10, 20, 0.58);
    backdrop-filter: blur(3px);

    opacity: 0;
    cursor: pointer;

    transition: opacity var(--rcd-transition);
}

.rcd-drawer.active .rcd-overlay {
    opacity: 1;
}

/* Panel */

.rcd-panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;

    width: min(100%, var(--rcd-panel-width));

    background: var(--rcd-background);

    display: flex;
    flex-direction: column;

    box-shadow: var(--rcd-shadow);

    transform: translateX(100%);

    transition: transform var(--rcd-transition);
}

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

/* Header */

.rcd-header {
    min-height: 88px;
    padding: 16px 20px;

    background: var(--rcd-primary);
    color: var(--rcd-white);

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.rcd-header-title {
    min-width: 0;

    display: flex;
    align-items: center;
    gap: 13px;
}

.rcd-header-icon {
    position: relative;

    width: 48px;
    height: 48px;
    flex: 0 0 48px;

    border: 1px solid rgba(255, 255, 255, 0.17);
    border-radius: 50%;

    background: rgba(255, 255, 255, 0.07);

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 20px;
}

.rcd-header-count {
    position: absolute;
    top: -6px;
    right: -6px;

    min-width: 19px;
    height: 19px;
    padding: 0 5px;

    border: 2px solid var(--rcd-primary);
    border-radius: var(--rcd-radius-round);

    background: linear-gradient(135deg, #FECEB3 0%, #FEBEE8 50%, #D0C5FF 100%);
    color: var(--rcd-white);

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 9px;
    font-weight: 800;
}

.rcd-header-title small,
.rcd-header-title h2 {
    display: block;
}

.rcd-header-title small {
    margin-bottom: 3px;

    color: rgba(255, 255, 255, 0.67);

    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

.rcd-header-title h2 {
    margin: 0;

    color: var(--rcd-white);

    font-size: 19px;
    font-weight: 750;
    line-height: 1.2;
}

.rcd-close {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    padding: 0;

    border: 1px solid rgba(255, 255, 255, 0.17);
    border-radius: 50%;

    background: transparent;
    color: var(--rcd-white);

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 20px;
    cursor: pointer;

    transition:
        background 0.2s ease,
        transform 0.2s ease;
}

.rcd-close:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: rotate(5deg);
}

/* Delivery progress */

.rcd-delivery-progress {
    padding: 15px 20px;

    background: var(--rcd-surface-soft);
    border-bottom: 1px solid var(--rcd-border);
}

.rcd-delivery-progress p {
    margin: 0 0 9px;

    color: var(--rcd-muted);

    font-size: 12px;
    line-height: 1.5;
}

.rcd-delivery-progress strong {
    color: var(--rcd-primary);
}

.rcd-delivery-progress .rcd-delivery-achieved {
    color: var(--rcd-success);
    font-weight: 650;
}

.rcd-progress-track {
    width: 100%;
    height: 5px;

    overflow: hidden;

    border-radius: var(--rcd-radius-round);

    background: #e1e4e9;
}

.rcd-progress-value {
    display: block;

    width: 0;
    height: 100%;

    border-radius: inherit;

    background:
        linear-gradient(
            90deg,
            var(--rcd-primary),
            var(--rcd-secondary)
        );
}

/* Body */

.rcd-body {
    min-height: 0;
    flex: 1;

    overflow-y: auto;
    overscroll-behavior: contain;

    scrollbar-width: thin;
    scrollbar-color: rgba(8, 24, 44, 0.25) transparent;
}

.rcd-body::-webkit-scrollbar {
    width: 5px;
}

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

.rcd-body::-webkit-scrollbar-thumb {
    border-radius: 20px;
    background: rgba(8, 24, 44, 0.25);
}

/* Item */

.rcd-item {
    padding: 17px 20px;

    display: grid;
    grid-template-columns: 84px minmax(0, 1fr);
    gap: 14px;

    border-bottom: 1px solid var(--rcd-border);
}

.rcd-item-image {
    width: 84px;
    height: 96px;

    overflow: hidden;

    border: 1px solid var(--rcd-border);
    border-radius: var(--rcd-radius-small);

    background: var(--rcd-surface-soft);
}

.rcd-item-image img {
    display: block;

    width: 100%;
    height: 100%;

    object-fit: cover;
    object-position: center;
}

.rcd-item-image-placeholder {
    width: 100%;
    height: 100%;

    color: var(--rcd-muted);

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 22px;
}

.rcd-item-content {
    min-width: 0;
}

.rcd-item-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.rcd-item-name {
    min-width: 0;

    color: var(--rcd-text);

    font-size: 13px;
    font-weight: 700;
    line-height: 1.45;

    transition: color 0.2s ease;
}

.rcd-item-name:hover {
    color: var(--rcd-secondary);
}

.rcd-remove {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    padding: 0;

    border: 0;
    border-radius: 50%;

    background: transparent;
    color: var(--rcd-muted);

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 12px;
    cursor: pointer;

    transition:
        color 0.2s ease,
        background 0.2s ease;
}

.rcd-remove:hover {
    background: rgba(198, 40, 40, 0.08);
    color: var(--rcd-danger);
}

.rcd-item-options {
    margin-top: 8px;

    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.rcd-item-options span {
    padding: 4px 7px;

    border: 1px solid var(--rcd-border);
    border-radius: 5px;

    background: var(--rcd-surface-soft);
    color: var(--rcd-muted);

    font-size: 9px;
    line-height: 1.2;
}

.rcd-item-options strong {
    color: var(--rcd-text);
}

.rcd-item-bottom {
    margin-top: 13px;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.rcd-item-quantity {
    color: var(--rcd-muted);

    font-size: 11px;
    font-weight: 500;
}

.rcd-item-total {
    color: var(--rcd-primary);

    font-size: 14px;
    font-weight: 800;
}

/* Empty state */

.rcd-empty {
    min-height: 100%;

    padding: 60px 30px;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    text-align: center;
}

.rcd-empty-icon {
    width: 82px;
    height: 82px;

    margin-bottom: 22px;

    border: 1px solid rgba(183, 139, 79, 0.25);
    border-radius: 50%;

    background: linear-gradient(135deg, #FECEB3 0%, #FEBEE8 50%, #D0C5FF 100%);
    color: var(--rcd-secondary);

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 31px;
}

.rcd-empty h3 {
    margin: 0 0 10px;

    color: var(--rcd-primary);

    font-size: 21px;
    font-weight: 800;
}

.rcd-empty p {
    max-width: 290px;
    margin: 0;

    color: var(--rcd-muted);

    font-size: 13px;
    line-height: 1.65;
}

.rcd-empty-button {
    min-height: 46px;
    margin-top: 22px;
    padding: 0 23px;

    border-radius: var(--rcd-radius-small);

    background: var(--rcd-primary);
    color: var(--rcd-white);

    display: inline-flex;
    align-items: center;
    justify-content: center;

    font-size: 12px;
    font-weight: 750;
    text-transform: uppercase;

    transition: background 0.2s ease;
}

.rcd-empty-button:hover {
    background: linear-gradient(135deg, #FECEB3 0%, #FEBEE8 50%, #D0C5FF 100%);
    color: var(--rcd-white);
}

/* Footer */

.rcd-footer {
    padding: 19px 20px 20px;

    border-top: 1px solid var(--rcd-border);

    background: var(--rcd-white);

    box-shadow:
        0 -10px 28px rgba(8, 24, 44, 0.06);
}

.rcd-summary {
    margin-bottom: 16px;

    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.rcd-summary span,
.rcd-summary small {
    display: block;
}

.rcd-summary span {
    margin-bottom: 3px;

    color: var(--rcd-text);

    font-size: 14px;
    font-weight: 750;
}

.rcd-summary small {
    color: var(--rcd-muted);

    font-size: 10px;
}

.rcd-summary > strong {
    color: var(--rcd-primary);

    font-size: 20px;
    font-weight: 850;
}

.rcd-footer-actions {
    display: grid;
    grid-template-columns: 0.8fr 1.2fr;
    gap: 10px;
}

.rcd-view-cart,
.rcd-checkout {
    min-height: 49px;
    padding: 0 15px;

    border-radius: var(--rcd-radius-small);

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;

    font-size: 12px;
    font-weight: 750;
    text-transform: uppercase;
}

.rcd-view-cart {
    border: 1px solid var(--rcd-primary);

    background: var(--rcd-white);
    color: var(--rcd-primary);
}

.rcd-view-cart:hover {
    background: var(--rcd-primary);
    color: var(--rcd-white);
}

.rcd-checkout {
    border: 1px solid var(--rcd-primary);

    background: var(--rcd-primary);
    color: var(--rcd-white);
}

.rcd-checkout:hover {
    border-color: var(--rcd-secondary);

    background: linear-gradient(135deg, #FECEB3 0%, #FEBEE8 50%, #D0C5FF 100%);
    color: var(--rcd-white);
}

.rcd-security {
    margin-top: 13px;

    color: var(--rcd-muted);

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;

    font-size: 10px;
}

.rcd-security i {
    color: var(--rcd-success);
}

/* Responsive */

@media (max-width: 575px) {
    :root {
        --rcd-panel-width: 92vw;
    }

    .rcd-header {
        min-height: 80px;
        padding: 13px 16px;
    }

    .rcd-header-icon {
        width: 44px;
        height: 44px;
        flex-basis: 44px;
    }

    .rcd-header-title h2 {
        font-size: 17px;
    }

    .rcd-close {
        width: 42px;
        height: 42px;
        flex-basis: 42px;
    }

    .rcd-delivery-progress {
        padding: 13px 16px;
    }

    .rcd-item {
        padding: 15px 16px;

        grid-template-columns: 76px minmax(0, 1fr);
        gap: 12px;
    }

    .rcd-item-image {
        width: 76px;
        height: 88px;
    }

    .rcd-footer {
        padding: 16px;
    }

    .rcd-footer-actions {
        grid-template-columns: 1fr 1.25fr;
    }
}

.rcd-cart-remove.is-removing {
    opacity: 0.55;
    pointer-events: none;
    cursor: wait;
}

.rcd-cart-remove.is-removing i {
    animation: rcdCartRemoveSpin 0.7s linear infinite;
}

@keyframes rcdCartRemoveSpin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}


.rcd-drawer:not(.active) {
    visibility: hidden;
    pointer-events: none;
}

.rcd-drawer:not(.active) .rcd-panel {
    transform: translateX(100%);
}

.rcd-drawer:not(.active) .rcd-overlay {
    opacity: 0;
}