/*
 * Pantalla de acceso.
 *
 * No extiende 'base.html', así que es la única que no carga 'tema.css' ni 'ui.css'
 * y lleva aquí sus propias variables de color (las mismas corporativas).
 *
 * Dos mitades: a la izquierda la marca, sobre un degradado del azul marino al
 * corporativo con una cuadrícula tenue, engranajes que giran y granza de plástico
 * que cae; a la derecha, el formulario. En pantallas estrechas la mitad de marca
 * se queda en una banda con el logo.
 */

:root {
    --primary-color: #00919e;
    --primary-rgb: 0, 145, 158;
    --sidebar-color: #224d74;
    --claro: #7fd0d6;
    --tinta: #17324d;
    --tinta-suave: #5f7690;
    --linea: #dbe7f0;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #f6f9fb;
    color: var(--tinta);
    font-family: 'Nunito', sans-serif;
}

.acceso {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    min-height: 100vh;
}

/* ===== Lado de marca ===== */
.acceso-marca {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 2rem 2.5rem;
    overflow: hidden;
    color: #fff;
    background:
        radial-gradient(60rem 40rem at 85% 110%, rgba(var(--primary-rgb), 0.55), transparent 60%),
        linear-gradient(150deg, #16365a 0%, var(--sidebar-color) 40%, #0a7584 100%);
}

/* Cuadrícula tenue, como el papel milimetrado de un plano de planta */
.acceso-marca::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
    background-size: 9rem 9rem;
    pointer-events: none;
}

.acceso-marca > * {
    position: relative;
    z-index: 1;
}

.marca-logo {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

.marca-logo-icono {
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 3.3rem;
    height: 3.3rem;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.16);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(6px);
    color: #fff;
    font-size: 1.4rem;
}

.marca-logo-nombre {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    line-height: 1.1;
}

.marca-logo-lema {
    margin-top: 0.15rem;
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.8rem;
    font-weight: 600;
}

.marca-mensaje {
    max-width: 30rem;
    margin: 2rem 0;
}

.marca-titulo {
    margin: 0 0 1.1rem;
    font-size: clamp(2rem, 3.4vw, 3rem);
    font-weight: 800;
    line-height: 1.12;
    letter-spacing: -0.025em;
}

.marca-titulo span {
    color: var(--claro);
}

.marca-texto {
    margin: 0 0 1.75rem;
    color: rgba(255, 255, 255, 0.82);
    font-size: 1.05rem;
    line-height: 1.55;
}

.marca-fases {
    display: grid;
    gap: 0.75rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.marca-fases li {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 0.95rem;
    font-weight: 700;
}

.marca-fase-icono {
    display: inline-grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.25);
    font-size: 0.8rem;
}

.marca-pie {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.8rem;
    font-weight: 600;
}

/* ===== Maquinaria en movimiento =====
   Engranajes que giran despacio, cada pareja en sentido contrario como si
   engranaran, y granza (el granulado de plástico que alimenta la extrusora)
   cayendo como desde una tolva. Todo en segundo plano y muy tenue. */
.maquinaria {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.engranaje {
    position: absolute;
    fill: rgba(255, 255, 255, 0.08);
    stroke: rgba(255, 255, 255, 0.16);
    stroke-width: 0.6;
    animation: gira var(--dur) linear infinite;
}

.engranaje--1 { width: 22rem; height: 22rem; right: -7rem; bottom: -8rem; --dur: 90s; }
.engranaje--2 { width: 12rem; height: 12rem; right: 9.5rem; bottom: 7.5rem; --dur: 49s; animation-direction: reverse; }
.engranaje--3 { width: 15rem; height: 15rem; left: -5rem; top: 40%; --dur: 70s; animation-direction: reverse; }
.engranaje--4 { width: 7rem; height: 7rem; left: 7rem; top: calc(40% + 12rem); --dur: 33s; }

@keyframes gira {
    to { transform: rotate(360deg); }
}

.granza {
    --tam: 0.5rem;
    position: absolute;
    top: -1rem;
    width: var(--tam);
    height: calc(var(--tam) * 0.7);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.55);
    box-shadow: 0 0 0.4rem rgba(127, 208, 214, 0.5);
    opacity: 0;
    animation: cae var(--dur, 9s) linear var(--ret, 0s) infinite;
}

@keyframes cae {
    0%   { transform: translate(0, 0) rotate(0deg); opacity: 0; }
    8%   { opacity: 0.9; }
    92%  { opacity: 0.7; }
    100% { transform: translate(var(--deriva, 0), 105vh) rotate(540deg); opacity: 0; }
}

