/**
 * Floating cart button + mini-cart panel.
 * Everything is scoped under #lc-cf-fc-root. Look and feel matches the floating chat widget
 * (landing-contact-widget.css): same palette, shadows, rounded sheet, dark header.
 *
 * UNITS (important): the live theme sets html { font-size: 62.5% } so 1rem = 10px there (the chat button is
 * 40px, not 64px). Therefore:
 *   - the dock geometry that must line up with the chat button uses REM, exactly like the chat CSS does;
 *   - everything else (panel text, spacing, icons, badge) uses px / em on a fixed 16px root so it is readable
 *     whatever the theme's root size is.
 *
 * Dock geometry (CSS variables on the root):
 *   --fc-size   button diameter     --fc-right  distance from the right edge
 *   --fc-bottom distance from the bottom edge
 * Default size equals the chat button (4rem) so the two circles line up; "small"/"large" scale it
 * (3rem / 5rem) and the right offset is recomputed so the circles stay centred on each other.
 * With the chat button present (.lc-cf-fc--above-chat) the cart sits 0.75rem above it:
 * bottom = 1.5rem + 4rem + 0.75rem = 6.25rem.
 */

#lc-cf-fc-root {
    --fc-primary: #d32027;
    --fc-secondary: #f26522;
    --fc-amber: #b45309;
    --fc-amber-soft: #fef3c7;
    --fc-slate-800: #1e293b;
    --fc-gray-50: #f9fafb;
    --fc-gray-100: #f3f4f6;
    --fc-gray-200: #e5e7eb;
    --fc-gray-500: #6b7280;
    --fc-gray-600: #4b5563;
    --fc-gray-900: #111827;

    /* Default = same size and spot as the chat button (#contact-btn: 4rem at right/bottom 1.5rem).
       On a site without the chat button the cart simply takes that spot. */
    --fc-size: 4rem;
    --fc-right: 1.5rem;
    --fc-bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));

    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    color-scheme: light;
    color: var(--fc-gray-900);
    isolation: isolate;
    position: fixed;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    overflow: visible;
    pointer-events: none;
    /* Same level as the chat root; raised only while the panel is open (see --open). */
    z-index: 0;
}

/* Size options (setting "Button size"): multiples of the chat button's 4rem. */
#lc-cf-fc-root.lc-cf-fc--size-small { --fc-size: 3rem; }
#lc-cf-fc-root.lc-cf-fc--size-large { --fc-size: 5rem; }

/* Stacked on the chat button: sits 0.75rem above it (1.5rem + 4rem + 0.75rem = 6.25rem) and is centred on it.
   Chat centre is 3.5rem from the right edge, so right = 3.5rem - size/2. */
#lc-cf-fc-root.lc-cf-fc--above-chat {
    --fc-right: 1.5rem;
    --fc-bottom: 6.25rem;
}
#lc-cf-fc-root.lc-cf-fc--above-chat.lc-cf-fc--size-small { --fc-right: 2rem; }
#lc-cf-fc-root.lc-cf-fc--above-chat.lc-cf-fc--size-large { --fc-right: 1rem; }

#lc-cf-fc-root.lc-cf-fc--open {
    z-index: 2;
}

#lc-cf-fc-root *,
#lc-cf-fc-root *::before,
#lc-cf-fc-root *::after {
    box-sizing: border-box;
}

#lc-cf-fc-root [hidden] {
    display: none !important;
}

/* ---- Button ---- */
#lc-cf-fc-root .lc-cf-fc__btn {
    position: fixed;
    right: var(--fc-right);
    bottom: var(--fc-bottom);
    width: var(--fc-size);
    height: var(--fc-size);
    margin: 0;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 9999px;
    background: var(--fc-slate-800); /* dark: a white button vanishes on the site's white pages */
    color: #fff;
    font-size: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none !important;
    cursor: pointer;
    pointer-events: auto;
    box-shadow:
        0 10px 15px -3px rgba(0, 0, 0, 0.12),
        0 4px 6px -2px rgba(0, 0, 0, 0.06);
    transition: box-shadow 0.2s ease, transform 0.15s ease;
}

/* Invisible extra hit area so a 40px button is still easy to tap (stays inside the 0.75rem gap). */
#lc-cf-fc-root .lc-cf-fc__btn::after {
    content: "";
    position: absolute;
    top: -3px;
    right: -3px;
    bottom: -3px;
    left: -3px;
    border-radius: 9999px;
}

#lc-cf-fc-root .lc-cf-fc__btn:hover,
#lc-cf-fc-root .lc-cf-fc__btn:focus {
    color: #fff;
    background: #334155;
    text-decoration: none !important;
    box-shadow:
        0 20px 25px -5px rgba(0, 0, 0, 0.14),
        0 10px 10px -5px rgba(0, 0, 0, 0.06);
}

