/* ==========================================================================
   FlowLatin - Componentes comunes (Fase 3)
   Se carga el ÚLTIMO. Usa los tokens de tokens.css.
   1. Base y tipografía      5. Formularios (acceso, PMS, Profile Builder)
   2. Botones (.fl-btn)      6. Aviso de cookies
   3. Foco visible           7. Reproductor fijo (sticky) responsive
   4. Contraste              8. Movimiento reducido
   ========================================================================== */

/* Alias para el plugin de registro (su form.css define su propia paleta) */
:root {
    --flr-border-focus: var(--fl-red-text);
    --flr-primary: var(--fl-red);
    --flr-primary-hover: var(--fl-red-hover);
    --flr-primary-dark: var(--fl-red-press);
    --flr-error: var(--fl-error);
    --flr-text-muted: var(--fl-text-muted);
    --flr-text-subtle: var(--fl-text-muted);
}

/* 1. BASE Y TIPOGRAFÍA ---------------------------------------------------- */
body,
button,
input,
select,
textarea {
    font-family: var(--fl-font-sans);
}

/* Componentes que pedían 'Outfit' (nunca se cargaba): misma familia que el resto */
#fl-sticky-pro-player,
.fl-sticky-content,
.fl-contact-hub,
.fl-top-container {
    font-family: var(--fl-font-sans) !important;
}

body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* 2. BOTONES -------------------------------------------------------------- */
.fl-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--fl-space-2);
    min-height: 44px;                 /* objetivo táctil mínimo */
    padding: 0 var(--fl-space-5);
    border: 1px solid transparent;
    border-radius: var(--fl-radius);
    font-family: var(--fl-font-sans);
    font-size: var(--fl-text-sm);
    font-weight: 800;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    text-decoration: none !important;
    line-height: 1;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.fl-btn:active { transform: translateY(1px); }

.fl-btn--primary,
.fl-btn:not(.fl-btn--gold):not(.fl-btn--ghost) {
    background: var(--fl-red);
    color: #fff !important;
}
.fl-btn--primary:hover,
.fl-btn:not(.fl-btn--gold):not(.fl-btn--ghost):hover {
    background: var(--fl-red-hover);
    box-shadow: 0 6px 20px var(--fl-red-glow);
}

.fl-btn--gold {
    background: var(--fl-gold);
    color: #111 !important;
}
.fl-btn--gold:hover { background: var(--fl-gold-hover); }

.fl-btn--ghost {
    background: transparent;
    border-color: var(--fl-border-strong);
    color: var(--fl-text) !important;
}
.fl-btn--ghost:hover {
    border-color: var(--fl-text);
    background: rgba(255, 255, 255, 0.06);
}

/* Botones de formularios de terceros con el mismo aspecto que .fl-btn--primary */
#pms_login #wp-submit,
.pms-form input[type="submit"],
.pms-form button[type="submit"],
.wppb-user-forms input[type="submit"],
.wppb-user-forms button[type="submit"],
#wppb-login-wrap input[type="submit"],
.fl-submit-btn {
    min-height: 44px;
    padding: 0 var(--fl-space-5) !important;
    border: 0 !important;
    border-radius: var(--fl-radius) !important;
    background: var(--fl-red) !important;
    background-image: none !important;
    color: #fff !important;
    font-family: var(--fl-font-sans) !important;
    font-weight: 800 !important;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background-color .15s ease, box-shadow .15s ease;
}
#pms_login #wp-submit:hover,
.pms-form input[type="submit"]:hover,
.pms-form button[type="submit"]:hover,
.wppb-user-forms input[type="submit"]:hover,
#wppb-login-wrap input[type="submit"]:hover,
.fl-submit-btn:hover {
    background: var(--fl-red-hover) !important;
    box-shadow: 0 6px 20px var(--fl-red-glow);
}

/* 3. FOCO VISIBLE (navegación con teclado) --------------------------------
   Antes no había ningún :focus-visible y varios formularios quitaban el outline. */
a:focus-visible,
button:focus-visible,
[role="button"]:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
.fl-custom-play-btn:focus-visible,
.fl-download-link:focus-visible {
    outline: 2px solid var(--fl-red-text) !important;
    outline-offset: 2px !important;
    box-shadow: var(--fl-focus-ring) !important;
}

