/* Login Commander Access — vidrio champán sutil y circuitos atenuados */

@font-face {
    font-family: "Montserrat";
    font-style: normal;
    font-weight: 300;
    font-display: swap;
    src: url("../fonts/montserrat-300.ttf") format("truetype");
}

@font-face {
    font-family: "Montserrat";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("../fonts/montserrat-700.ttf") format("truetype");
}

:root {
    --ca-gold-900: #7a6520;
    --ca-gold-700: #8b6d1b;
    --ca-gold-500: #c8a646;
    --ca-gold-300: #e6c974;
    --ca-gold-100: #f3dfa2;
    --ca-ink: #12100b;
}

body.ca-login-page {
    min-height: 100dvh;
    margin: 0;
    overflow-x: hidden;
    background: #060709 !important;
    color: #f8fafc;
    font-family: "Montserrat", sans-serif;
    animation: none;
}

/* —— Escenario oscuro con circuitos grises/blancos atenuados —— */
.ca-login-stage {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
    background:
        radial-gradient(ellipse 34% 32% at 50% 48%, rgba(243, 223, 162, 0.14) 0%, rgba(200, 166, 70, 0.04) 48%, transparent 72%),
        linear-gradient(180deg, #050608 0%, #090b0f 50%, #040507 100%);
}

.ca-login-circuit-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
    background-size: 120px 120px, 120px 120px;
    mask-image: radial-gradient(ellipse 85% 80% at 50% 50%, #000 28%, transparent 90%);
    -webkit-mask-image: radial-gradient(ellipse 85% 80% at 50% 50%, #000 28%, transparent 90%);
}

.ca-login-circuits {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0.68;
}

.ca-circuit-traces path {
    fill: none;
    stroke-width: 1.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.ca-circuit-pulses path {
    fill: none;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 90 840;
    filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.3));
    animation: ca-circuit-pulse 8.8s linear infinite;
}

.ca-pulse--b { animation-duration: 10s; animation-delay: -2.2s; }
.ca-pulse--c { animation-duration: 9.2s; animation-delay: -4.8s; }
.ca-pulse--d { animation-duration: 9s; animation-delay: -1.1s; }
.ca-pulse--e { animation-duration: 10.4s; animation-delay: -3.6s; }
.ca-pulse--f { animation-duration: 8.8s; animation-delay: -5.4s; }

.ca-circuit-nodes circle {
    fill: #090b0f;
    stroke: rgba(203, 213, 225, 0.34);
    stroke-width: 1.3;
    filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.18));
}

@keyframes ca-circuit-pulse {
    from { stroke-dashoffset: 930; }
    to { stroke-dashoffset: 0; }
}

.ca-circuit-nodes .ca-node--live {
    animation: ca-node-blink 7.2s ease-in-out infinite;
    animation-delay: var(--d, 0s);
}

@keyframes ca-node-blink {
    0%, 70%, 100% {
        fill: #090b0f;
        stroke: rgba(203, 213, 225, 0.34);
        filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.18));
    }
    80% {
        fill: rgba(243, 223, 162, 0.85);
        stroke: rgba(243, 223, 162, 0.9);
        filter: drop-shadow(0 0 6px rgba(230, 201, 116, 0.75));
    }
}

