/* =============================================================================
   CART & CHECKOUT — livestock-homepage-clone
   ============================================================================= */

/* ── Global variables (cart lives at body level, not inside .lhc-homepage) ── */
:root {
    --lhc-cart-w:      420px;
    --lhc-cart-z:      9999;
    --lhc-c-black:     #121212;
    --lhc-c-dark:      #3d3d3d;
    --lhc-c-white:     #ffffff;
    --lhc-c-border:    #e3e3db;
    --lhc-c-bg:        #f4f4f0;
    --lhc-c-text:      #121212;
    --lhc-c-mid:       #6d6d6d;
    --lhc-c-blue:      #1a2e5a;
    --lhc-c-blue-hov:  #243d70;
    --lhc-c-red:       #c90000;
    --lhc-c-green:     #2a9d4e;
    --lhc-c-ease:      cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --lhc-c-trans:     0.2s var(--lhc-c-ease);
}

/* ── Body lock ───────────────────────────────────────────────────────────────── */
body.lhc-no-scroll { overflow: hidden; }

/* ── Overlay ─────────────────────────────────────────────────────────────────── */
.lhc-cart-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: calc(var(--lhc-cart-z) - 1);
    opacity: 0;
    transition: opacity var(--lhc-c-trans);
}
.lhc-cart-overlay--on {
    display: block;
    opacity: 1;
}

/* ── Drawer ──────────────────────────────────────────────────────────────────── */
.lhc-cart-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: var(--lhc-cart-w);
    max-width: 100vw;
    background: var(--lhc-c-white);
    z-index: var(--lhc-cart-z);
    transform: translateX(100%);
    transition: transform 0.32s var(--lhc-c-ease), width 0.32s var(--lhc-c-ease), left 0.32s var(--lhc-c-ease);
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 28px rgba(0, 0, 0, 0.16);
    font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}
.lhc-cart-drawer--open { transform: translateX(0); }

/* Fullscreen mode — used for checkout & confirm views */
.lhc-cart-drawer--fullscreen {
    width: 100vw;
    left: 0;
    box-shadow: none;
}
.lhc-cart-drawer--fullscreen .lhc-cart-drawer__hd { display: none; }
.lhc-cart-drawer--fullscreen .lhc-cart-drawer__body {
    background: #f7f7f5;
    display: block;
    overflow-y: auto;
}

.lhc-cart-drawer *, .lhc-cart-drawer *::before, .lhc-cart-drawer *::after { box-sizing: border-box; }

/* Drawer header */
.lhc-cart-drawer__hd {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--lhc-c-border);
    flex-shrink: 0;
}
.lhc-cart-drawer__title {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--lhc-c-black);
    margin: 0;
}
.lhc-cart-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 28px;
    line-height: 1;
    color: var(--lhc-c-mid);
    padding: 0 2px;
    font-family: inherit;
    transition: color var(--lhc-c-trans);
}
.lhc-cart-close:hover { color: var(--lhc-c-black); }

/* Drawer scrollable body */
.lhc-cart-drawer__body {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* ── FAB (floating cart button) ──────────────────────────────────────────────── */
.lhc-cart-fab {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #121212;
    color: #ffffff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: calc(var(--lhc-cart-z) - 2);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    transition: background var(--lhc-c-trans), transform var(--lhc-c-trans), box-shadow var(--lhc-c-trans);
    padding: 0;
    font-family: inherit;
}
.lhc-cart-fab:hover {
    background: #3d3d3d;
    transform: scale(1.06);
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.34);
}
.lhc-cart-fab:active { transform: scale(0.97); }

/* Cart count badge */
.lhc-cart-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 20px;
    height: 20px;
    padding: 0 4px;
    border-radius: 10px;
    background: var(--lhc-c-red);
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 0.2s ease, transform 0.2s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Helvetica, Arial, sans-serif;
}
.lhc-cart-badge--on {
    opacity: 1;
    transform: scale(1);
}

/* ── Empty cart ──────────────────────────────────────────────────────────────── */
.lhc-cart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 24px;
    gap: 14px;
    text-align: center;
    min-height: 320px;
    color: var(--lhc-c-mid);
}
.lhc-cart-empty svg { color: var(--lhc-c-border); }
.lhc-cart-empty p { font-size: 15px; margin: 0; }

/* ── Cart item row (.lhc-ci) ─────────────────────────────────────────────────── */
.lhc-cart-items { padding-bottom: 4px; }

.lhc-ci {
    display: grid;
    grid-template-columns: 68px 1fr auto;
    gap: 12px;
    align-items: start;
    padding: 14px 20px;
    border-bottom: 1px solid var(--lhc-c-border);
}

.lhc-ci__img {
    width: 68px;
    height: 68px;
    background: var(--lhc-c-bg);
    overflow: hidden;
    flex-shrink: 0;
}
.lhc-ci__img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.lhc-ci__img-ph { width: 100%; height: 100%; }

