/*
Theme component: Cart Drawer
Shared by single-product pages and homepage product cards.
*/

/* =========================================================
   AJAX CART DRAWER
   Opens from the left after a successful product add.
   ========================================================= */

body.shoes-cart-drawer-open {
    overflow: hidden;
}

.shoes-cart-drawer-overlay {
    position: fixed;
    inset: 0;
    z-index: 99998;
    background: rgba(0, 0, 0, .42);
    opacity: 0;
    visibility: hidden;
    transition: opacity .18s ease, visibility .18s ease;
}

.shoes-cart-drawer-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

.shoes-cart-drawer {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 99999;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    width: min(430px, 92vw);
    max-width: 100%;
    height: 100dvh;
    min-height: 0;
    padding: 0;
    overflow: hidden;
    background: #fff;
    box-shadow: 8px 0 30px rgba(0, 0, 0, .14);
    transform: translateX(-105%);
    visibility: hidden;
    transition: transform .22s ease, visibility .22s ease;
    direction: rtl;
}

.shoes-cart-drawer.is-open {
    transform: translateX(0);
    visibility: visible;
}

.shoes-cart-drawer__header {
    grid-row: 1;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-height: 68px;
    padding: 0 20px;
    border-bottom: 1px solid #eee;
    flex: 0 0 auto;
}

.shoes-cart-drawer__header h2 {
    margin: 0;
    color: #111;
    font-size: 18px;
    font-weight: 800;
}

.shoes-cart-drawer__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #f5f5f5;
    color: #222;
    cursor: pointer;
}

.shoes-cart-drawer__close .icon {
    width: 18px;
    height: 18px;
}

.shoes-cart-drawer__close .icon svg {
    display: block;
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
}

.shoes-cart-drawer__content {
    grid-row: 2;
    min-height: 0;
    height: auto;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 18px 20px 8px;
}

.shoes-cart-drawer__items {
    display: grid;
    gap: 14px;
}

.shoes-cart-drawer__item {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    padding-bottom: 14px;
    border-bottom: 1px solid #eee;
}

.shoes-cart-drawer__item-image-link {
    display: block;
    width: 76px;
    height: 76px;
    overflow: hidden;
    border: 1px solid #eee;
    background: #fff;
}

.shoes-cart-drawer__item-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.shoes-cart-drawer__item-info {
    min-width: 0;
}

.shoes-cart-drawer__variation {
    margin: -2px 0 7px;
    color: #777;
    font-size: 11px;
    line-height: 1.7;
}

.shoes-cart-drawer__item-title {
    display: -webkit-box;
    overflow: hidden;
    margin: 0 0 8px;
    color: #222;
    font-size: 13px;
    line-height: 1.8;
    font-weight: 700;
    text-decoration: none;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.shoes-cart-drawer__item-meta {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    color: #777;
    font-size: 11px;
    line-height: 1.7;
}

.shoes-cart-drawer__item-meta .amount {
    color: #222;
    font-weight: 700;
}

.shoes-cart-drawer__subtotal {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    margin-top: 18px;
    padding: 16px 0 4px;
    color: #444;
    font-size: 13px;
}

.shoes-cart-drawer__subtotal strong {
    color: #111;
    font-size: 15px;
    font-weight: 800;
}

.shoes-cart-drawer__empty,
.shoes-cart-drawer__error {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 180px;
    color: #777;
    font-size: 13px;
    text-align: center;
    line-height: 2;
}

.shoes-cart-drawer__error {
    color: #c8102e;
}

.shoes-cart-drawer__actions {
    grid-row: 3;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    padding: 16px 20px calc(16px + env(safe-area-inset-bottom));
    border-top: 1px solid #eee;
    background: #fff;
}

.shoes-cart-drawer__button {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0 12px;
    border-radius: 3px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    text-align: center;
    transition: opacity .15s ease, background-color .15s ease;
}

.shoes-cart-drawer__button:hover {
    opacity: .86;
}

.shoes-cart-drawer__button--cart {
    border: 1px solid #111;
    background: #fff;
    color: #111;
}


.single_add_to_cart_button.loading {
    opacity: .65;
    pointer-events: none;
}

@media (max-width: 560px) {
    .shoes-cart-drawer {
        height: 100dvh;
        max-height: 100dvh;
        width: 100%;
        box-shadow: none;
    }

    .shoes-cart-drawer__header {
        min-height: 62px;
        padding-inline: 16px;
    }

    .shoes-cart-drawer__content {
        padding: 14px 16px 8px;
    }

    .shoes-cart-drawer__actions {
        padding-inline: 16px;
    }

    .shoes-cart-drawer__item {
        grid-template-columns: 68px minmax(0, 1fr);
    }

    .shoes-cart-drawer__item-image-link {
        width: 68px;
        height: 68px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .shoes-cart-drawer,
    .shoes-cart-drawer-overlay {
        transition: none;
    }
}


/* =========================================================
   Cart drawer item stacking
   Keep cart products packed from top to bottom with fixed gaps.
   ========================================================= */
.shoes-cart-drawer__body,
.shoes-cart-drawer__content,
.shoes-cart-drawer__items,
.shoes-cart-drawer__list,
.widget_shopping_cart_content,
.woocommerce-mini-cart {
    align-content: start !important;
}

.shoes-cart-drawer__items,
.shoes-cart-drawer__list,
.woocommerce-mini-cart {
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    align-items: stretch !important;
    gap: 12px !important;
}

.shoes-cart-drawer__items > *,
.shoes-cart-drawer__list > *,
.woocommerce-mini-cart > li {
    flex: 0 0 auto !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

/* If the drawer body itself is flex/grid, keep the product list at the top
   and reserve the footer/summary area separately below. */
.shoes-cart-drawer__body {
    justify-content: flex-start !important;
}

.shoes-cart-drawer__body .shoes-cart-drawer__items,
.shoes-cart-drawer__body .shoes-cart-drawer__list,
.shoes-cart-drawer__body .woocommerce-mini-cart {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}


/* =========================================================
   FINAL cart drawer vertical layout
   Force the real drawer content area to stack from the top.
   ========================================================= */
#shoes-cart-drawer .shoes-cart-drawer__content {
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    align-items: stretch !important;
    align-content: flex-start !important;

    min-height: 0 !important;
    height: 100% !important;
    margin: 0 !important;
    padding-top: 18px !important;
}

#shoes-cart-drawer .shoes-cart-drawer__items {
    display: flex !important;
    flex: 0 0 auto !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    align-items: stretch !important;
    align-content: flex-start !important;

    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;

    margin: 0 !important;
    padding: 0 !important;
    gap: 12px !important;
}

#shoes-cart-drawer .shoes-cart-drawer__item {
    position: relative !important;
    flex: 0 0 auto !important;
    width: 100% !important;
    height: auto !important;

    margin: 0 !important;
    transform: none !important;
    align-self: stretch !important;
}

