/* ============================================================================
   TANDA W9 :: w9-pos-fabs.css :: Stack ordenado de FABs del POS
   ============================================================================
   Antes: COTIZ y PERDIDA chocaban en bottom:90/right:18 (se superponian).
   VUELTO solo aparecia en mobile en posicion fija.
   Ahora: stack vertical premium con animaciones, hover effects, tooltips.

   Orden vertical (desde abajo):
     1) COTIZ (queso)        - bottom: 96px  - SIEMPRE visible
     2) VUELTO (💵)           - bottom: 168px - solo si efectivo + items
     3) PERDIDA (📉)          - bottom: 240px - solo si tiene permiso

   Usa CSS variables para que cualquier nuevo FAB pueda hacer override del slot.
   Z-index unificado: 9400-9450 (debajo de modales pero arriba de todo lo demas)
*/

/* === Variables base del stack === */
:root {
    --pos-fab-right: 18px;
    --pos-fab-base-bottom: 96px;
    --pos-fab-step: 72px;             /* separacion vertical entre FABs */
    --pos-fab-z: 9400;
    --pos-fab-anim-dur: 0.45s;
    --pos-fab-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

@media (max-width: 600px) {
    :root {
        --pos-fab-right: 12px;
        --pos-fab-base-bottom: 100px;
        --pos-fab-step: 64px;
    }
}

/* === Slot 1: COTIZ (queso, naranja) === */
html body .pos-fab-cotiz {
    position: fixed !important;
    right: var(--pos-fab-right) !important;
    bottom: var(--pos-fab-base-bottom) !important;
    z-index: calc(var(--pos-fab-z) + 1) !important;
    width: 60px !important; height: 60px !important;
    border-radius: 50% !important;
    background: linear-gradient(135deg, #f97316 0%, #c2410c 100%) !important;
    color: #fff !important;
    border: 2px solid rgba(255, 255, 255, 0.18) !important;
    cursor: pointer !important;
    box-shadow: 0 8px 24px rgba(249, 115, 22, 0.5), 0 2px 6px rgba(0,0,0,0.3) !important;
    display: inline-flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 1px !important;
    padding: 0 !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
    transition: transform 0.18s var(--pos-fab-bounce), box-shadow 0.18s, filter 0.15s !important;
    animation: posfab-slide-in var(--pos-fab-anim-dur) var(--pos-fab-bounce) both;
}
html body .pos-fab-cotiz:hover {
    transform: translateY(-3px) scale(1.06) !important;
    box-shadow: 0 14px 32px rgba(249, 115, 22, 0.65), 0 4px 10px rgba(0,0,0,0.4) !important;
    filter: brightness(1.08) !important;
}
html body .pos-fab-cotiz:active {
    transform: translateY(-1px) scale(0.98) !important;
}

/* === Slot 2: VUELTO (calculadora) === */
html body .pos-vuelto-fab {
    position: fixed !important;
    right: var(--pos-fab-right) !important;
    bottom: calc(var(--pos-fab-base-bottom) + var(--pos-fab-step)) !important;
    z-index: var(--pos-fab-z) !important;
    padding: 11px 18px !important;
    border-radius: 999px !important;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    color: #fff !important;
    border: 2px solid rgba(255, 255, 255, 0.18) !important;
    font-weight: 800 !important;
    font-size: 13px !important;
    letter-spacing: 0.4px !important;
    cursor: pointer !important;
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.4), 0 2px 6px rgba(0,0,0,0.3) !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    transition: transform 0.18s var(--pos-fab-bounce), box-shadow 0.18s, filter 0.15s !important;
    animation: posfab-slide-in var(--pos-fab-anim-dur) var(--pos-fab-bounce) both;
    animation-delay: 0.05s;
}
html body .pos-vuelto-fab:hover {
    transform: translateY(-3px) scale(1.04) !important;
    box-shadow: 0 14px 32px rgba(16, 185, 129, 0.55), 0 4px 10px rgba(0,0,0,0.4) !important;
    filter: brightness(1.08) !important;
}
html body .pos-vuelto-fab:active { transform: translateY(-1px) scale(0.98) !important; }

/* === Slot 3: PERDIDA (consumo/rotura) === */
html body .pos-perdida-fab {
    position: fixed !important;
    right: var(--pos-fab-right) !important;
    bottom: calc(var(--pos-fab-base-bottom) + var(--pos-fab-step) * 2) !important;
    z-index: var(--pos-fab-z) !important;
    padding: 11px 18px !important;
    border-radius: 999px !important;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
    color: #fff !important;
    border: 2px solid rgba(255, 255, 255, 0.18) !important;
    font-weight: 800 !important;
    font-size: 13px !important;
    letter-spacing: 0.4px !important;
    cursor: pointer !important;
    box-shadow: 0 8px 24px rgba(245, 158, 11, 0.45), 0 2px 6px rgba(0,0,0,0.3) !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    transition: transform 0.18s var(--pos-fab-bounce), box-shadow 0.18s, filter 0.15s, background 0.2s !important;
    animation: posfab-slide-in var(--pos-fab-anim-dur) var(--pos-fab-bounce) both;
    animation-delay: 0.1s;
}
html body .pos-perdida-fab:hover {
    transform: translateY(-3px) scale(1.04) !important;
    box-shadow: 0 14px 32px rgba(245, 158, 11, 0.6), 0 4px 10px rgba(0,0,0,0.4) !important;
    filter: brightness(1.08) !important;
}
html body .pos-perdida-fab:active { transform: translateY(-1px) scale(0.98) !important; }

/* PERDIDA activa: rojo con pulse */
html body .pos-perdida-fab.activa {
    background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%) !important;
    border-color: rgba(255, 100, 100, 0.4) !important;
    box-shadow: 0 8px 24px rgba(220, 38, 38, 0.6), 0 0 0 0 rgba(220, 38, 38, 0.7) !important;
    animation: posfab-perdida-pulse 1.6s ease-in-out infinite !important;
    padding-right: 22px !important;
    font-size: 13px !important;
    font-weight: 900 !important;
}

