/* Login + pantalla de arranque S.A.I */

.sai-login,
.sai-boot {
    margin: 0;
    min-height: 100vh;
    font-family: "Sora", system-ui, -apple-system, "Segoe UI", sans-serif;
    color: #e8eef7;
    background: #060d18;
    overflow: hidden;
}

.sai-login__bg,
.sai-boot__bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse 80% 50% at 50% -10%, rgba(66, 133, 244, 0.22), transparent 55%),
        radial-gradient(ellipse 60% 40% at 100% 100%, rgba(233, 48, 106, 0.18), transparent 50%),
        radial-gradient(ellipse 50% 35% at 0% 80%, rgba(19, 53, 87, 0.45), transparent 45%),
        linear-gradient(165deg, #060d18 0%, #0c1829 40%, #133557 100%);
}

.sai-login__bg::before,
.sai-boot__bg::before {
    content: "";
    position: absolute;
    inset: 0;
    opacity: 0.35;
    background:
        linear-gradient(to right, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000 20%, transparent 75%);
}

.sai-login__grain,
.sai-boot__grain {
    position: fixed;
    inset: 0;
    opacity: 0.04;
    pointer-events: none;
    background-image: 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.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* —— Login —— */
.sai-login__main {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.sai-login__card {
    width: min(440px, 100%);
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(12, 24, 41, 0.72);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow:
        0 32px 64px rgba(0, 0, 0, 0.45),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    overflow: hidden;
    animation: saiLoginIn 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.sai-login__hero {
    padding: 2rem 2rem 1.5rem;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: linear-gradient(180deg, rgba(19, 53, 87, 0.5) 0%, transparent 100%);
}

.sai-login__logo {
    height: 72px;
    width: auto;
    margin: 0 auto 1rem;
    display: block;
    filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.35));
}

.sai-login__brand {
    margin: 0;
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    color: #fff;
}

.sai-login__brand-ai {
    background: linear-gradient(90deg, #60a5fa, #a78bfa, #f472b6);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sai-login__tagline {
    margin: 0.5rem 0 0;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(226, 232, 240, 0.65);
}

.sai-login__form-wrap {
    padding: 1.75rem 2rem 2rem;
}

.sai-login__title {
    margin: 0 0 0.35rem;
    font-size: 1.35rem;
    font-weight: 700;
    color: #f8fafc;
}

.sai-login__subtitle {
    margin: 0 0 1.25rem;
    font-size: 0.85rem;
    color: rgba(203, 213, 225, 0.75);
}

.sai-login__error {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    border: 1px solid rgba(248, 113, 113, 0.35);
    background: rgba(127, 29, 29, 0.25);
    color: #fecaca;
    font-size: 0.82rem;
    font-weight: 600;
}

.sai-login__field {
    margin-bottom: 1rem;
}

.sai-login__label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(203, 213, 225, 0.85);
}

.sai-login__input-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0 0.9rem;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(6, 13, 24, 0.55);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.sai-login__input-row:focus-within {
    border-color: rgba(96, 165, 250, 0.55);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.sai-login__input-row i {
    color: #f472b6;
    font-size: 0.9rem;
    opacity: 0.9;
}

.sai-login__input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: none;
    background: transparent;
    color: #f1f5f9;
    padding: 0.85rem 0;
    font-size: 0.95rem;
    font-weight: 500;
}

.sai-login__input::placeholder {
    color: rgba(148, 163, 184, 0.65);
}

.sai-login__submit {
    width: 100%;
    margin-top: 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.9rem 1.25rem;
    border: 0;
    border-radius: 14px;
    font-size: 0.9rem;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    background: linear-gradient(135deg, #133557 0%, #1e4a7a 50%, #be185d 100%);
    box-shadow: 0 12px 28px rgba(19, 53, 87, 0.45);
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.sai-login__submit:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 16px 32px rgba(19, 53, 87, 0.5);
}

.sai-login__submit:disabled {
    opacity: 0.75;
    cursor: wait;
}

.sai-login__guide {
    margin: 1rem 0 0;
    text-align: center;
}

.sai-login__guide-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    font-weight: 700;
    color: #93c5fd;
    text-decoration: none;
    transition: color 0.15s ease;
}

.sai-login__guide-link:hover {
    color: #bfdbfe;
    text-decoration: underline;
}

.sai-login__footer {
    margin: 0.75rem 0 0;
    text-align: center;
    font-size: 0.68rem;
    color: rgba(148, 163, 184, 0.55);
}

.sai-login__chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.4rem;
    margin-top: 1rem;
}