#lc-cf-fc-root .lc-cf-fc__btn:focus-visible {
    outline: 3px solid #2563eb;
    outline-offset: 2px;
}

#lc-cf-fc-root .lc-cf-fc__icon {
    display: block;
    width: calc(var(--fc-size) * 0.5);
    height: calc(var(--fc-size) * 0.5);
    pointer-events: none;
}

#lc-cf-fc-root .lc-cf-fc__badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border: 2px solid #fff;
    border-radius: 9999px;
    background: var(--fc-primary);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    pointer-events: none;
}

/* Hold running out (badge turns amber + button ring pulses) */
#lc-cf-fc-root.lc-cf-fc--warn .lc-cf-fc__badge {
    background: var(--fc-amber);
}

#lc-cf-fc-root.lc-cf-fc--warn .lc-cf-fc__btn {
    animation: lc-cf-fc-warn 2s ease-in-out infinite;
}

@keyframes lc-cf-fc-warn {
    0%, 100% { box-shadow: 0 0 0 0 rgba(180, 83, 9, 0.5), 0 10px 15px -3px rgba(0, 0, 0, 0.12); }
    50%      { box-shadow: 0 0 0 9px rgba(180, 83, 9, 0), 0 10px 15px -3px rgba(0, 0, 0, 0.12); }
}

/* Short bump when something is added */
#lc-cf-fc-root.lc-cf-fc--bump .lc-cf-fc__btn {
    animation: lc-cf-fc-bump 0.5s ease;
}

@keyframes lc-cf-fc-bump {
    0%   { transform: scale(1); }
    35%  { transform: scale(1.2); }
    70%  { transform: scale(0.95); }
    100% { transform: scale(1); }
}

/* ---- Toast (appears to the left of the button) ---- */
#lc-cf-fc-root .lc-cf-fc__toast {
    position: fixed;
    right: calc(var(--fc-right) + var(--fc-size) + 12px);
    bottom: var(--fc-bottom);
    min-height: var(--fc-size);
    max-width: calc(100vw - var(--fc-right) - var(--fc-size) - 28px);
    padding: 8px 16px;
    border-radius: 9999px;
    background: var(--fc-slate-800);
    color: #fff;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    pointer-events: auto;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
    animation: lc-cf-fc-toast-in 0.2s ease;
}

#lc-cf-fc-root .lc-cf-fc__toast a {
    color: #fdba74;
    font-weight: 700;
    text-decoration: underline !important;
    white-space: nowrap;
}

@keyframes lc-cf-fc-toast-in {
    from { opacity: 0; transform: translateX(8px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ---- Backdrop ---- */
#lc-cf-fc-root .lc-cf-fc__backdrop {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: transparent;
    pointer-events: auto;
}

/* ---- Panel ---- */
#lc-cf-fc-root .lc-cf-fc__panel {
    position: fixed;
    right: var(--fc-right);
    bottom: calc(var(--fc-bottom) + var(--fc-size) + 12px);
    width: 320px;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - var(--fc-bottom) - var(--fc-size) - 32px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 20px;
    background: #fff;
    color: var(--fc-gray-900);
    font-size: 16px;
    pointer-events: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.28);
    animation: lc-cf-fc-panel-in 0.18s ease;
}

@keyframes lc-cf-fc-panel-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

#lc-cf-fc-root .lc-cf-fc__head {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 8px 8px 14px;
    background: var(--fc-slate-800);
    color: #fff;
}

#lc-cf-fc-root .lc-cf-fc__title {
    margin: 0;
    padding: 0;
    flex: 1 1 auto;
    min-width: 0;
    font-size: 16px;
    line-height: 24px;
    font-weight: 700;
    color: #fff;
}

#lc-cf-fc-root .lc-cf-fc__close {
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
    color: #fff;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 9999px;
}

#lc-cf-fc-root .lc-cf-fc__close:hover {
    background: rgba(255, 255, 255, 0.15);
}

#lc-cf-fc-root .lc-cf-fc__close svg {
    width: 18px;
    height: 18px;
    pointer-events: none;
}

#lc-cf-fc-root .lc-cf-fc__body {
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 14px;
}

#lc-cf-fc-root .lc-cf-fc__msg {
    margin: 0;
    padding: 18px 8px;
    text-align: center;
    color: var(--fc-gray-600);
    font-size: 15px;
    line-height: 1.5;
}

#lc-cf-fc-root .lc-cf-fc__msg a {
    display: inline-block;
    margin-top: 12px;
    color: var(--fc-primary);
    font-weight: 700;
    text-decoration: underline !important;
}

#lc-cf-fc-root .lc-cf-fc__msg--err {
    color: var(--fc-primary);
}