.granza:nth-of-type(1)  { --tam: 0.5rem;  left: 4%;  --dur: 9s;  --ret: 0s;  --deriva: 0.6rem; }
.granza:nth-of-type(2)  { --tam: 0.35rem; left: 11%; --dur: 7s;  --ret: 2s;  --deriva: -0.4rem; }
.granza:nth-of-type(3)  { --tam: 0.6rem;  left: 17%; --dur: 11s; --ret: 5s;  --deriva: 0.8rem; }
.granza:nth-of-type(4)  { --tam: 0.4rem;  left: 23%; --dur: 8s;  --ret: 1s;  --deriva: -0.6rem; }
.granza:nth-of-type(5)  { --tam: 0.55rem; left: 30%; --dur: 10s; --ret: 6s;  --deriva: 0.5rem; }
.granza:nth-of-type(6)  { --tam: 0.35rem; left: 37%; --dur: 7.5s; --ret: 3s; --deriva: -0.5rem; }
.granza:nth-of-type(7)  { --tam: 0.5rem;  left: 44%; --dur: 9.5s; --ret: 8s; --deriva: 0.7rem; }
.granza:nth-of-type(8)  { --tam: 0.4rem;  left: 50%; --dur: 8.5s; --ret: 0.5s; --deriva: -0.3rem; }
.granza:nth-of-type(9)  { --tam: 0.6rem;  left: 56%; --dur: 11.5s; --ret: 4s; --deriva: 0.9rem; }
.granza:nth-of-type(10) { --tam: 0.35rem; left: 62%; --dur: 7s;  --ret: 7s;  --deriva: -0.7rem; }
.granza:nth-of-type(11) { --tam: 0.5rem;  left: 68%; --dur: 9s;  --ret: 2.5s; --deriva: 0.4rem; }
.granza:nth-of-type(12) { --tam: 0.45rem; left: 74%; --dur: 10s; --ret: 9s;  --deriva: -0.5rem; }
.granza:nth-of-type(13) { --tam: 0.55rem; left: 80%; --dur: 8s;  --ret: 1.5s; --deriva: 0.6rem; }
.granza:nth-of-type(14) { --tam: 0.4rem;  left: 86%; --dur: 11s; --ret: 6.5s; --deriva: -0.8rem; }
.granza:nth-of-type(15) { --tam: 0.5rem;  left: 91%; --dur: 9s;  --ret: 3.5s; --deriva: 0.5rem; }
.granza:nth-of-type(16) { --tam: 0.35rem; left: 96%; --dur: 7.5s; --ret: 10s; --deriva: -0.3rem; }
.granza:nth-of-type(17) { --tam: 0.6rem;  left: 8%;  --dur: 12s; --ret: 9s;  --deriva: 0.6rem; }
.granza:nth-of-type(18) { --tam: 0.4rem;  left: 47%; --dur: 8s;  --ret: 11s; --deriva: -0.4rem; }

/* Quien prefiere menos movimiento lo ve todo quieto */
@media (prefers-reduced-motion: reduce) {
    .engranaje {
        animation: none;
    }

    .granza {
        display: none;
    }
}

/* ===== Lado del formulario ===== */
.acceso-formulario {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    padding: 2rem 1.5rem;
}

.acceso-tarjeta {
    width: 100%;
    max-width: 26rem;
    padding: 2.5rem 2.25rem;
    border: 1px solid var(--linea);
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 20px 50px rgba(23, 50, 77, 0.1);
}

.acceso-titulo {
    margin: 0 0 0.35rem;
    color: var(--sidebar-color);
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    text-align: center;
}

.acceso-subtitulo {
    margin: 0 0 1.75rem;
    color: var(--tinta-suave);
    font-size: 0.95rem;
    text-align: center;
}

.acceso-etiqueta {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.8rem;
    font-weight: 700;
}

.acceso .form-control {
    padding: 0.7rem 0.95rem;
    border: 1px solid var(--linea);
    border-radius: 10px;
    background: #f3f7fa;
    color: var(--tinta);
    font-size: 0.92rem;
    transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.acceso .form-control:focus {
    border-color: var(--primary-color);
    background: #fff;
    box-shadow: 0 0 0 0.2rem rgba(var(--primary-rgb), 0.15);
}

.acceso-boton {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 0;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary-color), #007886);
    color: #fff;
    font: inherit;
    font-size: 0.95rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(var(--primary-rgb), 0.3);
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.acceso-boton:hover {
    background: linear-gradient(135deg, var(--sidebar-color), #1b3f60);
    box-shadow: 0 8px 20px rgba(34, 77, 116, 0.3);
    transform: translateY(-1px);
}

.acceso .alert {
    border: 0;
    border-radius: 10px;
    font-size: 0.875rem;
}

.acceso-copyright {
    color: var(--tinta-suave);
    font-size: 0.75rem;
    text-align: center;
}

/* ===== Pantallas estrechas =====
   La mitad de marca pasa a ser una banda baja con el logo y el fondo en movimiento; el
   mensaje y las fases sobran: lo que hay que ver es el formulario. */
@media (max-width: 991.98px) {
    .acceso {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto 1fr;
    }

    .acceso-marca {
        padding: 1.25rem 1.5rem;
        min-height: 7.5rem;
        justify-content: center;
    }

    .marca-mensaje,
    .marca-pie {
        display: none;
    }

    .acceso-formulario {
        padding: 1.5rem 1rem 2rem;
    }

    .acceso-tarjeta {
        padding: 1.75rem 1.25rem;
    }
}

@media (max-width: 575.98px) {
    /* 44 px de alto: el objetivo mínimo cómodo para el dedo */
    .acceso .form-control {
        min-height: 2.75rem;
    }

    .acceso-boton {
        min-height: 2.9rem;
    }
}