/* 4. CONTRASTE ------------------------------------------------------------
   Grises #555/#666 sobre fondo casi negro no llegan a AA: se suben a --fl-text-muted. */
.fl-custom-audioplayer .sr-playlist-cf-child,
.fl-custom-audioplayer .fl-header-row,
.fl-custom-audioplayer .tracklist-item-title div,
.fl-home-track-artist,
.fl-track-artist,
.fl-bd-month,
.fl-bd-year,
.fl-v5-legal-links,
.fl-v5-legal-links a {
    color: var(--fl-text-muted) !important;
}

/* 5. FORMULARIOS (acceso /acceso, PMS, Profile Builder) -------------------- */
#pms_login,
.pms-form,
.wppb-user-forms {
    background: var(--fl-surface-1) !important;
    border: 1px solid var(--fl-border) !important;
    border-radius: var(--fl-radius-lg) !important;
    box-shadow: var(--fl-shadow) !important;
    color: var(--fl-text);
}

#pms_login label,
.pms-form label,
.wppb-user-forms label {
    color: var(--fl-text-2) !important;
    font-size: var(--fl-text-sm) !important;
    font-weight: 600;
}

#pms_login input[type="text"],
#pms_login input[type="password"],
#pms_login input[type="email"],
.pms-form input[type="text"],
.pms-form input[type="email"],
.pms-form input[type="password"],
.pms-form input[type="tel"],
.pms-form select,
.wppb-user-forms input[type="text"],
.wppb-user-forms input[type="email"],
.wppb-user-forms input[type="password"],
.wppb-user-forms select,
.wppb-user-forms textarea {
    width: 100%;
    min-height: 44px;
    padding: 10px 14px !important;
    background: var(--fl-surface-0) !important;
    border: 1px solid var(--fl-border-strong) !important;
    border-radius: var(--fl-radius) !important;
    color: var(--fl-text) !important;
    font-size: var(--fl-text-base) !important;   /* 16px: evita el zoom automático en iOS */
    transition: border-color .15s ease, box-shadow .15s ease;
}
#pms_login input:focus,
.pms-form input:focus,
.pms-form select:focus,
.wppb-user-forms input:focus,
.wppb-user-forms select:focus,
.wppb-user-forms textarea:focus {
    border-color: var(--fl-red-text) !important;
    box-shadow: var(--fl-focus-ring) !important;
    outline: none;
}

#pms_login a,
.pms-form a,
.wppb-user-forms a {
    color: var(--fl-red-text) !important;
}

.pms-form .pms-subscription-plan,
.pms-subscription-plan {
    background: var(--fl-surface-2);
    border: 1px solid var(--fl-border);
    border-radius: var(--fl-radius);
}

/* Mensajes */
.pms_success-messages-wrapper,
.wppb-success {
    background: rgba(16, 185, 129, 0.12) !important;
    border: 1px solid rgba(16, 185, 129, 0.4) !important;
    color: #a7f3d0 !important;
    border-radius: var(--fl-radius) !important;
}
.pms_field-errors-wrapper,
.pms-form .pms_field-errors-wrapper p,
.wppb-error {
    background: var(--fl-red-soft) !important;
    border: 1px solid rgba(255, 77, 77, 0.4) !important;
    color: #ffc9c9 !important;
    border-radius: var(--fl-radius) !important;
}

/* 6. AVISO DE COOKIES ------------------------------------------------------ */
.fl-v5-hub {
    background: rgba(18, 18, 22, 0.98) !important;
    border: 1px solid var(--fl-border) !important;
    border-radius: var(--fl-radius-lg) !important;
    z-index: var(--fl-z-modal) !important;
}
.fl-v5-btn {
    min-height: 40px;
    border-radius: var(--fl-radius) !important;
    font-family: var(--fl-font-sans) !important;
    font-weight: 700 !important;
}
.fl-v5-btn.primary {
    background: var(--fl-red) !important;
    border-color: var(--fl-red) !important;
    color: #fff !important;
}
.fl-v5-btn.primary:hover { background: var(--fl-red-hover) !important; }