.lhc-ci__info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}
.lhc-ci__name {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--lhc-c-black);
    word-break: break-word;
}
.lhc-ci__sku {
    font-size: 11px;
    color: var(--lhc-c-mid);
    letter-spacing: 0.04em;
}
.lhc-ci__unit {
    font-size: 12px;
    color: var(--lhc-c-mid);
}

.lhc-ci__right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    flex-shrink: 0;
}
.lhc-ci__line {
    font-size: 14px;
    font-weight: 700;
    color: var(--lhc-c-black);
    white-space: nowrap;
}
.lhc-ci__del {
    background: none;
    border: none;
    cursor: pointer;
    padding: 3px;
    color: var(--lhc-c-mid);
    line-height: 0;
    transition: color var(--lhc-c-trans);
    font-family: inherit;
}
.lhc-ci__del:hover { color: var(--lhc-c-red); }

/* ── Quantity control ────────────────────────────────────────────────────────── */
.lhc-qty {
    display: flex;
    align-items: stretch;
    border: 1px solid var(--lhc-c-border);
    height: 30px;
    overflow: hidden;
}
.lhc-qty__btn {
    width: 28px;
    flex-shrink: 0;
    background: var(--lhc-c-bg);
    border: none;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    color: var(--lhc-c-black);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    transition: background var(--lhc-c-trans);
}
.lhc-qty__btn:hover { background: var(--lhc-c-border); }
.lhc-qty__in {
    width: 36px;
    border: none;
    border-left: 1px solid var(--lhc-c-border);
    border-right: 1px solid var(--lhc-c-border);
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--lhc-c-black);
    background: var(--lhc-c-white);
    font-family: inherit;
    padding: 0;
    -moz-appearance: textfield;
    appearance: textfield;
}
.lhc-qty__in::-webkit-outer-spin-button,
.lhc-qty__in::-webkit-inner-spin-button { -webkit-appearance: none; }

/* ── Cart summary ────────────────────────────────────────────────────────────── */
.lhc-cs {
    padding: 14px 20px 22px;
    border-top: 2px solid var(--lhc-c-border);
    background: var(--lhc-c-bg);
}
.lhc-cs__row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    font-size: 14px;
    color: var(--lhc-c-mid);
}
.lhc-cs__row--total {
    font-size: 16px;
    font-weight: 700;
    color: var(--lhc-c-black);
    padding-top: 10px;
    margin-top: 4px;
    border-top: 1px solid var(--lhc-c-border);
}

/* Checkout CTA */
.lhc-btn--checkout {
    display: block;
    width: 100%;
    margin-top: 14px;
    padding: 14px 20px;
    background: var(--lhc-c-blue);
    color: #ffffff;
    border: none;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background var(--lhc-c-trans);
    font-family: inherit;
    text-align: center;
    line-height: 1;
}
.lhc-btn--checkout:hover { background: var(--lhc-c-blue-hov); }

/* ── Checkout page layout ────────────────────────────────────────────────────── */
.lhc-checkout-page {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 28px;
    max-width: 1020px;
    margin: 0 auto;
    padding: 32px 24px 60px;
    width: 100%;
    align-items: start;
}
.lhc-checkout-left { display: flex; flex-direction: column; }
.lhc-checkout-right { position: sticky; top: 24px; }

/* Back to Cart */
.lhc-back-link {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 12px;
    color: var(--lhc-c-mid);
    padding: 0;
    margin-bottom: 10px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: inherit;
    transition: color var(--lhc-c-trans);
    text-decoration: none;
}
.lhc-back-link:hover { color: var(--lhc-c-black); }

/* Checkout title */
.lhc-checkout-title {
    font-size: 30px;
    font-weight: 800;
    color: var(--lhc-c-black);
    margin: 0 0 20px;
    letter-spacing: -0.01em;
}

/* Section cards */
.lhc-co-section {
    background: #fff;
    border: 1px solid var(--lhc-c-border);
    border-radius: 6px;
    margin-bottom: 14px;
    overflow: hidden;
}
.lhc-section-hdr {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--lhc-c-border);
}
.lhc-section-num {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #D97706;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 1;
}
.lhc-section-hdr__text { flex: 1; min-width: 0; }
.lhc-section-hdr__text h2 {
    font-size: 14px;
    font-weight: 700;
    color: var(--lhc-c-black);
    margin: 0 0 2px;
}
.lhc-section-hdr__text p {
    font-size: 12px;
    color: var(--lhc-c-blue);
    margin: 0;
}
.lhc-ssl-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    color: var(--lhc-c-green);
    background: rgba(42, 157, 78, 0.1);
    border: 1px solid rgba(42, 157, 78, 0.25);
    border-radius: 4px;
    padding: 5px 9px;
    white-space: nowrap;
    flex-shrink: 0;
}
.lhc-section-body { padding: 20px; }

