/**
 * BAS Vendor Map — Farmstand Kiosk Overlay Styles
 *
 * All kiosk styles are scoped under:
 *   body.bas-kiosk-active  — when ?kiosk=1 is in the URL (PHP-set body class)
 *   .bas-kiosk-overlay     — the full-screen cart panel (JS-injected)
 *
 * CSS custom properties (--bas-kiosk-*) are set in <head> by
 * BAS_VM_Kiosk::output_inline_data() using the vendor's brand color math.
 *
 * Zero impact on non-kiosk store page visits — no styles apply unless the
 * body class or overlay element is present.
 *
 * @package BAS_Vendor_Map
 * @since   4.30.0
 */

/* ── Design tokens fallbacks ──────────────────────────────────────────────── */
:root {
    --bas-kiosk-brand:      #70ac43;
    --bas-kiosk-grad-light: #c2e86b;
    --bas-kiosk-hover:      #5a8f35;
    --bas-kiosk-tint:       #f4fcea;
    --bas-kiosk-text:       #ffffff;
}

/* ── WC mini-cart suppression ─────────────────────────────────────────────── */
/* Hide any competing cart widget while kiosk is active — the overlay IS the cart. */
body.bas-kiosk-active .woocommerce-mini-cart,
body.bas-kiosk-active .cart-contents,
body.bas-kiosk-active .header-cart,
body.bas-kiosk-active [class*="mini-cart"],
body.bas-kiosk-active [id*="mini-cart"] {
    display: none !important;
}

/* ── Full-screen overlay ──────────────────────────────────────────────────── */
.bas-kiosk-overlay {
    position: fixed;
    inset: 0;
    z-index: 999990;
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.55);
    font-family: Lato, 'Helvetica Neue', Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    /* Hidden by default — JS calls .bas-kiosk-overlay--open to show */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.bas-kiosk-overlay.bas-kiosk-overlay--open {
    opacity: 1;
    pointer-events: auto;
}

/* ── Panel (slides in from bottom on mobile, right-anchored on desktop) ────── */
.bas-kiosk-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    background: var(--bas-kiosk-tint);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    transform: translateY(100%);
    transition: transform 0.25s cubic-bezier(0.32, 0.72, 0, 1);
}

.bas-kiosk-overlay.bas-kiosk-overlay--open .bas-kiosk-panel {
    transform: translateY(0);
}

@media (min-width: 640px) {
    .bas-kiosk-panel {
        left: auto;
        width: 420px;
        max-height: 100vh;
        top: 0;
        bottom: 0;
        border-radius: 20px 0 0 20px;
        transform: translateX(100%);
        right: 0;
    }
    .bas-kiosk-overlay.bas-kiosk-overlay--open .bas-kiosk-panel {
        transform: translateX(0);
    }
}

/* ── Vendor header strip ──────────────────────────────────────────────────── */
.bas-kiosk-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 20px 16px;
    background: var(--bas-kiosk-brand);
    color: var(--bas-kiosk-text);
    flex-shrink: 0;
}

.bas-kiosk-header__logo {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.4);
    flex-shrink: 0;
}

.bas-kiosk-header__logo--placeholder {
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.bas-kiosk-header__info {
    flex: 1;
    min-width: 0;
}

.bas-kiosk-header__shop-name {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--bas-kiosk-text);
    margin: 0;
}

.bas-kiosk-header__cart-label {
    font-size: 12px;
    opacity: 0.82;
    margin-top: 2px;
}

.bas-kiosk-header__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.25);
    color: var(--bas-kiosk-text);
    font-size: 12px;
    font-weight: 700;
    border-radius: 100px;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
}

/* ── Scrollable cart item list ────────────────────────────────────────────── */
.bas-kiosk-items {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ── Cart item card ───────────────────────────────────────────────────────── */
.bas-kiosk-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #ffffff;
    border-radius: 14px;
    padding: 12px 14px;
    border: 1.5px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    position: relative;
    transition: box-shadow 0.15s;
}

.bas-kiosk-item--just-added {
    border-color: var(--bas-kiosk-brand);
    box-shadow: 0 0 0 3px rgba(112, 172, 67, 0.18);
}