#shoes-cart-drawer .shoes-cart-drawer__subtotal {
    flex: 0 0 auto !important;
    margin-top: 16px !important;
    margin-bottom: 0 !important;
}

/* Prevent any generic theme/plugin utility from vertically centering
   direct children inside the drawer content. */
#shoes-cart-drawer .shoes-cart-drawer__content > * {
    align-self: stretch !important;
}

@media (max-width: 560px) {
    #shoes-cart-drawer .shoes-cart-drawer__content {
        padding-top: 14px !important;
    }
}




/* =========================================================
   Cart drawer: dynamic scrolling based on available height
   The list scrolls only when it actually overflows.
   ========================================================= */

/* The panel itself defines the available vertical space. */
#shoes-cart-drawer .shoes-cart-drawer__panel {
    display: flex !important;
    flex-direction: column !important;
    min-height: 0 !important;
    overflow: hidden !important;
}

/* Header stays fixed at the top. */
#shoes-cart-drawer .shoes-cart-drawer__header {
    flex: 0 0 auto !important;
}

/* Content consumes the remaining panel height. */
#shoes-cart-drawer .shoes-cart-drawer__content {
    display: flex !important;
    flex: 1 1 auto !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    align-items: stretch !important;

    min-height: 0 !important;
    height: auto !important;
    overflow: hidden !important;
}

/* Product list grows until the available space is full.
   Only then does its own vertical scrollbar appear. */
#shoes-cart-drawer .shoes-cart-drawer__items {
    display: flex !important;
    flex: 1 1 auto !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    align-items: stretch !important;

    min-height: 0 !important;
    max-height: none !important;
    height: auto !important;

    margin: 0 !important;
    padding: 0 5px 0 0 !important;
    gap: 12px !important;

    overflow-y: auto !important;
    overflow-x: hidden !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;

    scrollbar-width: thin;
    scrollbar-color: rgba(239, 85, 121, .48) rgba(239, 85, 121, .08);
}

#shoes-cart-drawer .shoes-cart-drawer__items::-webkit-scrollbar {
    width: 6px;
}

#shoes-cart-drawer .shoes-cart-drawer__items::-webkit-scrollbar-track {
    background: rgba(239, 85, 121, .08);
    border-radius: 999px;
}

#shoes-cart-drawer .shoes-cart-drawer__items::-webkit-scrollbar-thumb {
    background: rgba(239, 85, 121, .48);
    border-radius: 999px;
}

#shoes-cart-drawer .shoes-cart-drawer__items::-webkit-scrollbar-thumb:hover {
    background: rgba(239, 85, 121, .68);
}

/* Cart summary/actions always stay visible below the scrollable list. */
#shoes-cart-drawer .shoes-cart-drawer__subtotal,
#shoes-cart-drawer .shoes-cart-drawer__footer,
#shoes-cart-drawer .shoes-cart-drawer__actions {
    flex: 0 0 auto !important;
}

/* Individual products never stretch vertically. */
#shoes-cart-drawer .shoes-cart-drawer__item {
    flex: 0 0 auto !important;
}