/* 2-column form row */
.lhc-form-row-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}
.lhc-form-row-2col .lhc-form-group { margin-bottom: 0; }

/* Form groups */
.lhc-form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 12px;
}
.lhc-form-group label {
    font-size: 12px;
    font-weight: 600;
    color: #D97706;
}
.lhc-fg__opt {
    font-weight: 400;
    color: var(--lhc-c-mid);
}
.lhc-form-group input,
.lhc-form-group select,
.lhc-form-group textarea {
    padding: 10px 12px;
    border: 1px solid var(--lhc-c-border);
    border-radius: 4px;
    font-size: 14px;
    color: var(--lhc-c-black);
    background: var(--lhc-c-white);
    outline: none;
    transition: border-color var(--lhc-c-trans), box-shadow var(--lhc-c-trans);
    font-family: inherit;
    -webkit-appearance: none;
    appearance: none;
}
.lhc-form-group input:focus,
.lhc-form-group select:focus,
.lhc-form-group textarea:focus {
    border-color: #D97706;
    box-shadow: 0 0 0 2px rgba(217, 119, 6, 0.12);
}
.lhc-form-group textarea { resize: vertical; min-height: 72px; }

/* Checkbox rows */
.lhc-form-check-wrap { margin-bottom: 0; }
.lhc-check-label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13px;
    color: var(--lhc-c-text);
    cursor: pointer;
    line-height: 1.4;
    font-weight: 400;
}
.lhc-check-label input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: #D97706;
    flex-shrink: 0;
    margin-top: 1px;
    cursor: pointer;
}

/* Billing address sub-form */
.lhc-billing-form {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--lhc-c-border);
}
.lhc-billing-form__hdr {
    font-size: 13px;
    font-weight: 700;
    color: var(--lhc-c-black);
    margin-bottom: 14px;
}

/* Contact Seller button */
.lhc-btn--contact-seller {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 15px 20px;
    background: #D97706;
    color: #ffffff;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background var(--lhc-c-trans);
    font-family: inherit;
    line-height: 1;
}
.lhc-btn--contact-seller:hover:not(:disabled) { background: #B45309; }
.lhc-btn--contact-seller:disabled {
    background: var(--lhc-c-border);
    color: var(--lhc-c-mid);
    cursor: not-allowed;
}

/* Payment note */
.lhc-payment-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 12px;
    color: var(--lhc-c-mid);
    margin: 10px 0 0;
}
.lhc-payment-note__secure { color: var(--lhc-c-blue); }

/* Form error */
.lhc-co-error {
    min-height: 18px;
    font-size: 13px;
    font-weight: 500;
    color: var(--lhc-c-red);
    margin-bottom: 10px;
}

/* Order notes */
.lhc-co-notes-wrap { margin-top: 6px; }
.lhc-co-notes-heading {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--lhc-c-mid);
    margin: 0 0 8px;
}
.lhc-co-notes-area {
    display: block;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--lhc-c-border);
    border-radius: 4px;
    font-size: 14px;
    color: var(--lhc-c-black);
    background: var(--lhc-c-white);
    font-family: inherit;
    resize: vertical;
    min-height: 80px;
    outline: none;
    transition: border-color var(--lhc-c-trans);
}
.lhc-co-notes-area:focus { border-color: #D97706; }

/* ── Mobile order summary toggle — hidden on desktop ────────────────────────── */
.lhc-os-mobile-hd  { display: none; }
.lhc-os-mobile-wrap { display: none; }

/* ── Order Summary card (right column) ──────────────────────────────────────── */
.lhc-os-card {
    background: #fff;
    border: 1px solid var(--lhc-c-border);
    border-radius: 6px;
    padding: 20px;
}
.lhc-os-card__title {
    font-size: 14px;
    font-weight: 700;
    color: var(--lhc-c-black);
    margin: 0 0 16px;
}
.lhc-os__item {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}
.lhc-os__item-img {
    width: 54px;
    height: 54px;
    background: var(--lhc-c-bg);
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid var(--lhc-c-border);
}
.lhc-os__item-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lhc-os__img-ph { width: 100%; height: 100%; }
.lhc-os__item-info { flex: 1; min-width: 0; }
.lhc-os__item-name {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--lhc-c-black);
    line-height: 1.3;
    word-break: break-word;
}
.lhc-os__item-qty {
    display: block;
    font-size: 12px;
    color: var(--lhc-c-mid);
    margin-top: 3px;
}
.lhc-os__item-price {
    font-size: 14px;
    font-weight: 700;
    color: var(--lhc-c-black);
    white-space: nowrap;
    flex-shrink: 0;
}
.lhc-os-card__divider {
    border: none;
    border-top: 1px solid var(--lhc-c-border);
    margin: 12px 0;
}
.lhc-os-card__row {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: var(--lhc-c-mid);
    padding: 3px 0;
}
.lhc-os-card__row--total {
    font-size: 15px;
    font-weight: 700;
    color: var(--lhc-c-black);
}

