/*
 * inicio.css — Pantalla de login (marca MRA).
 * Azul eléctrico + amarillo campaña, logo horizontal oficial.
 */

:root {
    --auth-navy: #071b3d;
    --auth-navy-2: #0c2d5c;
    --auth-azul: #0066ff;
    --auth-amar: #ffd000;
    --auth-amar-2: #ffeb33;
    --auth-bg: #e8f0fc;
    --auth-card: #ffffff;
    --auth-text: #0f172a;
    --auth-muted: #64748b;
    --auth-border: #c5d7ef;
    --auth-error-bg: #fdecea;
    --auth-error-fg: #b3261e;
    --auth-error-bd: #f5c6c4;
    --auth-radius: 14px;
    --auth-shadow: 0 18px 38px rgba(0, 61, 153, 0.18);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

.auth-body {
    margin: 0;
    font-family: var(--font-text, "Segoe UI", system-ui, -apple-system, sans-serif);
    font-weight: 500;
    background:
        radial-gradient(at 20% 15%, rgba(255, 215, 0, 0.2), transparent 50%),
        radial-gradient(at 100% 80%, rgba(0, 102, 255, 0.12), transparent 45%),
        var(--auth-bg);
    min-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--auth-text);
    padding: 1.25rem;
}

.auth-shell {
    width: min(960px, 100%);
    background: var(--auth-card);
    border-radius: var(--auth-radius);
    overflow: hidden;
    box-shadow: var(--auth-shadow);
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    min-height: min(620px, 90vh);
}

/* ============== Lado izquierdo: marca MRA ============== */
.auth-brand {
    background: linear-gradient(145deg, #003d99 0%, #0052cc 40%, #0066ff 100%);
    color: #ffffff;
    padding: 2rem 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: relative;
}

.auth-brand::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 75% 25%, rgba(255, 235, 51, 0.12) 0 2px, transparent 3px),
        radial-gradient(circle at 30% 75%, rgba(255, 255, 255, 0.06) 0 2px, transparent 3px);
    pointer-events: none;
}

.auth-brand__lockup {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 1rem;
    z-index: 1;
    position: relative;
}

.auth-brand__mra-wrap {
    flex: 1;
    min-width: 0;
    background: #ffffff;
    border-radius: 12px;
    padding: 10px 14px;
    border: 1px solid rgba(255, 255, 255, 0.65);
    box-shadow: 0 10px 28px rgba(0, 26, 80, 0.22);
}

.auth-brand__mra-logo {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: 96px;
    object-fit: contain;
    object-position: left center;
    background: #ffffff;
}

.auth-brand__candidata-photo {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    object-position: center top;
    border: 3px solid var(--auth-amar);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
    background: #ffffff;
    flex-shrink: 0;
}

.auth-brand__top {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.94);
    border-radius: 12px;
    padding: 8px 14px;
    width: fit-content;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.18);
    border: 2px solid var(--auth-amar);
    z-index: 1;
}

.auth-brand__logo svg {
    width: 50px;
    height: 80px;
    display: block;
}

.auth-brand__sijpr-mark {
    display: block;
    width: 56px;
    height: 56px;
    object-fit: contain;
    border-radius: 12px;
}

.auth-brand__l {
    font-family: "Georgia", "Times New Roman", serif;
    font-weight: 800;
}

.auth-brand__l--white { fill: var(--auth-navy); font-size: 30px; }
.auth-brand__l--gold {
    fill: var(--auth-amar);
    font-size: 42px;
    font-style: italic;
    paint-order: stroke;
    stroke: rgba(31, 58, 95, 0.22);
    stroke-width: 0.8;
}