/* === Animaciones === */
@keyframes posfab-slide-in {
    from {
        opacity: 0;
        transform: translateX(60px) scale(0.6);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}
@keyframes posfab-perdida-pulse {
    0%, 100% { box-shadow: 0 8px 24px rgba(220, 38, 38, 0.6), 0 0 0 0 rgba(220, 38, 38, 0.7); }
    50% { box-shadow: 0 12px 28px rgba(220, 38, 38, 0.8), 0 0 0 12px rgba(220, 38, 38, 0); }
}

/* === Tooltip CSS only on hover (sin JS) === */
html body .pos-fab-cotiz::before,
html body .pos-vuelto-fab::before,
html body .pos-perdida-fab::before {
    content: attr(title);
    position: absolute;
    right: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%) translateX(8px);
    background: rgba(0, 0, 0, 0.92);
    color: #fff;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.3px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s, transform 0.15s var(--pos-fab-bounce);
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
}
html body .pos-fab-cotiz:hover::before,
html body .pos-vuelto-fab:hover::before,
html body .pos-perdida-fab:hover::before {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}
@media (hover: none) {
    html body .pos-fab-cotiz::before,
    html body .pos-vuelto-fab::before,
    html body .pos-perdida-fab::before { display: none; }
}

/* === Responsive: en mobile compactar === */
@media (max-width: 600px) {
    html body .pos-fab-cotiz { width: 52px !important; height: 52px !important; }
    html body .pos-vuelto-fab { padding: 9px 14px !important; font-size: 11.5px !important; }
    html body .pos-perdida-fab { padding: 9px 14px !important; font-size: 11.5px !important; }
}

/* === Compatibilidad: tirar abajo cualquier override de bottom de versiones viejas === */
.pos-fab-cotiz[style*="bottom"]:not([data-w9-keep]),
.pos-vuelto-fab[style*="bottom"]:not([data-w9-keep]),
.pos-perdida-fab[style*="bottom"]:not([data-w9-keep]) {
    /* W9 controla el bottom via CSS variables, no permitir style inline override */
}
