/* QuantumBlox Floating Dock (qbd3)
   Port fiel del Aceternity FloatingDock a vanilla, tema morado.
   Especificacion: h-16 pill, items circulares (rounded-full),
   magnificacion de 40 a 80px segun distancia al cursor,
   tooltip oscuro arriba. */

/* Neutralizamos el --nav-height legacy (era 72px para el nav-de-arriba viejo)
   asi todos los padding-top:calc(--nav-height + 40px) en .hero/.checkout-main/
   .catalog-hero/.main-content colapsan a solo 40px en vez de 112px de gap. */
:root {
    --nav-height: 0px !important;
}
/* Reservamos justo lo que ocupa el dock (24px bottom inset + 64px height = 88px)
   ni mas ni menos. Sin esto el dock taparia el footer; con mucho mas queda
   gap negro feo abajo. */
body {
    padding-bottom: calc(88px + env(safe-area-inset-bottom)) !important;
}
/* Override del legacy main.css (que sumaba 136px asumiendo promo abajo).
   Ahora el promo va arriba, solo descontamos el dock. */
body.qb-has-promo {
    padding-bottom: calc(88px + env(safe-area-inset-bottom)) !important;
}

.qbd3-wrap {
    position: fixed;
    /* Abajo: respetando safe-area de iOS y gesture bar */
    bottom: max(24px, calc(env(safe-area-inset-bottom) + 16px));
    left: 0; right: 0;
    z-index: 1000;
    display: flex;
    justify-content: center;
    pointer-events: none;
    padding: 0 12px;
}
.qbd3 {
    pointer-events: auto;
    display: flex;
    align-items: end;
    gap: 8px;
    height: 64px;
    padding: 0 12px 10px;
    border-radius: 20px;
    background: rgba(15, 11, 23, 0.85);
    border: 1px solid rgba(168, 85, 247, 0.15);
    backdrop-filter: blur(28px) saturate(160%);
    -webkit-backdrop-filter: blur(28px) saturate(160%);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55),
                inset 0 1px 0 rgba(255, 255, 255, 0.04);
    max-width: calc(100vw - 16px);
    /* Si el contenido excede el ancho (ej. usuario logueado + admin),
       permitimos scroll horizontal silencioso para que no se corten items. */
    overflow-x: auto;
    overflow-y: visible;
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}
.qbd3::-webkit-scrollbar { display: none; height: 0; }
/* En medium-narrow (880px - 1100px) achicamos un poco mas los items para
   que entren todos sin necesidad de scroll. Sin !important para no romper
   la magnificacion JS (que setea --qbd3-size inline en hover). */
@media (max-width: 1100px) and (min-width: 881px) {
    .qbd3 { gap: 6px; padding: 0 10px 10px; }
    .qbd3-item { --qbd3-size: 36px; }
}
.qbd3-item {
    position: relative;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    width: var(--qbd3-size, 40px);
    height: var(--qbd3-size, 40px);
    border-radius: 50%;
    background: rgba(168, 85, 247, 0.12);
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 0;
    cursor: pointer;
    font-family: inherit;
    border: 0;
    padding: 0;
    margin-bottom: 4px;
    transition: width 140ms ease, height 140ms ease,
                background 200ms ease, color 200ms ease;
}
.qbd3-item:hover {
    background: rgba(168, 85, 247, 0.22);
    color: #fff;
}
.qbd3-item.is-active {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.42), rgba(244, 63, 94, 0.28));
    color: #fff;
    box-shadow: 0 0 18px rgba(168, 85, 247, 0.45);
}
.qbd3-item.is-brand {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.45), rgba(244, 63, 94, 0.3));
    cursor: default;
}
/* Iconos: tamano interno escala suavemente con el item (50% del size). */
.qbd3-item img,
.qbd3-item i,
.qbd3-item svg {
    width: calc(var(--qbd3-size, 40px) * 0.5);
    height: calc(var(--qbd3-size, 40px) * 0.5);
    font-size: calc(var(--qbd3-size, 40px) * 0.45);
    line-height: 1;
    font-style: normal;
    display: block;
    object-fit: contain;
    max-width: none;
    max-height: none;
    min-width: 0;
    min-height: 0;
    pointer-events: none;
    transition: width 140ms ease, height 140ms ease, font-size 140ms ease;
}
.qbd3-item i {
    width: auto;
    height: auto;
}
.qbd3-item .qbd3-brand-logo {
    border-radius: 50%;
}
/* Tooltip arriba (estilo Aceternity: pill oscuro con texto blanco). */
.qbd3-tip {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 10px);
    padding: 5px 10px;
    background: rgba(28, 22, 38, 0.96);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1;
    white-space: nowrap;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 6px;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 6px);
    transition: opacity 160ms ease, transform 220ms cubic-bezier(0.22, 1, 0.36, 1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}
