:root {
    --green-primary: #0F4D0F;
    --green-dark: #0F4D0F;
    --green-light: #eef1f4;
    --green-accent: #eef1f4;
    --gold-accent: #d97706;
    --bg-gradient: linear-gradient(135deg, #eef1f4 0%, #eef1f4 100%);
    --card-bg: rgba(255, 255, 255, 0.98);
    --text-main: #1f2937;
    --text-muted: #4b5563;
    --border-color: #eef1f4;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.55)), 
            url('fondo_login.jpg') no-repeat center center / cover; 
    background-size: cover;
    color: var(--text-main);
    margin: 0;
    padding: 50px 0;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

/* CONTENEDOR GENERAL */
.robot-login-box-wrapper {
    position: relative;
    width: 100%;
    max-width: 420px;
    margin-top: 100px;
    margin-bottom: 30px;
    box-sizing: border-box;
}

/* SECCIÓN SUPERIOR: CABEZA GRANDE Y MANITAS */
.robot-top-section {
    position: absolute;
    top: -125px;
    left: 50%;
    transform: translateX(-50%);
    width: 360px;
    height: 150px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

/* Manitas sujetando el borde */
.robot-hand-side {
    position: absolute;
    top: 85px;
    width: 48px;
    height: 48px;
    z-index: 5;
}

.hand-left {
    left: 30px;
}

.hand-right {
    right: 30px;
}

/* Cabeza del Robot */
.robot-peep-head {
    width: 220px;
    height: 200px;
    cursor: pointer;
    z-index: 10;
    transition: transform 0.3s ease;
}

.robot-peep-head:hover {
    transform: scale(1.03);
}

/* Animación de parpadeo y expresiones */
.robot-eye {
    transform-box: fill-box;
    transform-origin: center;
    animation: blink 5s infinite ease-in-out;
    transition: fill 0.3s ease;
}

#rightEye {
    animation-delay: 0.08s;
}

.robot-open-eyes,
.robot-closed-eyes {
    transition: opacity 0.2s ease;
}

.robot-closed-eyes {
    opacity: 0;
}

.robot-face,
.robot-sad,
.robot-angry,
.robot-loading {
    transition: opacity 0.18s ease;
}

.robot-sad {
    opacity: 0;
}

.robot-angry {
    opacity: 0;
}

.robot-thought-bubble {
    position: absolute;
    top: 5px;
    left: 50%;
    z-index: 20;
    padding: 6px 12px;
    border: 2px solid #263238;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 3px 8px rgba(15, 23, 42, 0.18);
    color: #b42318;
    font-size: 13px;
    font-weight: 900;
    line-height: 1;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 7px) scale(0.85);
    transition: opacity 0.18s ease, transform 0.24s ease;
}

.robot-thought-bubble::before,
.robot-thought-bubble::after {
    position: absolute;
    border: 2px solid #263238;
    border-radius: 50%;
    background: #ffffff;
    content: '';
}

.robot-thought-bubble::before {
    bottom: -8px;
    left: 12px;
    width: 7px;
    height: 7px;
}

.robot-thought-bubble::after {
    bottom: -15px;
    left: 8px;
    width: 4px;
    height: 4px;
}

.robot-loading {
    opacity: 0;
    pointer-events: none;
}

.robot-loading-track {
    fill: #0f172a;
    stroke: #0F4D0F;
    stroke-width: 2;
}

.robot-loading-progress {
    fill: #0F4D0F;
    animation: robot-loading-move 0.85s ease-in-out infinite alternate;
}

@keyframes robot-loading-move {
    from { transform: translateX(0); }
    to { transform: translateX(72px); }
}

.robot-peep-head.is-shy .robot-open-eyes {
    opacity: 0;
}

.robot-peep-head.is-shy .robot-closed-eyes {
    opacity: 1;
}

.robot-peep-head.is-sad .robot-face {
    opacity: 0;
}

.robot-peep-head.is-sad .robot-sad {
    opacity: 1;
}

.robot-peep-head.is-angry .robot-face,
.robot-peep-head.is-angry .robot-sad {
    opacity: 0;
}

.robot-peep-head.is-angry .robot-angry {
    opacity: 1;
}

.robot-peep-head.is-angry .robot-thought-bubble {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
}

.robot-peep-head.is-shy {
    transform: translateY(-3px) scale(1.02);
}

.robot-peep-head.is-loading {
    cursor: wait;
    transform: scale(1.02);
}

.robot-peep-head.is-loading .robot-face {
    opacity: 0;
}

.robot-peep-head.is-loading .robot-loading {
    opacity: 1;
}

.robot-peep-head.is-loading .robot-sad {
    opacity: 0;
}

.robot-peep-head.is-loading .robot-angry,
.robot-peep-head.is-loading .robot-thought-bubble {
    opacity: 0;
}

@keyframes blink {
    0%, 90%, 100% { transform: scaleY(1); }
    95% { transform: scaleY(0.1); }
}

@media (prefers-reduced-motion: reduce) {
    .robot-eye,
    .robot-open-eyes,
    .robot-closed-eyes,
    .robot-sad,
    .robot-angry,
    .robot-thought-bubble,
    .robot-loading-progress,
    .robot-face,
    .robot-loading,
    .robot-peep-head {
        animation: none;
        transition: none;
    }
}

/* PATITAS ASOMÁNDOSE ABAJO */
.robot-peep-feet {
    position: absolute;
    bottom: -22px;
    left: 50%;
    transform: translateX(-50%);
    width: 150px;
    height: 30px;
    z-index: 1;
}

/* RECUADRO DEL LOGIN */
.robot-body-card {
    position: relative;
    width: 100%;
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 2px solid var(--border-color);
    border-radius: 24px;
    padding: 2.2rem;
    box-shadow: 0 20px 35px -10px rgba(15,77,15, 0.18);
    box-sizing: border-box;
    z-index: 5;
}

/* Cabecera institucional con Logo Real */
.header-box {
    text-align: center;
    margin-bottom: 1.2rem;
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 4px;
}

.logo-img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.logo-title {
    font-size: 1.8rem;
    font-weight: 900;
    color: #0F4D0F;
    letter-spacing: 1.5px;
    margin: 0;
    text-transform: uppercase;
    font-family: 'Arial Black', Gadget, sans-serif;
}

.logo-subtitle {
    font-size: 0.8rem;
    font-weight: 700;
    color: #d97706;
    letter-spacing: 3px;
    margin: 0;
    text-transform: uppercase;
}

/* Estilos del Formulario */
.login-box h2 {
    font-size: 1.05rem;
    color: var(--text-main);
    margin-top: 0;
    margin-bottom: 1rem;
    border-bottom: 2px solid #f3f4f6;
    padding-bottom: 6px;
    text-align: center;
}

.login-message {
    margin: 0 0 1rem;
    padding: 10px 12px;
    border: 1px solid #fecaca;
    border-radius: 8px;
    background: #fef2f2;
    color: #b42318;
    font-size: 0.85rem;
}

.login-message[hidden] {
    display: none;
}

.form-group {
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}

input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.9rem;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #ffffff;
}

