/* UK Coin Hunt — Custom cart drawer (2026 refresh)
 * Slide-in-from-right drawer + floating gold FAB.
 * Styled to match header-2026.css / homepage-2026.css tokens.
 */

:root {
    --ukch-gold:      #cfa362;
    --ukch-gold-dark: #b88d4f;
    --ukch-gold-line: rgba(207, 163, 98, 0.35);
    --ukch-ink:       #1c1c1e;
    --ukch-muted:     #6b6258;
    --ukch-bg:        #ffffff;
    --ukch-ivory:     #faf7f2;
    --ukch-line:      rgba(28, 28, 30, 0.10);
    --ukch-backdrop:  rgba(28, 28, 30, 0.45);
}

/* ---------- Backdrop ---------- */
.ukch-cart-backdrop {
    position: fixed;
    inset: 0;
    background: var(--ukch-backdrop);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease, visibility .25s ease;
    z-index: 1100;
    cursor: pointer;
}
body.ukch-cart-open .ukch-cart-backdrop {
    opacity: 1;
    visibility: visible;
}

/* ---------- Drawer shell ---------- */
.ukch-cart-drawer {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    height: 100dvh;
    width: min(420px, 100vw);
    background: var(--ukch-bg);
    color: var(--ukch-ink);
    border-left: 1px solid var(--ukch-line);
    box-shadow: 0 12px 40px rgba(28, 28, 30, 0.18);
    z-index: 1110;
    transform: translateX(100%);
    transition: transform .3s cubic-bezier(.4, 1.3, .4, 1);
    display: grid;
    grid-template-rows: auto 1fr;
    font-family: 'Poppins', Arial, sans-serif;
    overflow: hidden;
}
body.ukch-cart-open .ukch-cart-drawer {
    transform: translateX(0);
}

/* ---------- Drawer header ---------- */
.ukch-cart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--ukch-line);
    background: var(--ukch-bg);
}
.ukch-cart-header h2 {
    margin: 0;
    font-family: 'Lora', Georgia, 'Times New Roman', serif;
    font-size: 20px;
    font-weight: 500;
    letter-spacing: -0.01em;
    color: var(--ukch-ink);
}
.ukch-cart-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--ukch-ink);
    font-size: 18px;
    cursor: pointer;
    transition: background .2s ease, color .2s ease;
}
.ukch-cart-close:hover,
.ukch-cart-close:focus-visible {
    background: var(--ukch-ivory);
    color: var(--ukch-ink);
    outline: none;
}
/* Prevent sticky :hover on touch devices from making the X look invisible */
@media (hover: none) {
    .ukch-cart-close:hover {
        background: transparent;
        color: var(--ukch-ink);
    }
}

/* ---------- Drawer body / mini-cart ---------- */
/* The drawer body fills the remaining height (grid row 1fr from .ukch-cart-drawer).
 * Inside, we lay out the widget_shopping_cart_content as a flex column so the
 * items list scrolls independently and the subtotal+buttons pin to the bottom. */