.auth-brand__photo {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    object-fit: cover;
    object-position: center top;
    border: 3px solid var(--auth-amar);
    background: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.auth-brand__copy {
    z-index: 1;
}

.auth-brand__system {
    margin: 0 0 0.4rem;
    font-size: clamp(0.8rem, 1.1vw + 0.55rem, 0.95rem);
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1.35;
    color: var(--auth-amar-2);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.auth-brand__system-abbr {
    font-weight: 800;
    white-space: nowrap;
}

.auth-brand__title {
    margin: 0 0 0.35rem;
    font-family: var(--font-display, "Segoe UI", system-ui, sans-serif);
    font-size: clamp(1.35rem, 2vw + 0.85rem, 1.95rem);
    font-weight: 800;
    letter-spacing: -0.015em;
    line-height: 1.15;
    color: #ffffff;
    text-shadow: 0 1px 3px rgba(0, 20, 60, 0.35);
}

.auth-brand__subtitle {
    margin: 0 0 0.35rem;
    color: var(--auth-amar-2);
    font-family: var(--font-text, "Segoe UI", system-ui, sans-serif);
    font-size: clamp(0.95rem, 1vw + 0.65rem, 1.05rem);
    font-style: italic;
    font-weight: 600;
    line-height: 1.35;
}

.auth-brand__lema {
    margin: 0 0 0.85rem;
    font-size: 1.02rem;
    font-weight: 700;
    font-style: italic;
    color: rgba(255, 255, 255, 0.92);
    letter-spacing: 0.04em;
}

.auth-brand__tagline {
    margin: 0;
    color: rgba(255, 255, 255, 0.88);
    font-family: var(--font-text, "Segoe UI", system-ui, sans-serif);
    font-weight: 500;
    font-size: 0.92rem;
    line-height: 1.5;
}

.auth-brand__tagline strong {
    color: #ffffff;
}

.auth-brand__features {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.5rem;
    z-index: 1;
}

.auth-brand__features li {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-family: var(--font-text, "Segoe UI", system-ui, sans-serif);
    font-weight: 500;
    font-size: 0.88rem;
    color: rgba(255, 255, 255, 0.92);
}

.auth-brand__features li span {
    background: rgba(255, 255, 255, 0.12);
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 0.95rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Audio login: solo el botón 🎵 visible; el panel aparece con transición al hacer clic */
.auth-audio-widget {
    position: fixed;
    z-index: 2000;
    right: max(1rem, env(safe-area-inset-right, 0px));
    bottom: max(1rem, env(safe-area-inset-bottom, 0px));
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0;
    pointer-events: none;
}

.auth-audio-widget > * {
    pointer-events: auto;
}

.auth-audio-panel {
    width: min(288px, calc(100vw - 2.5rem));
    margin-bottom: 0.65rem;
    padding: 0.9rem 1.05rem;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.97);
    color: var(--auth-navy);
    border: 1px solid rgba(197, 215, 239, 0.95);
    box-shadow:
        0 4px 6px rgba(15, 23, 42, 0.04),
        0 18px 40px rgba(0, 61, 153, 0.14);
    font-family: var(--font-text, "Segoe UI", system-ui, sans-serif);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);

    opacity: 0;
    visibility: hidden;
    transform: translateY(10px) scale(0.96);
    max-height: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
    padding-left: 0;
    padding-right: 0;
    overflow: hidden;
    border-color: transparent;
    box-shadow: none;
    pointer-events: none;
    transition:
        opacity 0.22s ease,
        transform 0.24s cubic-bezier(0.34, 1.2, 0.64, 1),
        max-height 0.28s ease,
        padding 0.24s ease,
        margin 0.24s ease,
        visibility 0.24s,
        border-color 0.2s ease,
        box-shadow 0.24s ease;
}

.auth-audio-widget--open .auth-audio-panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    max-height: 320px;
    margin-bottom: 0.65rem;
    padding: 0.9rem 1.05rem;
    border-color: rgba(197, 215, 239, 0.95);
    box-shadow:
        0 4px 6px rgba(15, 23, 42, 0.04),
        0 18px 40px rgba(0, 61, 153, 0.14);
    pointer-events: auto;
}