.sai-login__chip {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.28rem 0.55rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(203, 213, 225, 0.7);
    background: rgba(255, 255, 255, 0.04);
}

/* —— Boot splash —— */
.sai-boot__stage {
    position: relative;
    z-index: 2;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
}

.sai-boot__logo-wrap {
    position: relative;
    margin-bottom: 2rem;
    animation: saiBootLogoIn 1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    opacity: 0;
}

.sai-boot__logo {
    height: 88px;
    width: auto;
    display: block;
    filter: drop-shadow(0 12px 32px rgba(0, 0, 0, 0.4));
}

.sai-boot__logo-glow {
    position: absolute;
    inset: -30%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(96, 165, 250, 0.35) 0%, transparent 70%);
    animation: saiBootGlow 2.4s ease-in-out infinite;
    pointer-events: none;
}

.sai-boot__name {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.05em;
    margin: 0;
    font-size: clamp(2.5rem, 8vw, 3.75rem);
    font-weight: 800;
    letter-spacing: 0.14em;
    color: #fff;
    animation: saiBootNameIn 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.35s forwards;
    opacity: 0;
    transform: translateY(12px);
}

.sai-boot__letter {
    display: inline-block;
    animation: saiBootLetterPulse 2s ease-in-out infinite;
}

.sai-boot__letter:nth-child(1) { animation-delay: 0s; }
.sai-boot__letter:nth-child(3) { animation-delay: 0.15s; }
.sai-boot__letter:nth-child(4) { animation-delay: 0.3s; }

.sai-boot__dot {
    color: rgba(148, 163, 184, 0.9);
    font-weight: 600;
    letter-spacing: 0;
}

.sai-boot__ai {
    background: linear-gradient(90deg, #38bdf8, #818cf8, #f472b6);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 0.08em;
}

.sai-boot__subtitle {
    margin: 0.65rem 0 0;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: rgba(203, 213, 225, 0.55);
    animation: saiBootNameIn 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.55s forwards;
    opacity: 0;
    transform: translateY(8px);
}

.sai-boot__status {
    margin: 2.25rem 0 1rem;
    min-height: 1.25rem;
    font-size: 0.82rem;
    font-weight: 500;
    color: rgba(203, 213, 225, 0.75);
    animation: saiBootNameIn 0.7s ease 0.75s forwards;
    opacity: 0;
}

.sai-boot__progress {
    width: min(220px, 70vw);
    height: 3px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
    animation: saiBootNameIn 0.6s ease 0.85s forwards;
    opacity: 0;
}

.sai-boot__progress-bar {
    height: 100%;
    width: 0%;
    border-radius: inherit;
    background: linear-gradient(90deg, #38bdf8, #a78bfa, #f472b6);
    box-shadow: 0 0 12px rgba(129, 140, 248, 0.6);
    transition: width 0.35s ease;
}

.sai-boot__user {
    margin-top: 1.5rem;
    font-size: 0.75rem;
    color: rgba(148, 163, 184, 0.5);
    animation: saiBootNameIn 0.6s ease 1s forwards;
    opacity: 0;
}

.sai-boot.is-exit .sai-boot__stage {
    animation: saiBootExit 0.55s cubic-bezier(0.4, 0, 1, 1) forwards;
}

@keyframes saiLoginIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes saiBootLogoIn {
    to {
        opacity: 1;
        transform: scale(1);
    }
    from {
        opacity: 0;
        transform: scale(0.92);
    }
}

@keyframes saiBootNameIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes saiBootGlow {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.08); }
}

@keyframes saiBootLetterPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.72; }
}

@keyframes saiBootExit {
    to {
        opacity: 0;
        transform: scale(1.04);
        filter: blur(8px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .sai-login__card,
    .sai-boot__logo-wrap,
    .sai-boot__name,
    .sai-boot__subtitle,
    .sai-boot__status,
    .sai-boot__progress,
    .sai-boot__user,
    .sai-boot__letter {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }

    .sai-boot__logo-glow {
        animation: none;
    }
}

@media (max-width: 480px) {
    .sai-login__hero {
        padding: 1.5rem 1.25rem 1.25rem;
    }

    .sai-login__form-wrap {
        padding: 1.5rem 1.25rem 1.75rem;
    }

    .sai-login__logo {
        height: 60px;
    }
}
