/**
 * PWA: splash tipo vidrio (glassmorphism) + barra sugerencia de instalación.
 */
#atr-pwa-splash {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(16px, 5vw, 48px);
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.45s ease, visibility 0.45s ease;
}

#atr-pwa-splash[hidden] {
    display: none !important;
}

#atr-pwa-splash.atr-pwa-splash--show {
    opacity: 1;
    visibility: visible;
}

#atr-pwa-splash.atr-pwa-splash--hide {
    opacity: 0;
    pointer-events: none;
}

.atr-pwa-splash__bg {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 120% 80% at 20% 20%, rgba(0, 96, 171, 0.45) 0%, transparent 55%),
        radial-gradient(ellipse 100% 70% at 85% 75%, rgba(59, 130, 246, 0.35) 0%, transparent 50%),
        radial-gradient(circle at 50% 100%, rgba(15, 23, 42, 0.85) 0%, #0f172a 100%);
    overflow: hidden;
}

.atr-pwa-splash__bg::after {
    content: "";
    position: absolute;
    inset: -20%;
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.06'/%3E%3C/svg%3E");
    opacity: 0.4;
    mix-blend-mode: overlay;
}

.atr-pwa-splash__orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.5;
    animation: atr-pwa-float 8s ease-in-out infinite;
}

.atr-pwa-splash__orb--1 {
    width: min(60vw, 320px);
    height: min(60vw, 320px);
    background: #3b82f6;
    top: 10%;
    right: -5%;
}

.atr-pwa-splash__orb--2 {
    width: min(50vw, 260px);
    height: min(50vw, 260px);
    background: #0060ab;
    bottom: 15%;
    left: -8%;
    animation-delay: -4s;
}

@keyframes atr-pwa-float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-12px, 18px) scale(1.05); }
}

.atr-pwa-splash__card {
    position: relative;
    max-width: 360px;
    width: 100%;
    padding: clamp(28px, 6vw, 40px);
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(22px) saturate(1.4);
    -webkit-backdrop-filter: blur(22px) saturate(1.4);
    border: 1px solid rgba(255, 255, 255, 0.22);
    box-shadow:
        0 4px 24px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    text-align: center;
    transform: translateY(12px) scale(0.98);
    opacity: 0;
    animation: atr-pwa-card-in 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.12s forwards;
}

@keyframes atr-pwa-card-in {
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.atr-pwa-splash__logo {
    width: 88px;
    height: 88px;
    margin: 0 auto 16px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    overflow: hidden;
}

.atr-pwa-splash__logo img {
    width: 72px;
    height: auto;
    max-height: 72px;
    object-fit: contain;
}

.atr-pwa-splash__title {
    font-family: "Inter", system-ui, sans-serif;
    font-weight: 800;
    font-size: clamp(1.35rem, 4vw, 1.6rem);
    letter-spacing: 0.06em;
    color: #fff;
    text-shadow: 0 2px 20px rgba(0, 0, 0, 0.25);
    margin: 0 0 6px;
}

.atr-pwa-splash__title span {
    font-weight: 300;
    opacity: 0.92;
}

.atr-pwa-splash__sub {
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.72);
    margin: 0 0 22px;
    letter-spacing: 0.02em;
}

.atr-pwa-splash__bar {
    height: 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    overflow: hidden;
}

.atr-pwa-splash__bar > span {
    display: block;
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, #38bdf8, #0060ab, #60a5fa);
    animation: atr-pwa-bar 1.1s ease-out 0.2s forwards;
}

@keyframes atr-pwa-bar {
    to { width: 100%; }
}

/* Barra: instalar app (navegador normal) */
#atr-pwa-install-wrap {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1049000;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0));
    pointer-events: none;
    display: none;
    justify-content: center;
}

#atr-pwa-install-wrap.atr-pwa-install--visible {
    display: flex;
    pointer-events: auto;
}

/* Texto más legible en barra tipo iOS (instrucciones largas) */
#atr-pwa-install-wrap.atr-pwa-install--ios #atr-pwa-install-banner {
    max-width: min(520px, 100%);
}

#atr-pwa-install-wrap.atr-pwa-install--ios #atr-pwa-install-btn {
    padding: 8px 14px;
    font-size: 0.78rem;
}

#atr-pwa-install-banner {
    max-width: min(480px, 100%);
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(18px) saturate(1.3);
    -webkit-backdrop-filter: blur(18px) saturate(1.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.2);
}

body.dark-mode #atr-pwa-install-banner,
body:not(.atr-login-page-minimal) #atr-pwa-install-banner {
    background: rgba(15, 23, 42, 0.75);
    border-color: rgba(255, 255, 255, 0.1);
}

.atr-login-page-minimal #atr-pwa-install-banner {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.28);
}

#atr-pwa-install-banner .atr-pwa-install__text {
    flex: 1;
    min-width: 0;
}

#atr-pwa-install-banner .atr-pwa-install__text strong {
    display: block;
    font-size: 0.9rem;
    color: var(--bs-body-color, #0f172a);
}

body.dark-mode #atr-pwa-install-banner .atr-pwa-install__text strong {
    color: #f8fafc;
}

.atr-login-page-minimal #atr-pwa-install-banner .atr-pwa-install__text strong {
    color: #0f172a;
}

#atr-pwa-install-banner .atr-pwa-install__text small {
    font-size: 0.75rem;
    opacity: 0.85;
    color: var(--bs-secondary-color, #64748b);
}

#atr-pwa-install-btn {
    flex-shrink: 0;
    border: 0;
    border-radius: 999px;
    padding: 8px 18px;
    font-weight: 700;
    font-size: 0.82rem;
    background: linear-gradient(135deg, #0060ab 0%, #2563eb 100%);
    color: #fff;
    box-shadow: 0 4px 14px rgba(0, 96, 171, 0.4);
}

#atr-pwa-install-dismiss {
    flex-shrink: 0;
    border: 0;
    background: transparent;
    opacity: 0.6;
    padding: 4px 8px;
    font-size: 1.1rem;
    line-height: 1;
    color: inherit;
}

/*
 * Por encima de los modales de login (Bootstrap ~1110) y de la barra PWA inferior (~1049000).
 */
body .swal2-container.atr-pwa-help-on-top {
    z-index: 2147482000 !important;
}

@media (prefers-reduced-motion: reduce) {
    #atr-pwa-splash .atr-pwa-splash__orb,
    .atr-pwa-splash__card,
    .atr-pwa-splash__bar > span {
        animation: none !important;
    }
    #atr-pwa-splash .atr-pwa-splash__card {
        transform: none;
        opacity: 1;
    }
    #atr-pwa-splash .atr-pwa-splash__bar > span {
        width: 100%;
    }
}