.auth-audio-panel__title {
    margin: 0 0 0.75rem;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--auth-azul);
}

.auth-audio-panel__actions {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.auth-audio-panel__btn {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    width: 100%;
    padding: 0.52rem 0.7rem;
    border-radius: 10px;
    border: 1px solid #c5d7ef;
    background: #f0f5ff;
    color: var(--auth-navy);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}

.auth-audio-panel__btn:hover {
    background: #e2ebfb;
    border-color: #a8c0ea;
}

.auth-audio-panel__btn:active {
    transform: scale(0.99);
}

.auth-audio-panel__btn:focus-visible {
    outline: 2px solid var(--auth-azul);
    outline-offset: 2px;
}

.auth-audio-panel__btn-ic {
    flex-shrink: 0;
    width: 1.35rem;
    text-align: center;
    font-size: 1.05rem;
    line-height: 1;
}

.auth-audio-fab {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.65);
    background: linear-gradient(145deg, #0052cc 0%, #0066ff 55%, #3d8fff 100%);
    color: #fff;
    font-size: 1.28rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 2px 8px rgba(0, 61, 153, 0.25),
        0 10px 24px rgba(0, 45, 120, 0.22);
    transition: transform 0.2s cubic-bezier(0.34, 1.2, 0.64, 1), filter 0.15s ease, box-shadow 0.2s ease;
}

.auth-audio-fab:hover {
    filter: brightness(1.05);
    transform: scale(1.05);
    box-shadow:
        0 4px 12px rgba(0, 61, 153, 0.3),
        0 14px 32px rgba(0, 45, 120, 0.26);
}

.auth-audio-fab:focus-visible {
    outline: 3px solid var(--auth-amar-2);
    outline-offset: 3px;
}

.auth-audio-widget--open .auth-audio-fab {
    box-shadow:
        0 0 0 3px rgba(255, 208, 0, 0.45),
        0 10px 24px rgba(0, 45, 120, 0.28);
}

/* Autoplay bloqueado (típico en móvil): indica que un toque activa el audio */
.auth-audio-fab--needs-gesture {
    animation: auth-audio-fab-pulse 1.65s ease-in-out infinite;
    box-shadow:
        0 0 0 3px rgba(255, 208, 0, 0.6),
        0 10px 28px rgba(0, 45, 120, 0.3);
}

@keyframes auth-audio-fab-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.07); }
}

@media (max-width: 480px) {
    .auth-audio-fab {
        width: 46px;
        height: 46px;
        font-size: 1.15rem;
    }
    .auth-audio-widget--open .auth-audio-panel {
        width: min(260px, calc(100vw - 1.75rem));
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-audio-panel,
    .auth-audio-fab,
    .auth-audio-panel__btn {
        transition: none;
    }
    .auth-audio-panel,
    .auth-audio-widget--open .auth-audio-panel {
        transform: none;
    }
    .auth-audio-panel__btn:active {
        transform: none;
    }
    .auth-audio-fab--needs-gesture {
        animation: none;
    }
}

.auth-brand__copyright {
    margin-top: auto;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.75rem;
    z-index: 1;
}

/* ============== Lado derecho: tarjeta de formulario ============== */
.auth-card {
    padding: 2.5rem 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1.25rem;
    background: var(--auth-card);
}

.auth-card__head {
    text-align: left;
}

.auth-card__title {
    margin: 0 0 0.4rem;
    color: var(--auth-navy);
    font-family: var(--font-display, "Segoe UI", system-ui, sans-serif);
    font-size: clamp(1.35rem, 1vw + 1rem, 1.75rem);
    font-weight: 800;
    letter-spacing: -0.01em;
}

.auth-card__title::after {
    content: "";
    display: block;
    width: 48px;
    height: 4px;
    background: var(--auth-amar);
    border-radius: 99px;
    margin-top: 0.5rem;
}

.auth-card__subtitle {
    margin: 0;
    color: var(--auth-muted);
    font-family: var(--font-text, "Segoe UI", system-ui, sans-serif);
    font-weight: 500;
    font-size: 0.95rem;
}

.auth-alert {
    display: flex;
    gap: 0.6rem;
    align-items: flex-start;
    background: var(--auth-error-bg);
    border: 1px solid var(--auth-error-bd);
    color: var(--auth-error-fg);
    border-left: 4px solid var(--auth-error-fg);
    padding: 0.7rem 0.85rem;
    border-radius: 8px;
    font-size: 0.9rem;
    animation: auth-shake 0.45s ease;
}

@keyframes auth-shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-3px); }
    80% { transform: translateX(3px); }
}