/* En móvil ocupaba un tercio de la pantalla: versión compacta en la parte inferior */
@media (max-width: 600px) {
    .fl-v5-hub {
        left: 8px !important;
        right: 8px !important;
        bottom: 8px !important;
        padding: 14px 14px 12px !important;
        max-height: 70vh;
        overflow-y: auto;
    }
    .fl-v5-hub h3,
    .fl-v5-text h3,
    .fl-v5-text strong:first-child {
        font-size: 15px !important;
        margin: 0 0 4px !important;
    }
    .fl-v5-text p {
        font-size: 13px !important;
        line-height: 1.4 !important;
        margin: 0 0 6px !important;
    }
    .fl-v5-legal-links {
        margin-bottom: 8px !important;
    }
    /* Los tres botones en una sola fila */
    .fl-v5-btns {
        display: grid !important;
        grid-template-columns: 1.2fr 1fr 1.2fr;
        gap: 6px !important;
        margin-top: 8px !important;
    }
    .fl-v5-btns .fl-v5-btn {
        min-height: 40px !important;
        padding: 6px 6px !important;
        font-size: 12px !important;
        white-space: normal !important;
        line-height: 1.15 !important;
    }
}

/* 6b. SLIDER DE LA HOME EN MÓVIL --------------------------------------------
   Las imágenes son 1920x400 (4,8:1) y el contenedor tenía altura fija: en móvil
   quedaban 78 px de imagen y 130 px de negro. Ahora la altura sigue a la imagen. */
@media (max-width: 768px) {
    .home-welcome-slider,
    .home-welcome-slider .swiper-wrapper,
    .home-welcome-slider .swiper-slide {
        height: auto !important;
    }
    /* home-slider.css forzaba 16:9 en móvil con imágenes 4,8:1 */
    .home-welcome-slider {
        aspect-ratio: auto !important;
    }
    .home-welcome-slider .swiper-slide img {
        width: 100% !important;
        height: auto !important;
        object-fit: cover !important;
    }
}

/* 7. REPRODUCTOR FIJO (STICKY) --------------------------------------------- */
/* z-index máximo (2147483647) tapaba modales y el aviso de cookies */
#fl-sticky-pro-player {
    z-index: var(--fl-z-sticky-player) !important;
}

/* Que el reproductor no tape el final de la página */
body:has(#fl-sticky-pro-player.active) {
    padding-bottom: 102px;
}

/* El botón flotante de contacto tapaba el play del reproductor: subirlo */
#fl-contact-hub-btn {
    transition: bottom .3s ease;
}
body:has(#fl-sticky-pro-player.active) #fl-contact-hub-btn {
    bottom: 118px !important;
}

@media (max-width: 768px) {
    #fl-sticky-pro-player {
        height: 84px !important;
    }
    body:has(#fl-sticky-pro-player.active) {
        padding-bottom: 84px;
    }
    body:has(#fl-sticky-pro-player.active) #fl-contact-hub-btn {
        bottom: 96px !important;
    }
    #fl-sticky-pro-player .fl-sticky-ui-layer {
        padding: 0 12px !important;
        gap: 10px;
    }
    #fl-sticky-pro-player .fl-sticky-info {
        min-width: 0 !important;
        flex: 1 1 auto;
        gap: 10px !important;
    }
    #fl-sticky-pro-player .fl-sticky-thumb {
        width: 40px !important;
        height: 40px !important;
        flex-shrink: 0;
    }
    #fl-sticky-pro-player .fl-sticky-meta {
        min-width: 0;
        overflow: hidden;
    }
    #fl-sticky-pro-player .fl-sticky-title,
    #fl-sticky-pro-player .fl-sticky-artist {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }
    #fl-sticky-pro-player .fl-sticky-title { font-size: 14px !important; }
    #fl-sticky-pro-player .fl-sticky-artist { font-size: 12px !important; }
    /* El mezclador no cabe en móvil */
    #fl-sticky-pro-player .fl-sticky-mixer-rack {
        display: none !important;
    }
    #fl-sticky-pro-player .fl-sticky-btn {
        min-width: 44px;
        min-height: 44px;
    }
}

/* 8. MOVIMIENTO REDUCIDO --------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    .category-lottie-bg { display: none !important; }
}