.qbd3-item:hover .qbd3-tip {
    opacity: 1;
    transform: translate(-50%, 0);
}
/* Mobile: collapse */
.qbd3-burger {
    display: none;
    width: 40px; height: 40px;
    border-radius: 50%;
    background: rgba(168, 85, 247, 0.12);
    border: 0;
    cursor: pointer;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-bottom: 4px;
    flex-shrink: 0;
}
.qbd3-burger span {
    display: block;
    width: 16px; height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: all 0.3s ease;
}
.qbd3-burger.active span:nth-child(1) { transform: rotate(45deg) translate(4px, 4px); }
.qbd3-burger.active span:nth-child(2) { opacity: 0; }
.qbd3-burger.active span:nth-child(3) { transform: rotate(-45deg) translate(4px, -4px); }
@media (max-width: 880px) {
    .qbd3-item:not(.is-brand) { display: none; }
    .qbd3-burger { display: flex; }
}
@media (prefers-reduced-motion: reduce) {
    .qbd3-item, .qbd3-item img, .qbd3-item i,
    .qbd3-item svg, .qbd3-tip { transition: none; }
}

/* Boton Admin Panel: hidden by default, JS lo muestra si hay sesion. */
.qbd3-item.qbd3-admin {
    background: linear-gradient(135deg, rgba(244, 63, 94, 0.32), rgba(217, 70, 239, 0.22));
    color: #fff;
}
.qbd3-item.qbd3-admin:hover {
    background: linear-gradient(135deg, rgba(244, 63, 94, 0.45), rgba(217, 70, 239, 0.32));
}

/* ================================================================
   ADMIN LOGIN MODAL (triple-click en el logo del dock)
   ================================================================ */
#qbd3-admin-modal {
    position: fixed;
    inset: 0;
    z-index: 13000;
    display: grid;
    place-items: center;
    background: rgba(5, 3, 10, 0.75);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    animation: qbd3-admin-fade 220ms ease-out;
}
@keyframes qbd3-admin-fade { from { opacity: 0; } to { opacity: 1; } }
.qbd3-admin-card {
    position: relative;
    width: min(420px, calc(100vw - 32px));
    padding: 36px 28px 28px;
    border-radius: 22px;
    border: 1px solid rgba(185, 117, 255, 0.28);
    background:
        radial-gradient(circle at 50% 0%, rgba(168, 85, 247, 0.22), transparent 55%),
        linear-gradient(145deg, rgba(25, 18, 36, 0.98), rgba(12, 8, 20, 0.99));
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6),
                inset 0 1px 0 rgba(255, 255, 255, 0.08);
    text-align: center;
    color: #fff;
    animation: qbd3-admin-pop 320ms cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes qbd3-admin-pop {
    from { transform: translateY(20px) scale(0.95); opacity: 0; }
    to   { transform: translateY(0) scale(1); opacity: 1; }
}
.qbd3-admin-close {
    position: absolute;
    top: 12px; right: 12px;
    width: 32px; height: 32px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: background 180ms ease;
}
.qbd3-admin-close:hover { background: rgba(255, 255, 255, 0.14); }
.qbd3-admin-icon {
    width: 64px; height: 64px;
    margin: 0 auto 18px;
    display: grid;
    place-items: center;
    border-radius: 20px;
    background: linear-gradient(135deg, #b975ff, #d946ef);
    box-shadow: 0 12px 32px rgba(185, 117, 255, 0.45),
                inset 0 1px 0 rgba(255, 255, 255, 0.3);
    color: #fff;
    font-size: 26px;
}
.qbd3-admin-card h2 {
    margin: 0 0 6px;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.02em;
}
.qbd3-admin-card > p {
    color: rgba(255, 255, 255, 0.6);
    font-size: 13.5px;
    margin: 0 0 22px;
}
#qbd3-admin-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
#qbd3-admin-form input {
    width: 100%;
    min-height: 48px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 14px;
    color: #fff;
    font-family: inherit;
    font-size: 15px;
    transition: border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}
#qbd3-admin-form input:focus {
    outline: 0;
    border-color: #b975ff;
    background: rgba(255, 255, 255, 0.07);
    box-shadow: 0 0 0 4px rgba(185, 117, 255, 0.18);
}
.qbd3-admin-err {
    min-height: 18px;
    color: #fca5a5;
    font-size: 12.5px;
    font-weight: 600;
    text-align: left;
    margin: -4px 2px 0;
}
.qbd3-admin-err:empty { display: none; }
.qbd3-admin-submit {
    width: 100%;
    min-height: 48px;
    margin-top: 6px;
    border: 0;
    border-radius: 99em;
    background: linear-gradient(135deg, #b975ff, #8b3df0);
    color: #fff;
    font-family: inherit;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0.01em;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(185, 117, 255, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.25);
    transition: transform 180ms ease, box-shadow 180ms ease;
}
.qbd3-admin-submit:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 12px 32px rgba(185, 117, 255, 0.55);
}
.qbd3-admin-submit:disabled { opacity: 0.6; cursor: wait; }