.auth-alert__icon {
    width: 22px;
    height: 22px;
    background: var(--auth-error-fg);
    color: #ffffff;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    flex-shrink: 0;
    font-size: 0.85rem;
}

/* ============== Form & Inputs ============== */
.auth-form {
    display: grid;
    gap: 1rem;
}

.auth-field__label {
    display: block;
    margin-bottom: 0.35rem;
    color: var(--auth-navy);
    font-family: var(--font-text, "Segoe UI", system-ui, sans-serif);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.auth-field__wrap {
    display: flex;
    align-items: center;
    background: #fff;
    border: 1.5px solid var(--auth-border);
    border-radius: 10px;
    padding: 0.1rem 0.7rem;
    transition: border-color 0.18s, box-shadow 0.18s;
}

.auth-field__wrap:focus-within {
    border-color: var(--auth-azul);
    box-shadow: 0 0 0 4px rgba(0, 102, 255, 0.2);
}

.auth-field__icon {
    font-size: 1rem;
    color: var(--auth-muted);
    margin-right: 0.5rem;
    flex-shrink: 0;
}

.auth-field__input {
    flex: 1;
    border: 0;
    outline: none;
    background: transparent;
    color: var(--auth-text);
    font-size: 0.98rem;
    padding: 0.7rem 0;
    font-family: inherit;
    min-width: 0;
}

.auth-field__input::placeholder {
    color: #9aa0a6;
}

.auth-field__toggle {
    background: transparent;
    border: 0;
    cursor: pointer;
    padding: 0.25rem 0.35rem;
    color: var(--auth-muted);
    font-size: 1rem;
    border-radius: 6px;
    flex-shrink: 0;
}

.auth-field__toggle:hover { background: rgba(0, 0, 0, 0.05); }

.auth-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.85rem;
}

.auth-check {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--auth-muted);
    cursor: pointer;
    user-select: none;
}

.auth-check input {
    accent-color: var(--auth-azul);
    width: 16px;
    height: 16px;
}

.auth-link {
    color: var(--auth-azul);
    font-weight: 600;
    text-decoration: none;
}
.auth-link:hover { text-decoration: underline; }

/* ============== Botón principal ============== */
.auth-btn {
    position: relative;
    margin-top: 0.5rem;
    background: linear-gradient(135deg, #0052cc 0%, #0066ff 100%);
    color: #fff;
    font-family: var(--font-display, "Segoe UI", system-ui, sans-serif);
    font-weight: 800;
    font-size: 1rem;
    letter-spacing: 0.04em;
    padding: 0.9rem 1rem;
    border: 0;
    border-radius: 10px;
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.15s ease, box-shadow 0.18s ease, filter 0.15s ease;
    box-shadow: 0 6px 18px rgba(0, 82, 204, 0.4);
}

.auth-btn:hover { filter: brightness(1.05); transform: translateY(-1px); }
.auth-btn:active { transform: translateY(0); }
.auth-btn:focus-visible {
    outline: 3px solid var(--auth-amar);
    outline-offset: 2px;
}

.auth-btn::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent 0%, rgba(255, 255, 255, 0.18) 50%, transparent 100%);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}
.auth-btn:hover::before { transform: translateX(100%); }