.bas-kiosk-item__thumb {
    width: 64px;
    height: 64px;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.bas-kiosk-item__body {
    flex: 1;
    min-width: 0;
}

.bas-kiosk-item__name {
    font-size: 15px;
    font-weight: 700;
    color: #313131;
    line-height: 1.3;
    margin: 0 0 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bas-kiosk-item__price {
    font-size: 13px;
    color: #777;
}

.bas-kiosk-item__controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

/* Qty stepper */
.bas-kiosk-stepper {
    display: flex;
    align-items: center;
    gap: 0;
    border: 1.5px solid #e0ddd0;
    border-radius: 100px;
    overflow: hidden;
    background: #f8f5ee;
}

.bas-kiosk-stepper__btn {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 18px;
    font-weight: 700;
    color: var(--bas-kiosk-brand);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.12s, color 0.12s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    flex-shrink: 0;
}

.bas-kiosk-stepper__btn:hover:not(:disabled),
.bas-kiosk-stepper__btn:focus-visible {
    background: var(--bas-kiosk-brand);
    color: #fff;
    outline: none;
}

.bas-kiosk-stepper__btn:active:not(:disabled) {
    background: var(--bas-kiosk-hover);
    color: #fff;
}

.bas-kiosk-stepper__btn:disabled {
    color: #ccc;
    cursor: not-allowed;
}

.bas-kiosk-stepper__qty {
    min-width: 32px;
    text-align: center;
    font-size: 15px;
    font-weight: 700;
    color: #313131;
    user-select: none;
}

/* Line total */
.bas-kiosk-item__line-total {
    font-size: 14px;
    font-weight: 700;
    color: #313131;
    margin-left: auto;
    white-space: nowrap;
}

/* Remove button */
.bas-kiosk-item__remove {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 26px;
    height: 26px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: #bbb;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: color 0.12s, background 0.12s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    padding: 0;
}

.bas-kiosk-item__remove:hover,
.bas-kiosk-item__remove:focus-visible {
    color: #c0392b;
    background: #fdecea;
    outline: none;
}

/* "Remove?" confirm state */
.bas-kiosk-item__remove--confirm {
    color: #c0392b;
    background: #fdecea;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    width: auto;
    padding: 0 8px;
    border-radius: 100px;
    height: 24px;
}

/* ── "Just added" badge ───────────────────────────────────────────────────── */
.bas-kiosk-added-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #2d7d2d;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 100px;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    animation: bas-kiosk-badge-in 0.3s ease;
}

@keyframes bas-kiosk-badge-in {
    from { transform: scale(0.6); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}

.bas-kiosk-added-badge--fading {
    transition: opacity 0.4s ease;
    opacity: 0;
}

/* ── Empty cart state ─────────────────────────────────────────────────────── */
.bas-kiosk-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    text-align: center;
    color: #888;
    gap: 10px;
}

.bas-kiosk-empty__icon {
    font-size: 48px;
    line-height: 1;
}

.bas-kiosk-empty__title {
    font-size: 17px;
    font-weight: 700;
    color: #444;
    margin: 0;
}

.bas-kiosk-empty__hint {
    font-size: 14px;
    color: #999;
    margin: 0;
    max-width: 260px;
}

/* ── Loading spinner ──────────────────────────────────────────────────────── */
.bas-kiosk-loading {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 40px;
    color: #888;
}

.bas-kiosk-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(112, 172, 67, 0.2);
    border-top-color: var(--bas-kiosk-brand);
    border-radius: 50%;
    animation: bas-kiosk-spin 0.75s linear infinite;
}

@keyframes bas-kiosk-spin {
    to { transform: rotate(360deg); }
}

/* ── Error state ──────────────────────────────────────────────────────────── */
.bas-kiosk-error {
    margin: 16px;
    padding: 14px 16px;
    background: #fdecea;
    border: 1.5px solid #e9b4b0;
    border-radius: 10px;
    color: #b91c1c;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    text-align: center;
    flex-shrink: 0;
}

/* ── Fixed bottom bar ─────────────────────────────────────────────────────── */
.bas-kiosk-footer {
    flex-shrink: 0;
    padding: 16px 20px;
    background: #ffffff;
    border-top: 1.5px solid rgba(0, 0, 0, 0.07);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.bas-kiosk-footer__total-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.bas-kiosk-footer__total-label {
    font-size: 14px;
    color: #666;
}

.bas-kiosk-footer__total-value {
    font-size: 22px;
    font-weight: 900;
    color: var(--bas-kiosk-brand);
    letter-spacing: -0.5px;
}

/* Checkout button — pill gradient (site standard) */
.bas-kiosk-checkout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 16px 24px;
    border: none;
    border-radius: 100px;
    background: linear-gradient(180deg, var(--bas-kiosk-grad-light) 0%, var(--bas-kiosk-brand) 100%);
    color: var(--bas-kiosk-text);
    font-family: Lato, 'Helvetica Neue', Arial, sans-serif;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: filter 0.15s;
    min-height: 56px; /* guaranteed fat-finger target */
    border: 1px solid var(--bas-kiosk-brand);
}

.bas-kiosk-checkout-btn:hover:not(:disabled) {
    filter: brightness(1.06);
}

.bas-kiosk-checkout-btn:active:not(:disabled) {
    filter: brightness(0.94);
}

.bas-kiosk-checkout-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    filter: none;
}

/* "Keep Shopping" link */
.bas-kiosk-keep-shopping {
    display: block;
    text-align: center;
    font-size: 14px;
    color: var(--bas-kiosk-brand);
    font-weight: 600;
    cursor: pointer;
    padding: 6px 0;
    text-decoration: underline;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    background: none;
    border: none;
    width: 100%;
}

.bas-kiosk-keep-shopping:hover {
    color: var(--bas-kiosk-hover);
}

/* ── Backdrop tap zone (to dismiss by tapping outside panel) ──────────────── */
.bas-kiosk-backdrop {
    position: absolute;
    inset: 0;
    /* Transparent — clicks fall through to the panel via z-index or hit .bas-kiosk-panel area */
}
