/* ==========================================================================
   Botão Flutuante (FAB) de Atalho para o Modo Compras
   ========================================================================== */

.floating-shopping-wrapper {
    position: fixed;
    right: 16px;
    bottom: calc(90px + env(safe-area-inset-bottom, 0px));
    z-index: 1045;
    pointer-events: none;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), 
                opacity 0.25s ease, 
                visibility 0.25s ease,
                bottom 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    opacity: 1;
    visibility: visible;
}

/* Ocultação suave quando fora das telas permitidas */
.floating-shopping-wrapper.is-hidden {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    transform: scale(0.65) translateY(14px) !important;
}

/* Acompanhamento dinâmico do recolhimento da bottom-nav no mobile */
@media (max-width: 768px) {
    .floating-shopping-wrapper.nav-hidden {
        transform: translateY(calc(70px + env(safe-area-inset-bottom, 0px)));
    }
}

.floating-shopping-btn {
    pointer-events: auto;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    text-decoration: none;
    color: #ffffff !important;
    background: rgba(29, 29, 31, 0.88);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28), 0 2px 6px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.14);
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    outline: none;
    transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.22s ease,
                background 0.2s ease,
                border-color 0.2s ease;
}

.floating-shopping-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    transition: transform 0.2s ease;
}

.floating-shopping-icon svg {
    display: block;
    width: 24px;
    height: 24px;
    stroke: #ffffff;
}

/* Efeito de Hover (Desktop) */
@media (hover: hover) and (pointer: fine) {
    .floating-shopping-btn:hover {
        transform: scale(1.08);
        background: rgba(45, 45, 48, 0.92);
        -webkit-backdrop-filter: saturate(200%) blur(24px);
        backdrop-filter: saturate(200%) blur(24px);
        box-shadow: 0 10px 28px rgba(0, 0, 0, 0.38), 0 4px 10px rgba(0, 0, 0, 0.18);
        border-color: rgba(255, 255, 255, 0.28);
    }

    .floating-shopping-btn:hover .floating-shopping-tooltip {
        opacity: 1;
        visibility: visible;
        transform: translateY(-50%) translateX(0);
    }
}

/* Feedback de Toque / Clique (Active State) */
.floating-shopping-btn:active {
    transform: scale(0.92) !important;
    background: rgba(22, 22, 24, 0.95) !important;
    border-color: rgba(255, 255, 255, 0.10) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25) !important;
}

/* Tooltip lateral em Desktop */
.floating-shopping-tooltip {
    display: none;
}

@media (min-width: 769px) {
    .floating-shopping-wrapper {
        right: 28px;
        bottom: 42px;
    }

    .floating-shopping-btn {
        width: 56px;
        height: 56px;
    }

    .floating-shopping-tooltip {
        display: block;
        position: absolute;
        right: calc(100% + 12px);
        top: 50%;
        transform: translateY(-50%) translateX(8px);
        background: rgba(29, 29, 31, 0.92);
        color: #ffffff;
        -webkit-backdrop-filter: saturate(180%) blur(20px);
        backdrop-filter: saturate(180%) blur(20px);
        border: 1px solid rgba(255, 255, 255, 0.14);
        padding: 6px 14px;
        border-radius: 980px;
        font-size: 0.82rem;
        font-weight: 500;
        font-family: var(--font-family, inherit);
        white-space: nowrap;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
        transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
    }
}

/* Suporte para Tema Escuro */
@media (prefers-color-scheme: dark) {
    .floating-shopping-btn {
        background: rgba(29, 29, 31, 0.90);
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.35);
        border: 1px solid rgba(255, 255, 255, 0.16);
    }
}

/* Fallback para navegadores sem suporte a backdrop-filter */
@supports not ((-webkit-backdrop-filter: blur(20px)) or (backdrop-filter: blur(20px))) {
    .floating-shopping-btn {
        background: #1d1d1f !important;
    }
}