/* ── Confirm view ────────────────────────────────────────────────────────────── */
.lhc-confirm {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 52px 28px;
    gap: 12px;
    min-height: 340px;
}
.lhc-confirm__icon { color: var(--lhc-c-green); }
.lhc-confirm h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--lhc-c-black);
    margin: 0;
}
.lhc-confirm__id {
    font-size: 13px;
    color: var(--lhc-c-mid);
    margin: 0;
}
.lhc-confirm p {
    font-size: 14px;
    color: var(--lhc-c-mid);
    max-width: 280px;
    margin: 0;
    line-height: 1.5;
}

/* ── Shared dark button (used in cart empty state & confirm) ─────────────────── */
.lhc-btn--dark {
    display: inline-block;
    padding: 12px 28px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: var(--lhc-c-black);
    color: var(--lhc-c-white);
    border: 2px solid var(--lhc-c-black);
    cursor: pointer;
    font-family: inherit;
    transition: background var(--lhc-c-trans), border-color var(--lhc-c-trans);
    text-decoration: none;
    line-height: 1;
}
.lhc-btn--dark:hover {
    background: var(--lhc-c-dark);
    border-color: var(--lhc-c-dark);
}

/* ── Cart page (inline) ──────────────────────────────────────────────────────── */
.lhc-cart-page-wrap {
    max-width: 860px;
    margin: 0 auto;
    padding: 32px 20px 60px;
    font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}
.lhc-cart-page-content * { box-sizing: border-box; }
.lhc-cart-page-content .lhc-cs { border-radius: 6px; }
.lhc-cart-page-content .lhc-cart-items { border: 1px solid var(--lhc-c-border); border-radius: 6px; overflow: hidden; }
.lhc-cart-page-content .lhc-checkout-page { padding: 0; max-width: none; }

/* ── Add-to-cart button feedback ─────────────────────────────────────────────── */
.lhc-btn--added {
    background: var(--lhc-c-green) !important;
    border-color: var(--lhc-c-green) !important;
    color: #ffffff !important;
    pointer-events: none;
}

/* ── WordPress admin bar offset ──────────────────────────────────────────────── */
.admin-bar .lhc-cart-drawer { top: 32px; }
@media screen and (max-width: 782px) {
    .admin-bar .lhc-cart-drawer { top: 46px; }
}

/* ── Responsive ──────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .lhc-checkout-page {
        grid-template-columns: 1fr;
        padding: 20px 16px 40px;
        gap: 16px;
    }
    .lhc-checkout-right { display: none; }

    /* Show the inline mobile order summary wrapper */
    .lhc-os-mobile-wrap { display: block; margin-bottom: 8px; }

    /* Mobile toggle bar */
    .lhc-os-mobile-hd {
        display: flex;
        align-items: center;
        justify-content: space-between;
        background: #1a2e5a;
        padding: 14px 16px;
        border-radius: 6px;
        cursor: pointer;
        user-select: none;
        -webkit-user-select: none;
        transition: border-radius 0.2s;
    }
    .lhc-os-mobile-hd--open { border-radius: 6px 6px 0 0; }
    .lhc-os-mobile-hd__left {
        display: flex;
        align-items: center;
        gap: 8px;
        color: #ffffff;
    }
    .lhc-os-mobile-hd__icon { color: #D97706; line-height: 0; }
    .lhc-os-mobile-hd__label { font-size: 14px; font-weight: 600; }
    .lhc-os-mobile-hd__arrow {
        line-height: 0;
        transition: transform 0.25s;
    }
    .lhc-os-mobile-hd--open .lhc-os-mobile-hd__arrow { transform: rotate(180deg); }
    .lhc-os-mobile-hd__total {
        font-size: 15px;
        font-weight: 700;
        color: #D97706;
    }

    /* Collapsible order summary card */
    .lhc-os-mobile-wrap .lhc-os-card {
        display: none;
        border-top: none;
        border-radius: 0 0 6px 6px;
        margin-top: 0;
    }
    .lhc-os-mobile-wrap .lhc-os-card.lhc-os-card--open { display: block; }
}
@media (max-width: 480px) {
    .lhc-cart-drawer    { width: 100vw; }
    .lhc-cart-fab       { bottom: 18px; right: 16px; width: 50px; height: 50px; }
    .lhc-form-row-2col  { grid-template-columns: 1fr; }
    .lhc-ci             { grid-template-columns: 58px 1fr auto; }
    .lhc-ci__img        { width: 58px; height: 58px; }
    .lhc-checkout-page  { padding: 16px 12px 32px; }
}