#lc-cf-fc-root .lc-cf-fc__lines {
    list-style: none;
    margin: 0;
    padding: 0;
}

#lc-cf-fc-root .lc-cf-fc__line {
    display: block;
    margin: 0;
    padding: 9px 0;
    border-bottom: 1px solid var(--fc-gray-100);
    list-style: none;
    background: none;
}

#lc-cf-fc-root .lc-cf-fc__line:last-child {
    border-bottom: none;
}

#lc-cf-fc-root .lc-cf-fc__line {
    position: relative;
}

/* A change is being checked: dim the line and show a spinner over it */
#lc-cf-fc-root .lc-cf-fc__line.is-busy {
    pointer-events: none;
}

#lc-cf-fc-root .lc-cf-fc__line.is-busy > * {
    opacity: 0.35;
    transition: opacity 0.15s ease;
}

#lc-cf-fc-root .lc-cf-fc__line.is-busy::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 22px;
    height: 22px;
    margin: -11px 0 0 -11px;
    border: 3px solid var(--fc-gray-200);
    border-top-color: var(--fc-primary);
    border-radius: 9999px;
    animation: lc-cf-fc-spin 0.7s linear infinite;
}

/* Inline spinner (first load of the panel) */
#lc-cf-fc-root .lc-cf-fc__spin {
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 8px;
    vertical-align: -3px;
    border: 2px solid var(--fc-gray-200);
    border-top-color: var(--fc-primary);
    border-radius: 9999px;
    animation: lc-cf-fc-spin 0.7s linear infinite;
}

@keyframes lc-cf-fc-spin {
    to { transform: rotate(360deg); }
}

#lc-cf-fc-root .lc-cf-fc__top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

#lc-cf-fc-root .lc-cf-fc__bottom {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 5px;
}

#lc-cf-fc-root .lc-cf-fc__name {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    color: var(--fc-gray-900);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.3;
    text-decoration: none !important;
    word-wrap: break-word;
}

#lc-cf-fc-root a.lc-cf-fc__name:hover {
    color: var(--fc-primary);
}

#lc-cf-fc-root .lc-cf-fc__qty {
    flex: 0 0 auto;
    color: var(--fc-gray-600);
    font-size: 13px;
    line-height: 1.3;
}

#lc-cf-fc-root .lc-cf-fc__date {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex: 1 1 auto;
    min-width: 0;
    color: var(--fc-gray-500);
    font-size: 12.5px;
    line-height: 1.3;
}

#lc-cf-fc-root .lc-cf-fc__date svg {
    flex: 0 0 auto;
    width: 13px;
    height: 13px;
}

#lc-cf-fc-root .lc-cf-fc__date-text {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

#lc-cf-fc-root .lc-cf-fc__note {
    margin: 6px 0 0;
    padding: 4px 8px;
    border-radius: 8px;
    background: var(--fc-amber-soft);
    color: var(--fc-amber);
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.3;
}

#lc-cf-fc-root .lc-cf-fc__stepper {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin: 0;
    flex: 0 0 auto;
}

#lc-cf-fc-root .lc-cf-fc__step {
    margin: 0;
    padding: 0;
    width: 28px;
    height: 28px;
    border: 1px solid var(--fc-gray-200);
    border-radius: 9999px;
    background: #fff;
    color: var(--fc-gray-900);
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

#lc-cf-fc-root .lc-cf-fc__step:hover:not(:disabled),
#lc-cf-fc-root .lc-cf-fc__step:focus:not(:disabled) {
    background: var(--fc-gray-50);
    border-color: var(--fc-gray-500);
}

#lc-cf-fc-root .lc-cf-fc__step:disabled {
    opacity: 0.4;
    cursor: default;
}

#lc-cf-fc-root .lc-cf-fc__qty-input {
    margin: 0;
    padding: 0 2px;
    width: 40px;
    height: 28px;
    border: 1px solid var(--fc-gray-200);
    border-radius: 8px;
    background: #fff;
    color: var(--fc-gray-900);
    font-size: 16px; /* 16px stops iOS zooming into the field */
    font-weight: 700;
    text-align: center;
    -moz-appearance: textfield;
    box-shadow: none;
}

#lc-cf-fc-root .lc-cf-fc__qty-input::-webkit-outer-spin-button,
#lc-cf-fc-root .lc-cf-fc__qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

#lc-cf-fc-root .lc-cf-fc__line.is-busy .lc-cf-fc__step,
#lc-cf-fc-root .lc-cf-fc__line.is-busy .lc-cf-fc__qty-input {
    pointer-events: none;
}

#lc-cf-fc-root .lc-cf-fc__price {
    color: var(--fc-gray-900);
    flex: 0 0 auto;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.3;
    white-space: nowrap;
}