.ukch-cart-body {
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--ukch-bg);
    padding: 0;
    overflow: hidden;
}
.ukch-cart-body .widget_shopping_cart_content {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

/* Item list — scrollable. min-height:0 is the classic flex fix that lets the
 * UL shrink below its natural content height so overflow-y:auto actually scrolls.
 * max-height:none overrides the legacy `.woocommerce-mini-cart { max-height:300px }`
 * rule in style.css which would otherwise cap the drawer's item area at 300px. */
.ukch-cart-body ul.woocommerce-mini-cart {
    list-style: none;
    margin: 0;
    padding: 4px 20px 12px;
    flex: 1 1 0;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.ukch-cart-body .woocommerce-mini-cart-item {
    position: relative;
    padding: 14px 28px 14px 0; /* right padding leaves room for the × button */
    border-bottom: 1px solid var(--ukch-line);
}
.ukch-cart-body .woocommerce-mini-cart-item:last-child {
    border-bottom: 0;
}

/* Header row: thumb + title as a single flex row. Anchor wraps them both. */
.ukch-cart-body .mini-cart-item-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-width: 0;
}
.ukch-cart-body .mini-cart-item-header > a {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    flex: 1 1 auto;
    min-width: 0;
    color: inherit;
    text-decoration: none;
}
.ukch-cart-body .mini-cart-item-header img {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid var(--ukch-line);
    background: var(--ukch-ivory);
    flex-shrink: 0;
}
.ukch-cart-body .mini-cart-item-header .product-name {
    flex: 1 1 auto;
    min-width: 0;
    margin-top: 2px;
    font-family: 'Lora', Georgia, serif;
    font-size: 15px !important;
    font-weight: 500 !important;
    line-height: 1.3;
    /* !important needed to beat legacy `.product-name { color:#000 !important }`
       at @media (max-width:1200px) in style.css that turns the name black on tablet/mobile. */
    color: var(--ukch-ink) !important;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

/* Remove × — absolute top-right of the item (not of the header) so it sits
 * outside the flex flow and doesn't get pushed around by image/text widths. */
.ukch-cart-body .woocommerce-mini-cart-item .remove {
    position: absolute;
    top: 14px;
    right: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: transparent;
    color: var(--ukch-muted);
    font-size: 20px;
    line-height: 1;
    text-decoration: none;
    transition: background .15s ease, color .15s ease;
}
.ukch-cart-body .woocommerce-mini-cart-item .remove:hover,
.ukch-cart-body .woocommerce-mini-cart-item .remove:focus-visible {
    background: var(--ukch-ivory);
    color: var(--ukch-gold-dark);
    outline: none;
}

/* Meta row: qty × price, aligned with text column (past the 56px thumb + 12px gap = 68px) */
.ukch-cart-body .mini-cart-item-quantity-price {
    margin: 6px 0 0 68px;
    font-size: 13px;
    color: var(--ukch-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}
.ukch-cart-body .mini-cart-item-quantity-price .quantity {
    font-weight: 500;
}
.ukch-cart-body .mini-cart-item-quantity-price .amount,
.ukch-cart-body .mini-cart-item-quantity-price .woocommerce-Price-amount {
    color: var(--ukch-gold-dark);
    font-weight: 600;
}

/* Empty state */
.ukch-cart-body .woocommerce-mini-cart__empty-message {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 40px 24px;
    text-align: center;
    color: var(--ukch-muted);
    font-size: 15px;
    font-family: 'Lora', Georgia, serif;
}

/* ---------- Pinned footer: subtotal + CTAs ---------- */
/* Both rows sit at the bottom of the flex column. Items scroll above. */
.ukch-cart-body .woocommerce-mini-cart__total {
    flex-shrink: 0;
    margin: 0;
    padding: 16px 20px 10px;
    background: var(--ukch-ivory);
    border-top: 1px solid var(--ukch-line);
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--ukch-muted);
}
.ukch-cart-body .woocommerce-mini-cart__total strong {
    font-weight: 600;
}
.ukch-cart-body .woocommerce-mini-cart__total .amount,
.ukch-cart-body .woocommerce-mini-cart__total .woocommerce-Price-amount {
    font-family: 'Lora', Georgia, serif;
    font-size: 22px;
    font-weight: 500;
    letter-spacing: -0.01em;
    color: var(--ukch-gold-dark);
    text-transform: none;
}
.ukch-cart-body .woocommerce-mini-cart__buttons {
    flex-shrink: 0;
    margin: 0;
    padding: 4px 20px 18px;
    background: var(--ukch-ivory);
    display: block;
}
.ukch-cart-body .woocommerce-mini-cart__buttons .product-actions {
    position: static; /* overrides a theme-wide .product-actions { position:absolute } in another stylesheet */
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
}

/* UKCH button variants (used in mini-cart.php) */
.ukch-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 18px;
    border-radius: 999px;
    font-family: 'Poppins', Arial, sans-serif;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-decoration: none;
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease, filter .15s ease, background .2s ease, color .2s ease, border-color .2s ease;
    line-height: 1;
}
.ukch-btn i { font-size: 14px; }
.ukch-btn--ghost {
    background: transparent;
    border-color: var(--ukch-line);
    color: var(--ukch-ink);
}
.ukch-btn--ghost:hover,
.ukch-btn--ghost:focus-visible {
    border-color: var(--ukch-gold-line);
    background: var(--ukch-bg);
    color: var(--ukch-gold-dark);
    outline: none;
}
.ukch-btn--primary {
    background: linear-gradient(180deg, var(--ukch-gold) 0%, var(--ukch-gold-dark) 100%);
    border-color: var(--ukch-gold-dark);
    color: #ffffff;
    box-shadow: 0 6px 18px rgba(207, 163, 98, 0.28);
}
.ukch-btn--primary:hover,
.ukch-btn--primary:focus-visible {
    transform: translateY(-1px);
    filter: brightness(1.03);
    box-shadow: 0 10px 24px rgba(207, 163, 98, 0.34);
    color: #ffffff;
    outline: none;
}

/* ---------- Floating gold cart button (FAB) ---------- */
.ukch-cart-fab {
    position: fixed;
    right: 28px;
    bottom: 100px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 0;
    background: linear-gradient(180deg, var(--ukch-gold) 0%, var(--ukch-gold-dark) 100%);
    color: #ffffff;
    box-shadow: 0 10px 24px rgba(207, 163, 98, 0.34), 0 1px 2px rgba(28, 28, 30, 0.08);
    display: grid;
    place-items: center;
    font-size: 22px;
    cursor: pointer;
    z-index: 9999998;
    transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
}
.ukch-cart-fab:hover,
.ukch-cart-fab:focus-visible {
    transform: translateY(-2px);
    filter: brightness(1.04);
    box-shadow: 0 14px 30px rgba(207, 163, 98, 0.40), 0 2px 4px rgba(28, 28, 30, 0.10);
    outline: none;
}
.ukch-cart-fab .bi-bag { line-height: 1; }

/* Count badge — reuses .hdp-count look */
.ukch-cart-fab .hdp-count {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    background: var(--ukch-gold-dark);
    color: #ffffff;
    font-family: 'Poppins', Arial, sans-serif;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 2px #ffffff;
    transition: transform .2s ease;
    pointer-events: none;
}
.ukch-cart-fab .hdp-count[data-count="0"],
.ukch-cart-fab .hdp-count:empty { display: none; }

/* Hide FAB on cart + checkout pages */
body.woocommerce-cart .ukch-cart-fab,
body.woocommerce-checkout .ukch-cart-fab {
    display: none;
}

/* When the drawer is open, tuck the FAB behind the drawer (below z-index 1110)
 * so the drawer visually covers it instead of the FAB sitting on top. */
body.ukch-cart-open .ukch-cart-fab {
    z-index: 1105;
}

/* ---------- Body scroll lock ---------- */
body.ukch-cart-open {
    overflow: hidden;
}

/* ---------- Responsive ---------- */
@media (max-width: 480px) {
    .ukch-cart-drawer {
        width: 100vw;
        border-left: 0;
    }
    .ukch-cart-header { padding: 16px 18px; }
    .ukch-cart-body ul.woocommerce-mini-cart { padding: 4px 18px; }
    .ukch-cart-body .woocommerce-mini-cart__total,
    .ukch-cart-body .woocommerce-mini-cart__buttons { padding-left: 18px; padding-right: 18px; }
    .ukch-cart-fab {
        right: 16px;
        bottom: 84px;
        width: 52px;
        height: 52px;
        font-size: 20px;
    }
}

/* ---------- Dark mode ---------- */
body.dark-mode .ukch-cart-drawer,
body.dark-mode .ukch-cart-header,
body.dark-mode .ukch-cart-body {
    background: #222;
    color: #f2eadd;
    border-color: rgba(242, 234, 221, 0.10);
}
body.dark-mode .ukch-cart-drawer { border-left-color: rgba(242, 234, 221, 0.10); }
body.dark-mode .ukch-cart-header h2 { color: #f2eadd; }
body.dark-mode .ukch-cart-close { color: #f2eadd; }
body.dark-mode .ukch-cart-close:hover { background: #1f1f1f; color: var(--ukch-gold); }
body.dark-mode .ukch-cart-body .woocommerce-mini-cart-item { border-bottom-color: rgba(242, 234, 221, 0.10); }
body.dark-mode .ukch-cart-body .mini-cart-item-header .product-name { color: #f2eadd !important; }

/* Beat legacy `.mini-cart-item-quantity-price span { color:#000 }` from style.css
   that turns the £ currency symbol black inside the cart drawer at <=1200px. */
.ukch-cart-body .mini-cart-item-quantity-price .woocommerce-Price-currencySymbol,
.ukch-cart-body .mini-cart-item-quantity-price .woocommerce-Price-amount,
.ukch-cart-body .mini-cart-item-quantity-price .woocommerce-Price-amount * {
    color: inherit !important;
}
body.dark-mode .ukch-cart-body .mini-cart-item-header img { background: #1f1f1f; border-color: rgba(242, 234, 221, 0.10); }
body.dark-mode .ukch-cart-body .mini-cart-item-header .remove { background: #1f1f1f; color: #b8aea0; }
body.dark-mode .ukch-cart-body .mini-cart-item-header .remove:hover { background: var(--ukch-gold); color: #fff; }
body.dark-mode .ukch-cart-body .mini-cart-item-quantity-price .quantity { color: #f2eadd; }
body.dark-mode .ukch-cart-body .woocommerce-mini-cart__total,
body.dark-mode .ukch-cart-body .woocommerce-mini-cart__buttons {
    background: #1f1f1f;
    border-color: rgba(242, 234, 221, 0.10);
}
body.dark-mode .ukch-btn--ghost {
    border-color: rgba(242, 234, 221, 0.18);
    color: #f2eadd;
}
body.dark-mode .ukch-btn--ghost:hover { background: #2a2a2a; color: var(--ukch-gold); }
