/* Diseño común de las pantallas de ingreso (login.php apoderados, login_2.php personal) */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Poppins', 'Segoe UI', Arial, sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(-45deg, #ff6b6b, #f9a826, #4ecdc4, #6c5ce7, #fd79a8);
    background-size: 400% 400%;
    background-attachment: fixed;
    animation: fondo 20s ease infinite; /* mismo degradado que inicio.php */
    /* Permite bajar con el scroll cuando la tarjeta es más alta que la ventana */
    overflow-x: hidden;
    overflow-y: auto;
    position: relative;
}

@keyframes fondo {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.tarjeta {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    margin: auto 0;   /* centrada si cabe; si no cabe, no se corta arriba ni abajo */
    padding: 34px 36px 32px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    animation: aparecer 0.7s ease-out;
}

@keyframes aparecer {
    from { opacity: 0; transform: translateY(30px); }
    to   { opacity: 1; transform: translateY(0); }
}

.logo {
    display: block;
    width: 130px;
    height: auto;
    margin: 0 auto 14px;
    filter: drop-shadow(0 8px 16px rgba(108, 92, 231, 0.25));
    transition: transform 0.3s;
}
.logo:hover { transform: scale(1.04); }

h2 {
    text-align: center;
    font-size: 1.6em;
    font-weight: 700;
    background: linear-gradient(90deg, #6c5ce7, #e84393, #f9a826);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.subtitulo {
    text-align: center;
    color: #7a7a9a;
    font-size: 0.92em;
    margin: 6px 0 26px;
}

.error {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    margin-bottom: 20px;
    border-radius: 12px;
    background: #ffe3e6;
    border-left: 5px solid #ff4d6d;
    color: #c9184a;
    font-size: 0.9em;
    font-weight: 500;
    animation: temblar 0.4s;
}

@keyframes temblar {
    0%, 100% { transform: translateX(0); }
    25%      { transform: translateX(-6px); }
    75%      { transform: translateX(6px); }
}


/* ---------- Mensajes temporales (10 segundos) ---------- */
.alerta-temporal { position: relative; overflow: hidden; }
.alerta-temporal::after {
    content: '';
    position: absolute;
    left: 0; bottom: 0;
    height: 4px; width: 100%;
    background: currentColor;
    opacity: 0.35;
    transform-origin: left;
    animation: barraAlerta var(--duracion-alerta, 10s) linear forwards;
}
@keyframes barraAlerta { from { transform: scaleX(1); } to { transform: scaleX(0); } }
.alerta-saliendo {
    animation: salirAlerta 0.4s ease forwards !important;
}
@keyframes salirAlerta {
    to { opacity: 0; transform: translateY(-10px); max-height: 0; padding-top: 0; padding-bottom: 0; margin: 0; }
}

.campo { margin-bottom: 20px; }

.campo label {
    display: block;
    margin-bottom: 7px;
    font-size: 0.88em;
    font-weight: 600;
    color: #4a4a6a;
}

.entrada {
    position: relative;
}

.entrada span {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.1em;
    pointer-events: none;
}

.entrada input {
    width: 100%;
    padding: 13px 14px 13px 44px;
    border: 2px solid #e4e1fb;
    border-radius: 12px;
    background: #f7f6ff;
    font-family: inherit;
    font-size: 0.95em;
    color: #333;
    transition: all 0.25s;
}

.olvido { margin-top: 14px; text-align: center; font-size: 0.78em; color: #7a7a9a; }

/* Ayuda y aviso del apoderado */
.ayuda-login { display: block; margin-top: 6px; font-size: 0.75em; color: #7a7a9a; }
.aviso-apoderado {
    margin-top: 10px;
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 0.84em;
    line-height: 1.5;
    animation: aparecer 0.35s ease-out;
}
.aviso-apoderado[hidden] { display: none; }
.aviso-apoderado.ok    { background: #e3fcf5; border-left: 5px solid #00b894; color: #00684f; }
.aviso-apoderado.error { background: #ffe3e6; border-left: 5px solid #ff4d6d; color: #c9184a; }
.aviso-apoderado.info  { background: #f3f0ff; border-left: 5px solid #6c5ce7; color: #4a3fb3; }
.aviso-apoderado strong { font-weight: 700; }
.aviso-apoderado code {
    display: inline-block; margin-top: 4px; padding: 2px 8px; border-radius: 6px;
    background: rgba(255,255,255,0.8); font-family: inherit; font-weight: 600; letter-spacing: 0.5px;
}
.entrada input.rut-ok    { border-color: #00b894; background: #effdf9; }
.entrada input.rut-error { border-color: #ff4d6d; background: #fff1f3; }

/* Botón ojo para mostrar / ocultar la contraseña */
.entrada input#password { padding-right: 50px; }
.ver-password {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 10px;
    background: transparent;
    box-shadow: none;
    color: #9a93c9;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color 0.2s, background 0.2s;
}
.ver-password:hover {
    color: #6c5ce7;
    background: rgba(108, 92, 231, 0.1);
    transform: translateY(-50%);
    box-shadow: none;
}
.ver-password .ojo-cerrado { display: none; }
.ver-password.visible { color: #e84393; }
.ver-password.visible .ojo-abierto { display: none; }
.ver-password.visible .ojo-cerrado { display: block; }

.entrada input:focus {
    outline: none;
    border-color: #6c5ce7;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(108, 92, 231, 0.18);
}

button {
    width: 100%;
    padding: 14px;
    margin-top: 6px;
    border: none;
    border-radius: 12px;
    font-family: inherit;
    font-size: 1em;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: #fff;
    cursor: pointer;
    background: linear-gradient(90deg, #6c5ce7, #e84393, #f9a826);
    background-size: 200% auto;
    box-shadow: 0 10px 22px rgba(232, 67, 147, 0.4);
    transition: all 0.35s;
}

button:hover {
    background-position: right center;
    transform: translateY(-2px);
    box-shadow: 0 14px 28px rgba(232, 67, 147, 0.5);
}

button:active { transform: translateY(0); }

.nota {
    margin-top: 24px;
    padding: 12px;
    border-radius: 12px;
    background: linear-gradient(135deg, #e0fbf8, #fff4e0);
    color: #5a5a7a;
    font-size: 0.8em;
    text-align: center;
    line-height: 1.5;
}

.nota strong { color: #6c5ce7; }

@media (max-width: 480px) {
    .tarjeta { padding: 38px 22px 26px; }
    h2 { font-size: 1.35em; }
}

/* Chip que indica a qué entrada corresponde la pantalla */
.chip-entrada {
    display: table;
    margin: 0 auto 10px;
    padding: 5px 14px;
    border-radius: 999px;
    background: #f3f0ff;
    color: #6c5ce7;
    font-size: 0.78em;
    font-weight: 600;
    letter-spacing: 0.3px;
}
.chip-entrada.personal { background: #e0fbf8; color: #00866f; }

.subtitulo-modulo {
    text-align: center;
    color: #4a4a6a;
    font-size: 0.95em;
    font-weight: 600;
    margin-top: 2px;
}

/* Enlace a la otra entrada (apoderados <-> personal) */
.otra-entrada {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px dashed #e4e1fb;
    text-align: center;
    font-size: 0.8em;
    color: #7a7a9a;
}
.otra-entrada a, .error a, .aviso-apoderado a { color: #6c5ce7; font-weight: 600; text-decoration: none; }
.otra-entrada a:hover, .error a:hover, .aviso-apoderado a:hover { text-decoration: underline; }
.error.con-enlace { flex-wrap: wrap; }

/* ---------- Portada (index.php): elegir entrada ---------- */
body.portada { overflow-x: hidden; overflow-y: auto; }
.tarjeta-portada { max-width: 520px; }
.tarjeta-portada .subtitulo { margin-bottom: 22px; }
.tarjeta-portada .pie { margin: 22px 0 0; }

.entradas { display: flex; flex-direction: column; gap: 14px; }

.opcion-entrada {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 18px;
    border: 2px solid #e4e1fb;
    border-radius: 16px;
    background: #fff;
    color: inherit;
    text-decoration: none;
    transition: transform 0.25s, box-shadow 0.25s, border-color 0.25s;
}
a.opcion-entrada:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 24px rgba(108, 92, 231, 0.18);
}
a.opcion-entrada:focus-visible { outline: none; box-shadow: 0 0 0 4px rgba(108, 92, 231, 0.25); }

.opcion-icono {
    flex: 0 0 54px;
    height: 54px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6em;
}
.opcion-texto { flex: 1; display: flex; flex-direction: column; gap: 2px; text-align: left; }
.opcion-texto strong { font-size: 1.02em; color: #2f2f4a; }
.opcion-texto small { font-size: 0.8em; color: #7a7a9a; line-height: 1.4; }
.opcion-texto em { font-style: normal; font-size: 0.74em; font-weight: 600; margin-top: 3px; }
.opcion-flecha { font-size: 1.3em; font-weight: 700; transition: transform 0.25s; }
a.opcion-entrada:hover .opcion-flecha { transform: translateX(4px); }

.opcion-entrada.apoderados .opcion-icono { background: #f3f0ff; }
.opcion-entrada.apoderados em, .opcion-entrada.apoderados .opcion-flecha { color: #6c5ce7; }
.opcion-entrada.apoderados:hover { border-color: #6c5ce7; }

.opcion-entrada.personal .opcion-icono { background: #e0fbf8; }
.opcion-entrada.personal em, .opcion-entrada.personal .opcion-flecha { color: #00866f; }
.opcion-entrada.personal:hover { border-color: #00b894; }

.opcion-entrada.deshabilitada { background: #f7f7fb; border-style: dashed; opacity: 0.75; cursor: default; }
/* Alumnos (login_3.php) */
.opcion-entrada.alumnos .opcion-icono { background: #fff4e0; }
.opcion-entrada.alumnos em, .opcion-entrada.alumnos .opcion-flecha { color: #c27400; }
.opcion-entrada.alumnos:hover { border-color: #f9a826; }
.chip-entrada.chip-alumnos { background: #fff4e0; color: #b36b00; }
/* Enlace al catálogo público de biblioteca (portada) */
.enlace-catalogo { display: block; margin-top: 16px; padding: 11px 14px; border-radius: 12px; background: #eef6ff; color: #0767b3; font-size: 0.86em; font-weight: 600; text-decoration: none; transition: background 0.2s; }
.enlace-catalogo:hover { background: #ddeeff; }
.pronto {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 8px;
    border-radius: 999px;
    background: #fff4e0;
    color: #c77800;
    font-size: 0.68em;
    font-weight: 600;
    vertical-align: middle;
}

@media (max-width: 480px) {
    .opcion-entrada { padding: 14px; gap: 12px; }
    .opcion-icono { flex-basis: 46px; height: 46px; font-size: 1.35em; }
}

/* Enlace "Volver al inicio" (portada) en las pantallas de ingreso */
.volver-portada { display: block; margin-top: 12px; font-size: 0.85em; font-weight: 600; text-align: center; color: #6c5ce7; text-decoration: none; }
.volver-portada:hover { color: #6c5ce7; text-decoration: underline; }
