/* ── Ansara Auth Popup v2.2 ── */

body.aap-no-scroll { overflow: hidden !important; }

/* ── Overlay ──────────────────────────────────────── */
.aap-overlay {
    position: fixed;
    inset: 0;
    background: var(--aap-overlay, rgba(0,0,0,0.6));
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.28s ease, visibility 0.28s ease;
}
.aap-overlay.aap-active {
    opacity: 1;
    visibility: visible;
}

/* ── Popup base ───────────────────────────────────── */
.aap-popup {
    display: flex;
    width: 100%;
    background: var(--aap-popup-bg, #fff);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.28);
    font-family: var(--aap-font-family, inherit);
    font-size: var(--aap-font-size, 14px);
    color: var(--aap-text, #333);
    transform: scale(0.94) translateY(14px);
    transition: transform 0.32s cubic-bezier(0.34,1.15,0.64,1),
                opacity 0.22s ease;
    box-sizing: border-box;
}
.aap-popup *, .aap-popup *::before, .aap-popup *::after { box-sizing: border-box; }

.aap-overlay.aap-active .aap-popup {
    transform: scale(1) translateY(0);
}

/* Transición al salir (hacia izquierda → registro) */
.aap-popup.aap-leave-left {
    opacity: 0;
    transform: scale(0.97) translateX(-22px);
    pointer-events: none;
    transition: transform 0.26s ease-in, opacity 0.22s ease-in;
}
/* Transición al salir (hacia derecha → login) */
.aap-popup.aap-leave-right {
    opacity: 0;
    transform: scale(0.97) translateX(22px);
    pointer-events: none;
    transition: transform 0.26s ease-in, opacity 0.22s ease-in;
}
/* Entrada desde la derecha */
.aap-popup.aap-enter-right {
    opacity: 0;
    transform: scale(0.97) translateX(22px);
    transition: none;
}
/* Entrada desde la izquierda */
.aap-popup.aap-enter-left {
    opacity: 0;
    transform: scale(0.97) translateX(-22px);
    transition: none;
}

/* ── LOGIN popup: angosto ─────────────────────────── */
.aap-popup-login {
    max-width: 680px;
    min-height: 420px;
}

/* Panel decorativo izquierdo (login) */
.aap-popup-login .aap-side-panel {
    width: 42%;
    flex-shrink: 0;
    background: linear-gradient(145deg, var(--aap-grad1,#667eea), var(--aap-grad2,#764ba2));
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 24px;
    border-radius: 0;
}

/* ── REGISTRO popup: ancho dos columnas ───────────── */
.aap-popup-register {
    max-width: 900px;
    min-height: 400px;
}

/* Panel decorativo derecho (registro) */
.aap-popup-register .aap-side-panel {
    order: 2;
    width: 36%;
    flex-shrink: 0;
    background: linear-gradient(145deg, var(--aap-grad1,#667eea), var(--aap-grad2,#764ba2));
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 24px;
    border-radius: 0;
}
.aap-popup-register .aap-form-area { order: 1; }

/* ── Contenido panel lateral ──────────────────────── */
.aap-side-content {
    text-align: center;
    color: #fff;
    width: 100%;
}
.aap-side-content h2 {
    font-size: 1.5em;
    font-weight: 800;
    margin: 0 0 12px;
    line-height: 1.2;
}
.aap-side-content p {
    font-size: 0.85em;
    opacity: 0.9;
    margin: 0 0 24px;
    line-height: 1.5;
}
.aap-side-btn {
    background: transparent;
    color: #fff;
    border: 2px solid #fff;
    padding: 9px 22px;
    border-radius: 99px;
    font-size: 0.82em;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    transition: background 0.2s;
    font-family: var(--aap-font-family, inherit);
}
.aap-side-btn:hover { background: rgba(255,255,255,0.18); }

/* ── Área de formulario ───────────────────────────── */
.aap-form-area {
    flex: 1;
    padding: 32px 30px 28px;
    position: relative;
    overflow-y: auto;
    max-height: 90vh;
}

/* Botón cerrar */
.aap-close {
    position: absolute;
    top: 10px;
    right: 12px;
    background: none;
    border: none;
    font-size: 22px;
    color: #bbb;
    cursor: pointer;
    z-index: 5;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
}
.aap-close:hover { color: #555; background: #f0f0f0; }

/* Título */
.aap-form-title {
    font-size: 1.4em;
    font-weight: 800;
    color: var(--aap-text, #333);
    margin: 0 0 20px;
    text-align: center;
}

/* Grid dos columnas para registro */
.aap-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.aap-field { margin-bottom: 12px; }

/* Input wrap */
.aap-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.aap-icon {
    position: absolute;
    left: 10px;
    width: 15px;
    height: 15px;
    color: #bbb;
    pointer-events: none;
}
.aap-field input,
.aap-row .aap-field input {
    width: 100%;
    padding: 9px 12px 9px 34px;
    border: 1.5px solid var(--aap-input-border, #ddd);
    border-radius: var(--aap-radius, 8px);
    font-size: 13px;
    font-family: var(--aap-font-family, inherit);
    color: var(--aap-text, #333);
    background: #fff;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.aap-row .aap-field input { padding-left: 11px; }
.aap-field input:focus {
    border-color: var(--aap-btn-bg, #764ba2);
    box-shadow: 0 0 0 3px rgba(118,75,162,0.1);
}

/* Toggle contraseña */
.aap-toggle-pw {
    position: absolute;
    right: 9px;
    background: none;
    border: none;
    cursor: pointer;
    color: #bbb;
    padding: 0;
    display: flex;
    align-items: center;
    transition: color 0.15s;
}
.aap-toggle-pw:hover { color: #555; }

/* ── Medidor de fuerza ────────────────────────────── */
.aap-strength-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 5px;
}
.aap-strength-dots {
    display: flex;
    gap: 4px;
    flex: 1;
}
.aap-seg {
    flex: 1;
    height: 4px;
    border-radius: 99px;
    background: #e0e0e0;
    transition: background 0.3s;
    display: block;
}
.aap-strength-label {
    font-size: 11px;
    font-weight: 700;
    min-width: 42px;
    text-align: right;
    color: #aaa;
}

/* Match contraseñas */
.aap-match-msg {
    font-size: 11px;
    font-weight: 600;
    margin-top: 3px;
    display: block;
}
.aap-match-msg.ok { color: #27ae60; }
.aap-match-msg.no { color: #e74c3c; }

/* reCAPTCHA */
.aap-captcha-field {
    transform: scale(0.87);
    transform-origin: left center;
    margin-bottom: 0;
    margin-top: 2px;
}

/* Botón submit */
.aap-submit-btn {
    width: 100%;
    padding: 10px 16px;
    background: var(--aap-btn-bg, #764ba2);
    color: var(--aap-btn-text, #fff);
    border: none;
    border-radius: var(--aap-radius, 8px);
    font-size: 13px;
    font-weight: 700;
    font-family: var(--aap-font-family, inherit);
    cursor: pointer;
    transition: filter 0.2s, transform 0.1s;
    margin-top: 6px;
}
.aap-submit-btn:hover    { filter: brightness(1.1); }
.aap-submit-btn:active   { transform: scale(0.98); }
.aap-submit-btn:disabled { filter: grayscale(0.5); cursor: not-allowed; }

/* Mensajes */
.aap-msg {
    padding: 7px 12px;
    border-radius: var(--aap-radius, 8px);
    font-size: 12px;
    margin-bottom: 8px;
    font-weight: 600;
    text-align: center;
}
.aap-msg.success { background: #eafaf1; color: #1e8449; border: 1px solid #a9dfbf; }
.aap-msg.error   { background: #fdedec; color: #c0392b; border: 1px solid #f5b7b1; }

/* Link alternativo debajo del botón */
.aap-switch-link {
    text-align: center;
    font-size: 12px;
    color: #888;
    margin: 10px 0 0;
}
.aap-link-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--aap-btn-bg, #764ba2);
    font-size: inherit;
    font-family: inherit;
    font-weight: 600;
    padding: 0;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.aap-link-btn:hover { opacity: 0.75; }

/* ── Shortcode — texto enlace ─────────────────────── */
.aap-auth-links {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--aap-font-family, inherit);
    font-size: var(--aap-font-size, 14px);
}
.aap-text-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    font-family: inherit;
    font-size: inherit;
    font-weight: 500;
    padding: 0;
    transition: opacity 0.2s;
}
.aap-text-link:hover { opacity: 0.7; }
.aap-auth-sep { color: #bbb; font-weight: 300; user-select: none; }

/* ── Usuario logueado ─────────────────────────────── */
.aap-user-greeting {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: inherit;
    font-size: var(--aap-font-size, 14px);
    font-family: var(--aap-font-family, inherit);
    font-weight: 500;
    transition: opacity 0.2s;
}
.aap-user-greeting:hover { opacity: 0.75; }
.aap-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--aap-btn-bg, #764ba2);
}

/* ══════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════ */

/* Tablet (≤ 768px): panel lateral oculto, formulario full */
@media (max-width: 768px) {
    .aap-overlay { padding: 12px; align-items: flex-end; }

    .aap-popup {
        flex-direction: column;
        max-width: 100% !important;
        border-radius: 16px 16px 0 0;
        transform: translateY(30px) scale(0.98);
        max-height: 92vh;
    }
    .aap-overlay.aap-active .aap-popup {
        transform: translateY(0) scale(1);
    }

    /* Ocultar panel lateral en tablet/móvil, mostrar solo banner compacto */
    .aap-side-panel {
        order: 0 !important;
        width: 100% !important;
        min-height: 90px !important;
        padding: 18px 20px !important;
        border-radius: 0 !important;
        flex-direction: row;
        gap: 12px;
        justify-content: space-between;
        align-items: center;
    }
    .aap-side-content { text-align: left; }
    .aap-side-content h2 { font-size: 1.1em; margin: 0 0 2px; }
    .aap-side-content p  { display: none; }
    .aap-side-btn { margin: 0; white-space: nowrap; padding: 7px 16px; font-size: 0.78em; }

    .aap-form-area {
        order: 1 !important;
        padding: 24px 20px 20px;
        overflow-y: auto;
    }
    .aap-popup-register .aap-form-area { order: 1 !important; }

    /* Dos columnas de registro pasan a una */
    .aap-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .aap-captcha-field { transform: scale(0.82); transform-origin: left; }
}

/* Móvil pequeño (≤ 480px): ajustes extra */
@media (max-width: 480px) {
    .aap-overlay { padding: 8px; }
    .aap-form-area { padding: 20px 16px 18px; }
    .aap-side-panel { min-height: 76px !important; padding: 14px 16px !important; }
    .aap-side-content h2 { font-size: 1em; }
    .aap-form-title { font-size: 1.2em; margin-bottom: 14px; }
    .aap-submit-btn { padding: 11px 14px; }
}
