/* =========================================
   Floating actions – v5 (V2.2 compact)
   - Mindig a viewport jobb szélén marad
   - Overlay utility: nem foglal layout helyet a tartalomból
   - Mobil/touch: fix jobb-közép, label nélkül (icon-only)
   ========================================= */

.floating-actions {
    position: fixed;
    right: max(8px, env(safe-area-inset-right));
    top: 50%;
    transform: translateY(-50%);
    /* mobile bar < floating actions < modal overlays */
    z-index: 1250;

    display: flex;
    flex-direction: column;
    gap: 8px;

    pointer-events: none;
}

/* Egy gomb */
.fab {
    pointer-events: auto;

    display: grid;
    grid-template-rows: 44px auto;
    justify-items: center;
    gap: 5px;

    width: 56px;
    text-decoration: none;
    color: #111827;
    /* SVG currentColor */
}

/* Ikon csempe – kontrasztos, fehéren is látszik */
.fab__icon {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: 12px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    background: rgba(255, 255, 255, .90);
    border: 1px solid rgba(15, 23, 42, .18);

    box-shadow:
        0 8px 18px rgba(15, 23, 42, .16),
        0 1px 0 rgba(255, 255, 255, .45) inset;

    outline: 1px solid rgba(15, 23, 42, .06);

    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);

    transition: transform .16s cubic-bezier(.22, .61, .36, 1), box-shadow .16s cubic-bezier(.22, .61, .36, 1), border-color .16s cubic-bezier(.22, .61, .36, 1), outline-color .16s cubic-bezier(.22, .61, .36, 1);
}

.fab__badge {
    position: absolute;
    top: -7px;
    right: -7px;

    min-width: 18px;
    height: 18px;
    padding: 0 6px;
    border-radius: 999px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    font-size: 11px;
    font-weight: 900;
    line-height: 1;

    background: #ef4444;
    color: #fff;
    border: 1px solid rgba(127, 29, 29, .22);
    box-shadow: 0 10px 22px rgba(15, 23, 42, .22);
}

.fab__badge[hidden] {
    display: none !important;
}

.fab__label {
    font-size: 10.5px;
    line-height: 1;
    font-weight: 550;
    letter-spacing: .02em;

    color: rgba(15, 23, 42, .78);
    text-align: center;
    user-select: none;
    text-shadow: 0 1px 0 rgba(255, 255, 255, .78);
}

@media (hover:hover) {
    .fab:hover .fab__icon {
        transform: translateY(-1px);
        box-shadow:
            0 12px 24px rgba(15, 23, 42, .22),
            0 1px 0 rgba(255, 255, 255, .45) inset;
        border-color: rgba(15, 23, 42, .24);
        outline-color: rgba(245, 158, 11, .16);
    }
}

.fab:active .fab__icon {
    transform: scale(.97);
}

/* Lap tetejére */
.fab--top {
    display: none;
}

.fab--top.is-visible {
    display: grid;
}

/* Kosár: neutrál */
.fab--cart .fab__icon {
    background: rgba(255, 255, 255, .92);
}

