/* SIREPA-i: instalación de la app en el login (QR en escritorio, botones en el celular) */

[hidden] { display: none !important; }

/* login.css pone «* { margin: 0 !important; padding: 0 !important }»: aquí márgenes y rellenos llevan !important */

/* Tarjeta con el QR en el panel derecho (solo pantallas grandes: el panel se oculta bajo 992px) */
.pwa-qr-card,
.pwa-qr-card * { box-sizing: border-box; }

.pwa-qr-card {
    display: flex;
    align-items: center;
    gap: 20px;
    width: 100%;
    max-width: 500px;
    margin: 36px auto 0 !important;
    padding: 18px 22px 18px 18px !important;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.97);
    color: #1f2d3d;
    text-align: left;
    box-shadow: 0 18px 40px rgba(8, 30, 70, 0.28), 0 0 0 1px rgba(255, 255, 255, 0.6) inset;
    position: relative;
    overflow: hidden;
    animation: pwa-qr-entrar 0.6s ease-out both;
}

/* Franja de color institucional a la izquierda */
.pwa-qr-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 5px;
    background: linear-gradient(180deg, #1363D0 0%, #0d4a9e 100%);
}

/* QR con margen blanco (zona de silencio) y esquinas de visor */
.pwa-qr-marco {
    position: relative;
    flex: 0 0 auto;
    padding: 10px !important;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 2px 10px rgba(15, 40, 80, 0.12);
    background-image:
        linear-gradient(#1363D0, #1363D0), linear-gradient(#1363D0, #1363D0),
        linear-gradient(#1363D0, #1363D0), linear-gradient(#1363D0, #1363D0),
        linear-gradient(#1363D0, #1363D0), linear-gradient(#1363D0, #1363D0),
        linear-gradient(#1363D0, #1363D0), linear-gradient(#1363D0, #1363D0);
    background-repeat: no-repeat;
    background-size: 18px 3px, 3px 18px, 18px 3px, 3px 18px, 18px 3px, 3px 18px, 18px 3px, 3px 18px;
    background-position: 0 0, 0 0, 100% 0, 100% 0, 0 100%, 0 100%, 100% 100%, 100% 100%;
}

.pwa-qr-marco img {
    display: block;
    width: 132px;
    height: 132px;
    border-radius: 4px;
}

/* Línea de escaneo */
.pwa-qr-escaneo {
    position: absolute;
    left: 10px;
    right: 10px;
    top: 10px;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(19, 99, 208, 0.85), transparent);
    box-shadow: 0 0 8px rgba(19, 99, 208, 0.6);
    animation: pwa-qr-escanear 2.8s ease-in-out infinite;
    pointer-events: none;
}

.pwa-qr-texto { flex: 1 1 auto; min-width: 0; }

.pwa-qr-etiqueta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px !important;
    border-radius: 20px;
    background: #e8f0fc;
    color: #0d4a9e;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.pwa-qr-titulo {
    margin: 8px 0 8px !important;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.25;
    color: #10294d;
}

.overlay .pwa-qr-pasos,
.pwa-qr-pasos {
    list-style: none;
    counter-reset: paso;
    margin: 0 0 12px !important;
    padding: 0 !important;
}

.pwa-qr-pasos li {
    counter-increment: paso;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 5px !important;
    font-size: 13.5px;
    line-height: 1.35;
    color: #3d4a5c;
    text-shadow: none;
}

.pwa-qr-pasos li::before {
    content: counter(paso);
    flex: 0 0 20px;
    height: 20px;
    border-radius: 50%;
    background: #1363D0;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
}

.pwa-qr-pasos b { color: #10294d; }

.pwa-qr-acciones {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 14px;
}

.pwa-qr-pc {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    border: 0;
    border-radius: 9px;
    background: #1363D0;
    color: #fff;
    padding: 8px 14px !important;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(19, 99, 208, 0.3);
}

.pwa-qr-pc:hover { background: #0d4a9e; }

.pwa-qr-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 600;
    color: #1363D0 !important;
    text-decoration: none;
}

.pwa-qr-link:hover { text-decoration: underline; }
.pwa-qr-link i { font-size: 11px; transition: transform 0.2s; }
.pwa-qr-link:hover i { transform: translateX(3px); }

.pwa-qr-pc:focus-visible,
.pwa-qr-link:focus-visible { outline: 3px solid #f5b400; outline-offset: 2px; }

@keyframes pwa-qr-escanear {
    0%, 100% { top: 10px; opacity: 0; }
    10%, 90% { opacity: 1; }
    50% { top: calc(100% - 12px); }
}

@keyframes pwa-qr-entrar {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: none; }
}

/* Pantallas de poca altura: QR algo más chico */
@media (max-height: 760px) {
    .pwa-qr-card { margin-top: 22px !important; padding: 14px 18px 14px 14px !important; }
    .pwa-qr-marco img { width: 108px; height: 108px; }
}

@media (prefers-reduced-motion: reduce) {
    .pwa-qr-card, .pwa-qr-escaneo { animation: none; }
    .pwa-qr-escaneo { display: none; }
}

/* Bloque bajo el formulario: solo en celular y tablet */
.pwa-login-movil {
    display: none;
    margin-top: 18px !important;
    text-align: center;
}

.pwa-btn-instalar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 48px;
    margin-bottom: 10px !important;
    border: 2px solid #1363D0;
    border-radius: 10px;
    background: #fff;
    color: #1363D0;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}

.pwa-link-ayuda {
    display: inline-block;
    padding: 10px 4px !important;
    font-size: 14px;
    color: #1363D0 !important;
    text-decoration: underline;
}

@media (max-width: 992px) {
    .pwa-login-movil { display: block; }
}

/* Evita el zoom automático de iOS al tocar los campos del login */
@media (max-width: 768px) {
    .login-form input,
    .login-form select { font-size: 16px !important; }
}

/* Login en celular: el formulario no debe salirse de la pantalla y la página debe poder desplazarse */
@media (max-width: 992px) {
    body.guest-page { overflow-x: hidden !important; overflow-y: auto !important; }
    body.guest-page #wrapper { overflow: visible !important; min-height: 100vh !important; min-height: 100dvh !important; }
    body.guest-page .left-section {
        min-width: 0 !important;
        width: 100% !important;
        overflow: visible !important;
        padding: calc(16px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom)) !important;
    }
    body.guest-page .login-container { max-width: min(380px, 100%) !important; }
    body.guest-page .login-form { padding: 22px 18px !important; }
}

/* ---------- Modal de instrucciones de instalación ---------- */
.pwa-modal,
.pwa-modal * { box-sizing: border-box; }

.pwa-modal {
    width: min(520px, calc(100vw - 32px));
    max-height: calc(100dvh - 32px);
    padding: 0 !important;
    margin: auto !important;
    border: 0;
    border-radius: 20px;
    background: #fff;
    color: #1f2d3d;
    text-align: left;
    box-shadow: 0 24px 60px rgba(8, 30, 70, 0.35);
    overflow: hidden;
    font-family: inherit;
}

.pwa-modal[open] {
    display: flex;
    flex-direction: column;
    animation: pwa-modal-entrar 0.25s ease-out;
}

.pwa-modal::backdrop { background: rgba(10, 25, 50, 0.55); backdrop-filter: blur(2px); }

.pwa-modal-cabecera {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 20px 20px 14px !important;
    background: linear-gradient(135deg, #1363D0 0%, #0d4a9e 100%);
    color: #fff;
}

.pwa-modal-cabecera img { flex: 0 0 44px; border-radius: 12px; background: #fff; }
.pwa-modal-titulo { margin: 0 0 2px !important; font-size: 18px; font-weight: 700; line-height: 1.25; color: #fff; }
.pwa-modal-cabecera p { margin: 0 !important; font-size: 13px; line-height: 1.4; color: rgba(255, 255, 255, 0.88); }

.pwa-modal-cerrar {
    margin-left: auto !important;
    flex: 0 0 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    font-size: 24px;
    line-height: 36px;
    cursor: pointer;
    align-self: flex-start;
}

.pwa-modal-cerrar:hover { background: rgba(255, 255, 255, 0.28); }

.pwa-modal-pestanas {
    display: flex;
    gap: 4px;
    padding: 10px 14px 0 !important;
    border-bottom: 1px solid #e3e8ef;
    background: #f7f9fc;
}

.pwa-modal-pestanas button {
    flex: 1;
    min-height: 44px;
    padding: 8px 6px !important;
    border: 0;
    border-bottom: 3px solid transparent;
    background: none;
    color: #5b6778;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.pwa-modal-pestanas button[aria-selected="true"] { color: #1363D0; border-bottom-color: #1363D0; }
.pwa-modal-pestanas button i { margin-right: 4px !important; }

.pwa-modal-cuerpo {
    padding: 18px 20px 6px !important;
    overflow-y: auto;
}

.pwa-modal-pasos {
    list-style: none;
    counter-reset: paso;
    margin: 0 !important;
    padding: 0 !important;
}

.pwa-modal-pasos li {
    counter-increment: paso;
    display: flex;
    gap: 12px;
    margin: 0 0 14px !important;
    font-size: 15px;
    line-height: 1.45;
    color: #3d4a5c;
}

.pwa-modal-pasos li::before {
    content: counter(paso);
    flex: 0 0 26px;
    height: 26px;
    border-radius: 50%;
    background: #e8f0fc;
    color: #1363D0;
    font-size: 13px;
    font-weight: 700;
    line-height: 26px;
    text-align: center;
}

.pwa-modal-pasos b { color: #10294d; }

.pwa-modal-instalar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 48px;
    margin: 0 0 16px !important;
    border: 0;
    border-radius: 12px;
    background: #1363D0;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 6px 14px rgba(19, 99, 208, 0.3);
}

.pwa-modal-instalar:hover { background: #0d4a9e; }

.pwa-modal-qr {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 0 0 16px !important;
    padding: 12px !important;
    border-radius: 14px;
    background: #f4f8fd;
}

/* QR arriba de las pestañas (solo en computadora) */
.pwa-modal-qr-arriba { margin: 14px 20px 4px !important; }
.pwa-modal-qr[hidden] { display: none !important; }

.pwa-modal-qr img { flex: 0 0 auto; padding: 6px !important; border-radius: 8px; background: #fff; }
.pwa-modal-qr p { margin: 0 !important; font-size: 13.5px; line-height: 1.45; color: #3d4a5c; }

.pwa-modal-pie {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 20px calc(14px + env(safe-area-inset-bottom)) !important;
    border-top: 1px solid #e3e8ef;
}

.pwa-modal-listo {
    min-height: 44px;
    padding: 0 22px !important;
    border: 0;
    border-radius: 10px;
    background: #10294d;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.pwa-modal button:focus-visible,
.pwa-modal a:focus-visible { outline: 3px solid #f5b400; outline-offset: 2px; }

@keyframes pwa-modal-entrar {
    from { opacity: 0; transform: translateY(16px) scale(0.98); }
    to { opacity: 1; transform: none; }
}

/* Celular: hoja que sube desde abajo */
@media (max-width: 575.98px) {
    .pwa-modal {
        width: 100vw;
        max-width: 100vw;
        max-height: 92dvh;
        margin: auto 0 0 !important;
        border-radius: 20px 20px 0 0;
    }
    .pwa-modal[open] { animation-name: pwa-modal-subir; }
    .pwa-modal-pestanas button { font-size: 12.5px; }
}

@keyframes pwa-modal-subir {
    from { transform: translateY(100%); }
    to { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    .pwa-modal[open] { animation: none; }
}

/* ---------- Casilla «Recibir avisos de mis papeletas» en el login ---------- */
.push-login {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 4px 0 14px !important;
    padding: 10px 12px !important;
    border-radius: 10px;
    background: #f4f8fd;
    border: 1px solid #d6e4fa;
    cursor: pointer;
    font-size: 14px;
    color: #10294d;
    text-align: left;
    line-height: 1.35;
}
.push-login[hidden] { display: none !important; }
.push-login input {
    flex: 0 0 20px;
    width: 20px;
    height: 20px;
    margin: 0 !important;
    accent-color: #1363D0;
    cursor: pointer;
}
.push-login i { color: #1363D0; margin-right: 4px !important; }
/* La plantilla esconde las casillas ([type=checkbox] fuera de pantalla): esta sí debe verse */
.push-login input[type="checkbox"] {
    position: static !important;
    left: auto !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}
.push-login input[type="checkbox"] + span::before,
.push-login input[type="checkbox"] + span::after { content: none !important; display: none !important; }
.push-login span { padding-left: 0 !important; }