/* —— Equipos biométricos en línea fina —— */
.ca-bio rect,
.ca-bio use {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.ca-bio-body {
    fill: rgba(12, 14, 18, 0.55) !important;
    stroke: rgba(203, 213, 225, 0.26);
    stroke-width: 1.2;
}

.ca-bio-inner {
    stroke: rgba(243, 223, 162, 0.3);
    stroke-width: 1.1;
}

.ca-bio-line {
    fill: rgba(203, 213, 225, 0.14) !important;
    stroke: none;
}

.ca-bio-led {
    fill: rgba(243, 223, 162, 0.35);
    animation: ca-bio-led 3.6s ease-in-out infinite;
    animation-delay: var(--d, 0s);
}

@keyframes ca-bio-led {
    0%, 100% { fill: rgba(243, 223, 162, 0.3); filter: none; }
    50% { fill: rgba(243, 223, 162, 0.95); filter: drop-shadow(0 0 5px rgba(230, 201, 116, 0.8)); }
}

.ca-bio-finger {
    stroke: rgba(226, 232, 240, 0.3);
    stroke-width: 0.4;
}

.ca-bio-finger-trace {
    stroke: rgba(243, 223, 162, 0.9);
    stroke-width: 0.45;
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    filter: drop-shadow(0 0 3px rgba(230, 201, 116, 0.6));
    animation: ca-bio-trace 6s ease-in-out infinite;
}

@keyframes ca-bio-trace {
    0%, 15% { stroke-dashoffset: 100; opacity: 1; }
    55% { stroke-dashoffset: 0; opacity: 1; }
    75%, 100% { stroke-dashoffset: 0; opacity: 0; }
}

.ca-bio-face {
    stroke: rgba(243, 223, 162, 0.55);
    stroke-width: 0.35;
    animation: ca-bio-breathe 5s ease-in-out infinite;
}

.ca-bio-face-sm {
    stroke: rgba(226, 232, 240, 0.3);
    stroke-width: 0.6;
}

@keyframes ca-bio-breathe {
    0%, 100% { opacity: 0.55; }
    50% { opacity: 1; }
}

.ca-bio-mark {
    stroke: rgba(226, 232, 240, 0.09);
}

.ca-bio-mark--icon {
    stroke: rgba(243, 223, 162, 0.18);
    stroke-width: 0.4;
}

/* —— Partículas doradas que flotan hacia arriba —— */
.ca-login-dust {
    position: absolute;
    inset: 0;
}

.ca-login-dust span {
    position: absolute;
    bottom: -10px;
    left: var(--x);
    width: var(--s);
    height: var(--s);
    border-radius: 50%;
    background: rgba(243, 223, 162, 0.8);
    box-shadow: 0 0 8px rgba(230, 201, 116, 0.7);
    opacity: 0;
    animation: ca-dust-rise var(--t) linear infinite;
    animation-delay: var(--d);
}

@keyframes ca-dust-rise {
    0% { transform: translate(0, 0); opacity: 0; }
    10% { opacity: 0.55; }
    50% { transform: translate(18px, -55vh); }
    85% { opacity: 0.35; }
    100% { transform: translate(-12px, -110vh); opacity: 0; }
}

/* —— Contenedor centrado —— */
.ca-login-shell {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100dvh;
    padding: 1.5rem 1rem;
}

/* —— Tarjeta principal: vidrio translúcido con tinte champán suave —— */
#formContent.ca-login-card {
    position: relative;
    overflow: hidden;
    width: min(100%, 27.5rem);
    margin: 0;
    padding: clamp(1.75rem, 3.8vw, 2.4rem);
    border: 1px solid rgba(243, 223, 162, 0.28);
    border-radius: 26px;
    background:
        linear-gradient(135deg, rgba(255, 252, 238, 0.2) 0%, rgba(255, 248, 220, 0.03) 48%, rgba(243, 223, 162, 0.12) 100%),
        rgba(243, 223, 162, 0.09);
    backdrop-filter: blur(8px) saturate(135%);
    -webkit-backdrop-filter: blur(8px) saturate(135%);
    box-shadow:
        0 1px 0 rgba(255, 254, 245, 0.22) inset,
        0 -1px 0 rgba(230, 201, 116, 0.1) inset,
        0 0 0 1px rgba(230, 201, 116, 0.04),
        0 0 18px rgba(230, 201, 116, 0.06),
        0 24px 60px rgba(0, 0, 0, 0.5);
    text-align: left;
    animation: ca-card-glow 6s ease-in-out infinite;
}

@keyframes ca-card-glow {
    0%, 100% {
        box-shadow:
            0 1px 0 rgba(255, 254, 245, 0.22) inset,
            0 -1px 0 rgba(230, 201, 116, 0.1) inset,
            0 0 0 1px rgba(230, 201, 116, 0.04),
            0 0 18px rgba(230, 201, 116, 0.06),
            0 24px 60px rgba(0, 0, 0, 0.5);
    }
    50% {
        box-shadow:
            0 1px 0 rgba(255, 254, 245, 0.28) inset,
            0 -1px 0 rgba(230, 201, 116, 0.14) inset,
            0 0 0 1px rgba(230, 201, 116, 0.06),
            0 0 24px rgba(230, 201, 116, 0.09),
            0 24px 60px rgba(0, 0, 0, 0.5);
    }
}

.ca-login-card__shine {
    position: absolute;
    top: 0;
    left: 12%;
    right: 12%;
    height: 2px;
    border-radius: 0 0 999px 999px;
    background: linear-gradient(90deg, transparent, rgba(243, 223, 162, 0.4) 50%, transparent);
    box-shadow: 0 1px 6px rgba(230, 201, 116, 0.18);
}