input:focus {
    outline: none;
    border-color: var(--green-primary);
    box-shadow: 0 0 0 3px rgba(15,77,15, 0.15);
}

.password-field { display:flex; align-items:stretch; gap:7px; width:100%; }
.password-field input { flex:1 1 auto; min-width:0; padding-right:12px; }
.password-toggle {
    display: grid;
    place-items: center;
    flex:0 0 42px;
    min-height:40px;
    padding:8px;
    border:1px solid #d1d5db;
    border-radius: 7px;
    background: #ffffff;
    color: #64748b;
    cursor: pointer;
}
.password-toggle:hover { background: #f1f5f9; border-color:var(--green-primary); color: var(--green-dark); }
.password-toggle:focus-visible { outline: 2px solid var(--green-primary); outline-offset: 1px; }
.password-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.password-eye-closed { display: none; }
.password-toggle[aria-pressed="true"] .password-eye-open { display: none; }
.password-toggle[aria-pressed="true"] .password-eye-closed { display: block; }

.enlace-contrasena {
    display: block;
    font-size: 0.75rem;
    color: var(--green-dark);
    text-decoration: none;
    margin-bottom: 1.2rem;
    text-align: right;
}

.enlace-contrasena:hover {
    text-decoration: underline;
}

button[type="submit"], .boton {
    width: 100%;
    background-color: var(--green-primary);
    color: white;
    border: none;
    padding: 10px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    box-sizing: border-box;
    text-align: center;
    text-decoration: none;
    display: block;
}

button[type="submit"]:hover, .boton:hover {
    background-color: var(--green-dark);
}

.divider {
    border: none;
    border-top: 1px solid #e5e7eb;
    margin: 1.2rem 0;
}

.boton-secundario {
    background-color: #f3f4f6;
    color: var(--text-main);
    border: 1px solid #d1d5db;
}

.boton-secundario:hover {
    background-color: #e5e7eb;
}
