/* UBICHEE cart drawer — shell, line items, totals, empty/loading states.
   Loaded on every page together with header.css. */

/* ===== Shell ===== */

#ubiCartOverlay.ubi-drawer-overlay{
    position: fixed;
    inset: 0;
    background: rgba(41, 20, 70, .45);
    z-index: var(--ubi-overlay-z, 9998);
    opacity: 0;
    visibility: hidden;
    transition: opacity .22s ease, visibility .22s ease;
}
#ubiCartOverlay.ubi-drawer-overlay.is-visible{
    opacity: 1;
    visibility: visible;
}

#ubiCartDrawer.ubi-drawer{
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(420px, 100vw);
    display: flex;
    flex-direction: column;
    background: var(--white);
    border-radius: 24px 0 0 24px;
    box-shadow: -18px 0 48px rgba(41, 20, 70, .22);
    z-index: var(--ubi-drawer-z, 9999);
    transform: translateX(calc(100% + 24px));
    visibility: hidden;
    transition: transform .34s cubic-bezier(.22, 1, .36, 1), visibility .34s;
}
#ubiCartDrawer.ubi-drawer.is-open{
    transform: translateX(0);
    visibility: visible;
}

html.ubi-drawer-open{
    overflow: hidden !important;
}
html.ubi-drawer-open body{
    padding-right: var(--ubi-scrollbar-w, 0px);
}

#ubiCartDrawer :focus-visible{
    outline: 2px solid var(--deep);
    outline-offset: 2px;
}

/* ===== Header ===== */

.ubi-drawer__head{
    flex: none;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 22px 20px 14px;
    border-bottom: 1px solid #efe6f7;
}
.ubi-drawer__title{
    margin: 0;
    font: 700 22px/1.15 'Fredoka', sans-serif;
    color: var(--deep);
}
.ubi-drawer__count{
    margin: 3px 0 0;
    font: 600 12px/1.4 'DM Sans', sans-serif;
    color: #7a6a8c;
}
.ubi-drawer__close{
    flex: none;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--cream);
    color: var(--deep);
    transition: background .2s ease, transform .2s ease;
}
.ubi-drawer__close:hover{
    background: #f0e4ce;
    transform: rotate(6deg);
}

/* ===== Body ===== */

.ubi-drawer__body{
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 14px 16px 18px;
    scrollbar-width: thin;
    scrollbar-color: #d9cbe8 transparent;
}
.ubi-drawer__body::-webkit-scrollbar{
    width: 8px;
}
.ubi-drawer__body::-webkit-scrollbar-thumb{
    background: #d9cbe8;
    border-radius: 999px;
}