#lc-cf-fc-root .lc-cf-fc__remove {
    margin: 0 0 0 auto;
    padding: 0;
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 9999px;
    background: transparent;
    color: var(--fc-gray-500);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

#lc-cf-fc-root .lc-cf-fc__remove:hover,
#lc-cf-fc-root .lc-cf-fc__remove:focus {
    background: rgba(211, 32, 39, 0.1);
    color: var(--fc-primary);
}

#lc-cf-fc-root .lc-cf-fc__remove svg {
    width: 16px;
    height: 16px;
    pointer-events: none;
}

/* Hold countdown: a small chip in the header */
#lc-cf-fc-root .lc-cf-fc__timer {
    flex: 0 0 auto;
    margin: 0;
    padding: 3px 9px;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
    white-space: nowrap;
    cursor: default;
}

#lc-cf-fc-root .lc-cf-fc__timer.is-warn {
    background: var(--fc-amber-soft);
    color: var(--fc-amber);
}

/* Static hold text: one muted line */
#lc-cf-fc-root .lc-cf-fc__hint {
    margin: 0;
    padding: 6px 0 8px;
    color: var(--fc-gray-500);
    font-size: 12px;
    line-height: 1.35;
    text-align: center;
}

#lc-cf-fc-root .lc-cf-fc__foot {
    flex: 0 0 auto;
    padding: 8px 14px 12px;
    border-top: 1px solid var(--fc-gray-100);
    background: #fff;
}

#lc-cf-fc-root .lc-cf-fc__totals {
    margin: 0 0 8px;
}

#lc-cf-fc-root .lc-cf-fc__row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    padding: 1px 0;
    font-size: 13px;
    line-height: 1.4;
    color: var(--fc-gray-600);
}

#lc-cf-fc-root .lc-cf-fc__row-value {
    text-align: right;
    color: var(--fc-gray-900);
    font-weight: 600;
}

#lc-cf-fc-root .lc-cf-fc__row--total {
    margin-top: 3px;
    padding-top: 5px;
    border-top: 1px solid var(--fc-gray-100);
    font-size: 15px;
    font-weight: 700;
    color: var(--fc-gray-900);
}

#lc-cf-fc-root .lc-cf-fc__row--total .lc-cf-fc__row-value {
    font-weight: 700;
}

#lc-cf-fc-root .lc-cf-fc__actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#lc-cf-fc-root .lc-cf-fc__action {
    display: block;
    margin: 0;
    padding: 11px 14px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    text-decoration: none !important;
    cursor: pointer;
    transition: opacity 0.15s ease, background 0.15s ease;
}

#lc-cf-fc-root .lc-cf-fc__action--primary {
    border: 1px solid transparent;
    background: linear-gradient(to right, var(--fc-primary), var(--fc-secondary));
    color: #fff;
}

#lc-cf-fc-root .lc-cf-fc__action--primary:hover,
#lc-cf-fc-root .lc-cf-fc__action--primary:focus {
    color: #fff;
    opacity: 0.92;
}

/* ---- Mobile: bottom sheet with dimmed backdrop ---- */
@media (max-width: 639px) {
    #lc-cf-fc-root .lc-cf-fc__backdrop {
        background: rgba(0, 0, 0, 0.45);
    }

    #lc-cf-fc-root .lc-cf-fc__panel {
        right: 0;
        left: 0;
        bottom: 0;
        width: auto;
        max-width: none;
        max-height: 82vh;
        padding-bottom: env(safe-area-inset-bottom, 0px);
        border-radius: 24px 24px 0 0;
        animation: lc-cf-fc-sheet-in 0.2s ease;
    }

    /* Fingers need bigger targets than a mouse */
    #lc-cf-fc-root .lc-cf-fc__step,
    #lc-cf-fc-root .lc-cf-fc__remove {
        width: 34px;
        height: 34px;
    }

    #lc-cf-fc-root .lc-cf-fc__qty-input {
        height: 34px;
    }

    #lc-cf-fc-root .lc-cf-fc__action {
        padding: 13px 16px;
    }
}

@keyframes lc-cf-fc-sheet-in {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    #lc-cf-fc-root .lc-cf-fc__spin,
    #lc-cf-fc-root .lc-cf-fc__line.is-busy::after {
        animation-duration: 2s;
    }

    #lc-cf-fc-root .lc-cf-fc__btn,
    #lc-cf-fc-root .lc-cf-fc__toast,
    #lc-cf-fc-root .lc-cf-fc__panel,
    #lc-cf-fc-root.lc-cf-fc--warn .lc-cf-fc__btn,
    #lc-cf-fc-root.lc-cf-fc--bump .lc-cf-fc__btn {
        animation: none !important;
        transition: none !important;
    }
}