/* Kosár pulse animáció (AJAX kosárba-adás visszajelzés) */
@keyframes nk-fab-cart-pulse {
    0% {
        transform: scale(1);
    }
    35% {
        transform: scale(1.08);
    }
    70% {
        transform: scale(0.98);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes nk-fab-cart-badge-pop {
    0% {
        transform: scale(1);
    }
    35% {
        transform: scale(1.18);
    }
    100% {
        transform: scale(1);
    }
}

.fab--cart.is-pulsing .fab__icon {
    animation: nk-fab-cart-pulse 0.62s ease-out;
}

.fab--cart.is-pulsing .fab__badge {
    animation: nk-fab-cart-badge-pop 0.62s ease-out;
}

/* Pénztár: sárgás */
.fab--checkout .fab__icon {
    background: rgba(255, 251, 235, .98);
    border-color: rgba(245, 158, 11, .55);
    outline-color: rgba(245, 158, 11, .12);
}

/* Hívás: zöld + fehér */
.fab--call .fab__icon {
    background: #22c55e;
    border-color: rgba(20, 83, 45, .20);
    color: #fff;
    outline-color: rgba(255, 255, 255, .18);
}

/* Viber: lila + fehér */
.fab--viber .fab__icon {
    background: #7360f2;
    border-color: rgba(49, 46, 129, .20);
    color: #fff;
    outline-color: rgba(255, 255, 255, .18);
}

/* Viber PNG */
.fab__brand-icon {
    width: 22px;
    height: 22px;
    display: block;
    object-fit: contain;
}

/* 2) Mobil/touch: fix jobb-közép + label OFF (ne takarjon semmit) */
@media (hover:none) and (pointer:coarse) {
    .floating-actions {
        top: 50%;
        bottom: auto;
        transform: translateY(-50%);
        right: max(8px, env(safe-area-inset-right));
        gap: 8px;
    }

    .floating-actions.floating-actions--anchor-middle-right,
    .floating-actions.floating-actions--anchor-bottom-right,
    .floating-actions.floating-actions--anchor-top-right {
        top: 50%;
        bottom: auto;
        transform: translateY(-50%);
        right: max(8px, env(safe-area-inset-right));
    }

    .fab {
        width: 44px;
        grid-template-rows: 44px;
        gap: 0;
    }

    .fab__label {
        display: none;
    }

    /* blur mobilon drága: kikapcs */
    .fab__icon {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        box-shadow: 0 7px 16px rgba(15, 23, 42, .16);
    }

    body.page-category .floating-actions {
        top: auto;
        bottom: max(88px, calc(env(safe-area-inset-bottom) + 84px));
        transform: none;
        right: max(6px, calc(env(safe-area-inset-right) + 2px));
        gap: 7px;
    }

    body.page-category .fab {
        width: 38px;
        grid-template-rows: 38px;
    }

    body.page-category .fab__icon {
        width: 38px;
        height: 38px;
        border-radius: 10px;
    }
}

/* 3) Szűk desktop/laptop: label OFF + kevesebb hely foglalás */
@media (max-width: 1280px) {
    .fab {
        width: 48px;
        grid-template-rows: 44px;
        gap: 0;
    }

    .fab__label {
        display: none;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .fab__icon {
        transition: none !important;
    }

    .fab--cart.is-pulsing .fab__icon,
    .fab--cart.is-pulsing .fab__badge {
        animation: none !important;
    }
}

/* =========================================
   Cart sheet (bottom modal) – triggered by .fab--cart
   - No inline JS/CSS, controlled by assets/js/cart_sheet.js
   ========================================= */
.nk-cart-sheet {
    position: fixed;
    inset: 0;
    z-index: 1700;
    opacity: 0;
    pointer-events: none;
    transition: opacity .12s linear;
}

.nk-cart-sheet.is-open {
    opacity: 1;
    pointer-events: auto;
}

.nk-cart-sheet__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, .46);
}

.nk-cart-sheet__panel {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;

    max-width: 920px;
    margin: 0 auto;

    background: #fff;
    color: var(--wx-fg-on-light, #111827);
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -18px 60px rgba(15, 23, 42, .28);
    border: 1px solid rgba(148, 163, 184, .22);
    border-bottom: 0;

    transform: translateY(110%);
    transition: transform .18s ease;
    max-height: min(88vh, 920px);

    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.nk-cart-sheet.is-open .nk-cart-sheet__panel {
    transform: translateY(0);
}

.nk-cart-sheet__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(15, 23, 42, .08);
    background: rgba(255, 255, 255, .98);
}

.nk-cart-sheet__title {
    font-size: 13px;
    font-weight: 900;
    letter-spacing: .01em;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--wx-fg-on-light, #111827);
}

.nk-cart-sheet__count:empty {
    display: none;
}

.nk-cart-sheet__count {
    font-size: 11px;
    font-weight: 900;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(245, 158, 11, .14);
    border: 1px solid rgba(245, 158, 11, .28);
}

.nk-cart-sheet__close {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, .28);
    background: #fff;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
}

.nk-cart-sheet__body {
    padding: 12px 14px;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

.nk-cart-sheet__state {
    padding: 14px 10px;
    text-align: center;
    color: rgba(100, 116, 139, 1);
    font-size: 12px;
    font-weight: 650;
}

.nk-cart-sheet__list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.nk-cart-sheet__item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    padding: 10px;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, .22);
    background: rgba(248, 250, 252, .94);
}

.nk-cart-sheet__item.is-updating {
    opacity: .68;
}

.nk-cart-sheet__left {
    display: grid;
    grid-template-columns: 46px 1fr;
    gap: 10px;
    min-width: 0;
}

.nk-cart-sheet__thumb {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, .22);
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    text-decoration: none;
}

.nk-cart-sheet__thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.nk-cart-sheet__thumbPh {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(226, 232, 240, .72), rgba(241, 245, 249, .92));
}

.nk-cart-sheet__meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nk-cart-sheet__name {
    font-size: 12px;
    font-weight: 850;
    color: rgba(15, 23, 42, .92);
    text-decoration: none;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.nk-cart-sheet__sub {
    font-size: 11px;
    color: rgba(100, 116, 139, 1);
    font-weight: 650;
}

.nk-cart-sheet__right {
    display: grid;
    grid-auto-flow: row;
    align-content: start;
    justify-items: end;
    gap: 8px;
}

.nk-cart-sheet__qty {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.nk-cart-sheet__qtyBtn {
    width: 28px;
    height: 28px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, .28);
    background: #fff;
    cursor: pointer;
    font-weight: 900;
    line-height: 1;
}

.nk-cart-sheet__qtyInput {
    width: 54px;
    height: 28px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, .28);
    background: #fff;
    text-align: center;
    font-weight: 900;
    font-size: 12px;
    color: #0f172a;
    -webkit-text-fill-color: #0f172a;
    caret-color: #0f172a;
    opacity: 1;
    font-variant-numeric: tabular-nums;
}

.nk-cart-sheet__price {
    font-size: 12px;
    font-weight: 900;
    color: rgba(15, 23, 42, .92);
}

.nk-cart-sheet__remove {
    width: 28px;
    height: 28px;
    border-radius: 10px;
    border: 1px solid rgba(248, 113, 113, .32);
    background: rgba(254, 226, 226, .75);
    color: rgba(185, 28, 28, 1);
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
}

.nk-cart-sheet__foot {
    border-top: 1px solid rgba(15, 23, 42, .08);
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, .98);
}

.nk-cart-sheet__sum {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 12px;
    color: rgba(100, 116, 139, 1);
    font-weight: 750;
}

.nk-cart-sheet__sum strong {
    color: rgba(15, 23, 42, .92);
    font-weight: 950;
}

.nk-cart-sheet__actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

@media (prefers-reduced-motion: reduce) {
    .nk-cart-sheet,
    .nk-cart-sheet__panel {
        transition: none !important;
    }
}

@media (max-width: 520px) {
    .nk-cart-sheet__panel {
        max-width: 100%;
        margin: 0;
        max-height: min(92vh, 980px);
    }

    .nk-cart-sheet__item {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .nk-cart-sheet__right {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        width: 100%;
    }

    .nk-cart-sheet__price {
        text-align: right;
    }
}
