/**
 * Promatch Academy Tracker — Floating Menu v1.0.1
 *
 * Menú lateral fijo derecho con pills expansibles al hover.
 * Colores branding: azul oscuro #071529, verde lima #C4FF00, blanco.
 * Oculto en pantallas menores a 768px (mobile usa el menú principal).
 */

/* ============================================================= */
/* CONTENEDOR                                                    */
/* ============================================================= */

.pmat-fm {
    position: fixed;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 99990;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 0;
    margin: 0;
    list-style: none;
    pointer-events: none; /* los hijos re-enable */
    font-family: 'Oswald', 'Heebo', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.pmat-fm * {
    box-sizing: border-box;
}

/* Si el admin bar de WP está activo, compensar los 32px */
body.admin-bar .pmat-fm {
    top: calc(50% + 16px);
}

/* ============================================================= */
/* ITEM — pill colapsado (solo icono)                            */
/* ============================================================= */

.pmat-fm__item {
    pointer-events: auto;
    margin: 0;
    padding: 0;
    list-style: none;
}

.pmat-fm__link {
    display: flex;
    align-items: center;
    /* flex-start: el ícono queda visible dentro del pill de 46px.
       Con flex-end el label (opacity:0 pero con width real 58-114px)
       empujaba el ícono fuera del área visible. */
    justify-content: flex-start;
    background-color: #071529;
    color: #C4FF00;
    text-decoration: none !important;
    border-radius: 46px;
    height: 46px;
    width: 46px;
    padding: 0;
    overflow: hidden;
    white-space: nowrap;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
    transition: width 0.32s cubic-bezier(0.4, 0, 0.2, 1),
                background-color 0.2s ease,
                color 0.2s ease,
                box-shadow 0.2s ease,
                transform 0.2s ease;
    will-change: width;
    cursor: pointer;
    border: 2px solid transparent;
}

/* ============================================================= */
/* ICONO + LABEL                                                 */
/* ============================================================= */

.pmat-fm__icon {
    flex: 0 0 46px;
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    line-height: 1;
    color: #C4FF00;
}

/* Specificity alta + !important para sobreescribir cualquier regla de
   Font Awesome, Jeg Kit o Elementor que pudiera forzar color/tamaño. */
.pmat-fm .pmat-fm__link .pmat-fm__icon > i,
.pmat-fm .pmat-fm__link .pmat-fm__icon > svg,
.pmat-fm .pmat-fm__link .pmat-fm__icon i.fa,
.pmat-fm .pmat-fm__link .pmat-fm__icon i.fas,
.pmat-fm .pmat-fm__link .pmat-fm__icon i.fa-solid {
    font-size: 20px !important;
    line-height: 1 !important;
    color: #C4FF00 !important;
    display: inline-block !important;
    width: auto !important;
    height: auto !important;
}

/* Inversión de color del icono en hover (fondo pasa a verde, icono a azul) */
.pmat-fm .pmat-fm__link:hover .pmat-fm__icon,
.pmat-fm .pmat-fm__link:focus .pmat-fm__icon,
.pmat-fm .pmat-fm__link:hover .pmat-fm__icon > i,
.pmat-fm .pmat-fm__link:focus .pmat-fm__icon > i,
.pmat-fm .pmat-fm__link:hover .pmat-fm__icon i.fa,
.pmat-fm .pmat-fm__link:focus .pmat-fm__icon i.fa,
.pmat-fm .pmat-fm__link:hover .pmat-fm__icon i.fas,
.pmat-fm .pmat-fm__link:focus .pmat-fm__icon i.fas,
.pmat-fm .pmat-fm__link:hover .pmat-fm__icon i.fa-solid,
.pmat-fm .pmat-fm__link:focus .pmat-fm__icon i.fa-solid {
    color: #071529 !important;
}

/* En el item de logout, al hover el icono queda blanco sobre fondo rojo */
.pmat-fm .pmat-fm__item--logout .pmat-fm__link:hover .pmat-fm__icon > i,
.pmat-fm .pmat-fm__item--logout .pmat-fm__link:focus .pmat-fm__icon > i,
.pmat-fm .pmat-fm__item--logout .pmat-fm__link:hover .pmat-fm__icon i.fa,
.pmat-fm .pmat-fm__item--logout .pmat-fm__link:hover .pmat-fm__icon i.fas,
.pmat-fm .pmat-fm__item--logout .pmat-fm__link:hover .pmat-fm__icon i.fa-solid {
    color: #FFFFFF !important;
}

.pmat-fm__label {
    flex: 0 1 auto;
    padding: 0 18px 0 4px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    opacity: 0;
    transform: translateX(8px);
    transition: opacity 0.2s ease 0.05s,
                transform 0.2s ease 0.05s;
}

/* ============================================================= */
/* HOVER — expandir pill + mostrar label                         */
/* ============================================================= */

.pmat-fm__link:hover,
.pmat-fm__link:focus {
    width: 180px;
    background-color: #C4FF00;
    color: #071529;
    box-shadow: 0 6px 22px rgba(196, 255, 0, 0.35);
    transform: translateX(-2px);
    outline: none;
}

.pmat-fm__link:hover .pmat-fm__label,
.pmat-fm__link:focus .pmat-fm__label {
    opacity: 1;
    transform: translateX(0);
    transition-delay: 0.12s;
}

.pmat-fm__link:active {
    transform: translateX(-2px) scale(0.97);
}

/* ============================================================= */
/* ITEM DE LOGOUT — distintivo rojizo sutil al hover             */
/* ============================================================= */

.pmat-fm__item--logout .pmat-fm__link:hover,
.pmat-fm__item--logout .pmat-fm__link:focus {
    background-color: #FF4444;
    color: #FFFFFF;
    box-shadow: 0 6px 22px rgba(255, 68, 68, 0.35);
}

/* ============================================================= */
/* FOCUS VISIBLE — accesibilidad (teclado)                       */
/* ============================================================= */

.pmat-fm__link:focus-visible {
    outline: 3px solid #C4FF00;
    outline-offset: 2px;
}

/* ============================================================= */
/* RESPONSIVE — BOTTOM NAV BAR en mobile (<768px)                 */
/* ============================================================= */
/* En desktop/tablet se mantiene el sticky lateral derecho.       */
/* En mobile se transforma en una barra horizontal fija abajo.    */

@media (max-width: 767px) {
    /* Contenedor: barra horizontal fija al fondo del viewport */
    .pmat-fm {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        transform: none !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 8px 4px !important;
        margin: 0 !important;
        gap: 0 !important;
        flex-direction: row !important;
        justify-content: space-around !important;
        align-items: center !important;
        background-color: #071529 !important;
        border-top: 2px solid #C4FF00 !important;
        box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.25) !important;
        box-sizing: border-box !important;
        pointer-events: auto !important;
    }

    /* Admin bar adjustment NO aplica aqui (estamos abajo) */
    body.admin-bar .pmat-fm {
        top: auto !important;
    }

    /* Cada item: contenedor flex-column (icono arriba, label abajo) */
    .pmat-fm__item {
        flex: 1 1 0 !important;
        min-width: 0 !important;
        max-width: 120px !important;
    }

    /* Link: SIN expansion al tap — siempre muestra icon+label verticales */
    .pmat-fm__link {
        width: 100% !important;
        height: auto !important;
        padding: 6px 2px !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 2px !important;
        background-color: transparent !important;
        color: #C4FF00 !important;
        border-radius: 8px !important;
        box-shadow: none !important;
        overflow: visible !important;
        white-space: normal !important;
        transform: none !important;
    }

    .pmat-fm__link:hover,
    .pmat-fm__link:focus,
    .pmat-fm__link:active {
        background-color: rgba(196, 255, 0, 0.12) !important;
        color: #C4FF00 !important;
        box-shadow: none !important;
        transform: none !important;
        width: 100% !important;
    }

    /* Icono: mas pequeno en mobile para que quepa con label */
    .pmat-fm__icon {
        flex: 0 0 auto !important;
        width: 28px !important;
        height: 28px !important;
        font-size: 18px !important;
    }

    .pmat-fm .pmat-fm__link .pmat-fm__icon > i,
    .pmat-fm .pmat-fm__link .pmat-fm__icon i.fa,
    .pmat-fm .pmat-fm__link .pmat-fm__icon i.fas,
    .pmat-fm .pmat-fm__link .pmat-fm__icon i.fa-solid {
        font-size: 18px !important;
        color: #C4FF00 !important;
    }

    /* Label: SIEMPRE visible en mobile — debajo del icono, muy pequeno */
    .pmat-fm__label {
        flex: 0 0 auto !important;
        opacity: 1 !important;
        transform: none !important;
        padding: 0 !important;
        font-size: 10px !important;
        font-weight: 700 !important;
        letter-spacing: 0.3px !important;
        line-height: 1.1 !important;
        text-transform: uppercase !important;
        text-align: center !important;
        color: #C4FF00 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        max-width: 100% !important;
    }

    /* Al tap/active en mobile: no cambiar color del texto */
    .pmat-fm__link:hover .pmat-fm__label,
    .pmat-fm__link:focus .pmat-fm__label,
    .pmat-fm__link:active .pmat-fm__label {
        color: #C4FF00 !important;
    }

    /* Item Salir distintivo con rojo */
    .pmat-fm__item--logout .pmat-fm__link:hover,
    .pmat-fm__item--logout .pmat-fm__link:focus,
    .pmat-fm__item--logout .pmat-fm__link:active {
        background-color: rgba(255, 68, 68, 0.15) !important;
    }
    .pmat-fm__item--logout .pmat-fm__icon,
    .pmat-fm__item--logout .pmat-fm__link .pmat-fm__icon > i,
    .pmat-fm__item--logout .pmat-fm__link .pmat-fm__icon i.fa,
    .pmat-fm__item--logout .pmat-fm__link .pmat-fm__icon i.fas,
    .pmat-fm__item--logout .pmat-fm__label {
        color: #FF6B6B !important;
    }

    /* Compensar altura: empujar el contenido del sitio hacia arriba
       para que la bottom nav no tape el footer */
    body {
        padding-bottom: 72px !important;
    }
    /* Si hay admin bar WP abajo, respetar */
    body.admin-bar {
        padding-bottom: 72px !important;
    }
}

/* ============================================================= */
/* PRINT — no imprimir                                           */
/* ============================================================= */

@media print {
    .pmat-fm {
        display: none !important;
    }
}

/* ============================================================= */
/* REDUCE MOTION — respetar preferencia accesibilidad            */
/* ============================================================= */

@media (prefers-reduced-motion: reduce) {
    .pmat-fm__link,
    .pmat-fm__label {
        transition: none !important;
    }
}