/* —— Marca superior —— */
.ca-login-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.7rem;
    margin: 0.15rem 0 1.15rem;
}

.ca-login-seal {
    position: relative;
    display: grid;
    place-items: center;
    width: 4.35rem;
    height: 4.35rem;
    border-radius: 20px;
    border: 1px solid rgba(243, 223, 162, 0.42);
    background:
        radial-gradient(circle at 30% 22%, rgba(243, 223, 162, 0.22), transparent 58%),
        rgba(18, 16, 12, 0.58);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.18) inset,
        0 10px 24px rgba(0, 0, 0, 0.32);
}

.ca-login-logo {
    display: block;
    width: 40px;
    height: auto;
    filter: drop-shadow(0 2px 8px rgba(243, 223, 162, 0.25));
}

.ca-login-kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.3rem 0.75rem;
    border: 1px solid rgba(243, 223, 162, 0.38);
    border-radius: 999px;
    background: rgba(243, 223, 162, 0.16);
    color: #f6e7ba;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.ca-login-kicker__dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--ca-gold-300);
    box-shadow: 0 0 0 3px rgba(230, 201, 116, 0.24);
}

.ca-login-card__header {
    margin: 0 0 1.45rem;
    text-align: center;
}

body.ca-login-page .ca-login-card__header h2 {
    display: block;
    margin: 0;
    color: #fffdf7;
    font-family: "Montserrat", sans-serif;
    font-size: clamp(1.75rem, 3.6vw, 2.15rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.1;
    text-align: center;
    text-transform: none;
}

.ca-login-card__header p {
    margin: 0.5rem 0 0;
    color: rgba(255, 250, 236, 0.8);
    font-size: 0.9rem;
    font-weight: 300;
}

/* —— Formulario —— */
.ca-login-form {
    display: grid;
    gap: 1.1rem;
}

.ca-login-field {
    min-width: 0;
}

.ca-login-field label {
    display: block;
    margin: 0 0 0.42rem;
    color: #f6e7ba;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.ca-login-forgot {
    display: inline;
    width: auto;
    max-width: none;
    margin: 0;
    padding: 0 !important;
    border: 0;
    background: transparent;
    color: #f6e7ba;
    font-family: "Montserrat", sans-serif;
    font-size: 0.74rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
}

.ca-login-forgot:hover {
    color: #ffffff;
    text-decoration: underline;
}

.ca-login-control {
    position: relative;
    display: flex;
    align-items: center;
}

.ca-login-icon {
    position: absolute;
    z-index: 1;
    left: 0.55rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 10px;
    border: 1px solid rgba(243, 223, 162, 0.36);
    background: rgba(243, 223, 162, 0.2);
    color: #fff6d6;
    font-size: 0.85rem;
    pointer-events: none;
    transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease;
}

body.ca-login-page .ca-login-control input[type="text"],
body.ca-login-page .ca-login-control input[type="password"] {
    display: block;
    width: 100%;
    height: 3.3rem;
    margin: 0;
    padding: 0 3rem 0 3.2rem;
    border: 1px solid rgba(243, 223, 162, 0.34);
    border-radius: 14px;
    background: rgba(12, 14, 18, 0.42);
    color: #fffdf7;
    font-family: "Montserrat", sans-serif;
    font-size: 0.96rem;
    font-weight: 700;
    text-align: left;
    outline: 0;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08) inset;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

body.ca-login-page .ca-login-control input::placeholder {
    color: rgba(255, 248, 228, 0.56);
    font-weight: 300;
    opacity: 1;
}

body.ca-login-page .ca-login-control input:-webkit-autofill,
body.ca-login-page .ca-login-control input:-webkit-autofill:hover,
body.ca-login-page .ca-login-control input:-webkit-autofill:focus {
    -webkit-text-fill-color: #fffdf7;
    caret-color: #fffdf7;
    /* Fondo oscuro forzado: el browser a veces deja autofill claro y el texto blanco no se lee */
    box-shadow: 0 0 0 1000px rgba(12, 14, 18, 0.92) inset;
    transition: background-color 9999s ease-out;
}

body.ca-login-page .ca-login-control input[type="text"]:focus,
body.ca-login-page .ca-login-control input[type="password"]:focus {
    border-color: var(--ca-gold-300);
    background: rgba(12, 14, 18, 0.62);
    box-shadow: 0 0 0 4px rgba(230, 201, 116, 0.22);
}

.ca-login-control:focus-within .ca-login-icon {
    background: linear-gradient(180deg, #f3dfa2 0%, #c8a646 100%);
    color: var(--ca-ink);
    transform: scale(1.04);
}

.ca-login-password-toggle {
    position: absolute;
    z-index: 2;
    right: 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.3rem;
    height: 2.3rem;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #f6e7ba;
    cursor: pointer;
    transition: background 0.16s ease, color 0.16s ease;
}

.ca-login-password-toggle:hover,
.ca-login-password-toggle:focus-visible {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    outline: none;
}

/* —— Botón principal —— */
body.ca-login-page .ca-login-submit {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 3.45rem;
    margin: 0.45rem 0 0;
    padding: 0 0.65rem 0 1.35rem;
    border: 1px solid rgba(243, 223, 162, 0.7);
    border-radius: 16px;
    background: linear-gradient(180deg, #f3dfa2 0%, #e1c36d 52%, #c5a144 100%);
    color: var(--ca-ink);
    font-family: "Montserrat", sans-serif;
    font-size: 0.94rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: none;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.65) inset,
        0 14px 28px rgba(0, 0, 0, 0.34);
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

body.ca-login-page .ca-login-submit:hover {
    background: linear-gradient(180deg, #faecc2 0%, #e9ce7d 100%);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.75) inset,
        0 18px 32px rgba(0, 0, 0, 0.4),
        0 0 0 4px rgba(230, 201, 116, 0.22);
    transform: translateY(-1px);
}

body.ca-login-page .ca-login-submit:active {
    transform: translateY(0) scale(0.99);
}

.ca-login-submit__arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.35rem;
    height: 2.35rem;
    border-radius: 12px;
    background: rgba(18, 16, 11, 0.88);
    color: var(--ca-gold-100);
    transition: transform 0.18s ease;
}

body.ca-login-page .ca-login-submit:hover .ca-login-submit__arrow {
    transform: translateX(3px);
}

/* —— Pie de tarjeta: recuperar clave —— */
.ca-login-footer {
    display: flex;
    justify-content: center;
    margin: 1.15rem 0 0;
    padding: 0.95rem 0 0;
    border-top: 1px solid rgba(243, 223, 162, 0.24);
}

@media (max-width: 480px) {
    .ca-login-shell {
        padding: 1rem 0.75rem;
    }

    #formContent.ca-login-card {
        padding: 1.45rem 1.15rem;
        border-radius: 22px;
    }
}

/* —— Alertas del login, mismo vidrio y dorado que la tarjeta —— */
body.ca-login-page .swal2-container {
    background: rgba(4, 5, 7, 0.62);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

body.ca-login-page .ca-swal.swal2-popup {
    width: min(22rem, calc(100vw - 2rem));
    padding: 1.55rem 1.35rem 1.2rem;
    border: 1px solid rgba(243, 223, 162, 0.28);
    border-radius: 22px;
    background:
        linear-gradient(135deg, rgba(255, 252, 238, 0.16) 0%, rgba(255, 248, 220, 0.03) 48%, rgba(243, 223, 162, 0.1) 100%),
        rgba(16, 14, 11, 0.94);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
    font-family: "Montserrat", sans-serif;
}

body.ca-login-page .ca-swal .swal2-title {
    margin: 0 0 0.45rem;
    padding: 0;
    color: #fffdf7;
    font-size: 1.05rem;
    font-weight: 700;
}

body.ca-login-page .ca-swal .swal2-html-container {
    margin: 0.35rem 0 0;
    padding: 0;
    color: rgba(255, 250, 236, 0.86);
    font-size: 0.92rem;
    font-weight: 500;
    line-height: 1.45;
}

body.ca-login-page .ca-swal .swal2-actions {
    width: 100%;
    margin: 1.15rem 0 0;
}

body.ca-login-page .ca-swal__btn {
    min-width: 8.5rem;
    min-height: 2.7rem;
    padding: 0 1.4rem;
    border: 1px solid rgba(243, 223, 162, 0.7);
    border-radius: 14px;
    background: linear-gradient(180deg, #f3dfa2 0%, #e1c36d 52%, #c5a144 100%);
    color: var(--ca-ink);
    font-family: "Montserrat", sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
}

body.ca-login-page .ca-swal__btn:hover {
    background: linear-gradient(180deg, #faecc2 0%, #e9ce7d 100%);
}

body.ca-login-page .ca-swal__btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(230, 201, 116, 0.28);
}

@media (prefers-reduced-motion: reduce) {
    .ca-login-page *,
    .ca-login-page *::before,
    .ca-login-page *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