.auth-btn__spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #ffffff;
    border-radius: 50%;
    margin-left: 0.5rem;
    animation: auth-spin 0.7s linear infinite;
    vertical-align: middle;
}

@keyframes auth-spin { to { transform: rotate(360deg); } }

.auth-btn.is-loading {
    cursor: wait;
    opacity: 0.92;
}

.auth-btn.is-loading .auth-btn__spinner { display: inline-block; }

.auth-help {
    margin: 0;
    font-size: 0.85rem;
    color: var(--auth-muted);
    text-align: center;
}

.auth-card__foot {
    text-align: center;
    color: var(--auth-muted);
    font-size: 0.78rem;
    margin-top: 0.5rem;
}

/* ============== Responsive ============== */
@media (max-width: 880px) {
    /*
     * Móvil / tablet: no centrar el bloque en vertical (recortaba la parte superior
     * cuando marca + formulario superan la altura útil de la ventana).
     */
    .auth-body {
        align-items: flex-start;
        justify-content: flex-start;
        padding-top: max(1rem, env(safe-area-inset-top, 0px));
        padding-right: max(1rem, env(safe-area-inset-right, 0px));
        padding-bottom: max(1.25rem, env(safe-area-inset-bottom, 0px));
        padding-left: max(1rem, env(safe-area-inset-left, 0px));
        min-height: 100vh;
        min-height: 100dvh;
    }

    .auth-shell {
        grid-template-columns: 1fr;
        min-height: auto;
        overflow: visible;
        width: 100%;
        max-width: 100%;
    }

    .auth-brand {
        padding: 1.25rem 1rem 1.5rem;
        gap: 1rem;
        text-align: left;
        overflow: visible;
        min-width: 0;
    }

    .auth-brand__lockup {
        flex-wrap: wrap;
        justify-content: center;
        text-align: center;
    }

    .auth-brand__mra-wrap {
        flex: 1 1 100%;
        max-width: 100%;
        padding: 8px 12px;
    }

    .auth-brand__mra-logo {
        max-height: 88px;
        margin: 0 auto;
        object-position: center;
    }

    .auth-brand__candidata-photo {
        width: 88px;
        height: 88px;
    }

    .auth-brand__features { display: none; }
    .auth-brand__copyright { display: none; }

    .auth-brand__title {
        font-size: clamp(1.15rem, 4vw, 1.5rem);
    }
    .auth-brand__tagline {
        font-size: 0.85rem;
    }

    .auth-card {
        padding: 1.5rem 1.25rem 1.75rem;
    }
}

@media (max-width: 480px) {
    .auth-body {
        padding-top: max(0.5rem, env(safe-area-inset-top, 0px));
        padding-left: max(0.75rem, env(safe-area-inset-left, 0px));
        padding-right: max(0.75rem, env(safe-area-inset-right, 0px));
        padding-bottom: max(0.75rem, env(safe-area-inset-bottom, 0px));
    }
    .auth-shell {
        border-radius: 0;
        box-shadow: none;
        min-height: auto;
    }
    .auth-brand__top {
        padding: 6px 10px;
        gap: 0.55rem;
    }
    .auth-brand__sijpr-mark { width: 44px; height: 44px; }

    .auth-brand__mra-wrap {
        border-radius: 10px;
        padding: 8px 10px;
    }

    .auth-brand__mra-logo {
        max-height: 76px;
    }

    .auth-brand__candidata-photo {
        width: 80px;
        height: 80px;
        border-width: 2px;
    }
    .auth-brand__photo { width: 56px; height: 56px; border-width: 2px; }
    .auth-brand__title {
        font-size: clamp(1.05rem, 4.5vw, 1.4rem);
    }
    .auth-card__title { font-size: 1.25rem; }
    .auth-row { font-size: 0.8rem; }
    .auth-field__input { font-size: 0.92rem; padding: 0.6rem 0; }
}