.ubi-drawer__list{
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ===== Line item ===== */

.ubi-drawer__item{
    position: relative;
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 12px;
    padding: 12px;
    border: 1px solid rgba(53, 22, 95, .07);
    border-radius: 18px;
    background: #fdfaf5;
    transition: opacity .2s ease;
}
.ubi-drawer__item.is-busy{
    opacity: .55;
}

.ubi-drawer__thumb{
    display: block;
    width: 64px;
    height: 64px;
    border-radius: 14px;
    overflow: hidden;
    background: var(--cream);
}
.ubi-drawer__thumb img{
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ubi-drawer__item-main{
    min-width: 0;
    padding-right: 26px;
}
.ubi-drawer__item-name{
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font: 600 13.5px/1.35 'DM Sans', sans-serif;
    color: var(--ink);
}
.ubi-drawer__item-name:hover{
    color: var(--purple);
}
.ubi-drawer__variant{
    display: inline-block;
    margin: 6px 0 0;
    padding: 2px 8px;
    border-radius: 999px;
    background: #f1e9fb;
    color: #5b3d8c;
    font: 600 11px/1.5 'DM Sans', sans-serif;
}

.ubi-drawer__item-row{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 9px;
}

.ubi-drawer__stepper{
    display: inline-flex;
    align-items: center;
    border: 1.5px solid rgba(103, 55, 165, .22);
    border-radius: 10px;
    background: var(--white);
}
.ubi-drawer__step{
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    background: transparent;
    color: var(--deep);
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
    border-radius: 8px;
    transition: background .15s ease;
}
.ubi-drawer__step:hover:not(:disabled){
    background: #f5effc;
}
.ubi-drawer__step:disabled{
    color: #c9bfd8;
    cursor: not-allowed;
}
.ubi-drawer__qty{
    min-width: 26px;
    text-align: center;
    font: 700 13px/1 'DM Sans', sans-serif;
    color: var(--deep);
}

.ubi-drawer__item-total{
    font: 700 13.5px/1.2 'DM Sans', sans-serif;
    color: var(--deep);
    white-space: nowrap;
}
.ubi-drawer__item-total .woocommerce-Price-currencySymbol{
    font-size: .92em;
}

.ubi-drawer__remove{
    position: absolute;
    top: 8px;
    right: 8px;
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: transparent;
    color: #a091b3;
    transition: background .15s ease, color .15s ease;
}
.ubi-drawer__remove:hover{
    background: #fbe9ef;
    color: #b3264a;
}
.ubi-drawer__remove:disabled{
    opacity: .5;
}

/* ===== Footer ===== */

.ubi-drawer__foot{
    flex: none;
    padding: 14px 20px calc(16px + env(safe-area-inset-bottom));
    background: var(--white);
    border-top: 1px solid #efe6f7;
    box-shadow: 0 -10px 24px rgba(41, 20, 70, .05);
}
.ubi-drawer__foot[hidden]{
    display: none;
}
.ubi-drawer__status{
    margin: 0 0 8px;
    font: 600 12px/1.4 'DM Sans', sans-serif;
    color: #a1243f;
}
.ubi-drawer__status:empty{
    display: none;
}
.ubi-drawer__total{
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    font: 600 13px/1.4 'DM Sans', sans-serif;
    color: #6f5f83;
}
.ubi-drawer__total strong{
    font: 700 20px/1.2 'Fredoka', sans-serif;
    color: var(--deep);
}
.ubi-drawer__hint{
    margin: 4px 0 12px;
    font-size: 11.5px;
    color: #8d7f9e;
}

.ubi-drawer__cta{
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 48px;
    padding: 13px 18px;
    border-radius: 999px;
    background: var(--purple);
    color: #fff;
    font: 700 14px/1.2 'DM Sans', sans-serif;
    box-shadow: 0 6px 18px rgba(103, 55, 165, .28);
    transition: background .18s ease, color .18s ease, transform .18s ease, box-shadow .18s ease;
}
/* Custom CSS adds a:hover{color:...;text-decoration:underline}, which used to
   turn this link dark and underlined on hover. Keep the white CTA label. */
.ubi-drawer__cta:hover,
.ubi-drawer__cta:focus-visible{
    background: #4e3575;
    color: #fff !important;
    text-decoration: none !important;
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(78,53,117,.38);
}
.ubi-drawer__cta:focus-visible{
    outline: 2px solid var(--yellow);
    outline-offset: 3px;
}
.ubi-drawer__cta:active{
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(78,53,117,.3);
}
.ubi-drawer__secondary{
    display: block;
    margin-top: 10px;
    text-align: center;
    font: 600 12.5px/1.4 'DM Sans', sans-serif;
    color: var(--purple);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* ===== Empty / error ===== */

.ubi-drawer__empty{
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 48px 12px 24px;
}
.ubi-drawer__empty-art{
    width: 88px;
    height: 88px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--cream);
    color: var(--purple);
}
.ubi-drawer__empty-title{
    margin: 16px 0 4px;
    font: 700 16px/1.3 'Fredoka', sans-serif;
    color: var(--deep);
}
.ubi-drawer__empty-text{
    margin: 0 0 18px;
    max-width: 26ch;
    font-size: 13px;
    color: #7a6a8c;
}
.ubi-drawer__empty .ubi-drawer__cta{
    width: auto;
    min-width: 170px;
}

/* ===== Loading ===== */

.ubi-drawer__loading{
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.ubi-drawer__skeleton{
    display: block;
    height: 96px;
    border-radius: 18px;
    background: linear-gradient(100deg, #f6f0fa 20%, #fbf8fe 40%, #f6f0fa 60%);
    background-size: 220% 100%;
    animation: ubiDrawerShimmer 1.2s ease-in-out infinite;
}
@keyframes ubiDrawerShimmer{
    from{ background-position: 120% 0; }
    to{ background-position: -40% 0; }
}

/* ===== Mobile ===== */

@media (max-width: 520px){
    #ubiCartDrawer.ubi-drawer{
        width: 100vw;
        border-radius: 0;
        box-shadow: 0 12px 40px rgba(41, 20, 70, .28);
    }
    .ubi-drawer__head{
        padding: 18px 16px 12px;
    }
    .ubi-drawer__title{
        font-size: 20px;
    }
    .ubi-drawer__close{
        width: 42px;
        height: 42px;
    }
    .ubi-drawer__body{
        padding: 12px 12px 16px;
    }
    .ubi-drawer__item{
        grid-template-columns: 56px minmax(0, 1fr);
        gap: 10px;
        padding: 11px;
    }
    .ubi-drawer__thumb{
        width: 56px;
        height: 56px;
    }
    .ubi-drawer__step{
        width: 38px;
        height: 38px;
        font-size: 17px;
    }
    .ubi-drawer__qty{
        min-width: 30px;
        font-size: 14px;
    }
    .ubi-drawer__remove{
        width: 34px;
        height: 34px;
        top: 6px;
        right: 6px;
    }
    .ubi-drawer__foot{
        padding: 12px 16px calc(14px + env(safe-area-inset-bottom));
    }
    .ubi-drawer__cta{
        min-height: 50px;
        font-size: 14.5px;
    }
}

@media (prefers-reduced-motion: reduce){
    #ubiCartDrawer.ubi-drawer,
    #ubiCartOverlay.ubi-drawer-overlay{
        transition: none;
    }
    .ubi-drawer__skeleton{
        animation: none;
    }
}
