body {
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #f0f2f5;
    margin: 0;
    color: #333;
    padding: 20px;
    /* Añade un poco de padding al cuerpo */
    box-sizing: border-box;
    /* Incluye padding en el ancho total */
}

form {
    background-color: #fff;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    text-align: center;
    width: 100%;
    max-width: 400px;
    box-sizing: border-box;
}

h1 {
    color: #007bff;
    margin-bottom: 30px;
    font-size: 2em;
}

div {
    margin-bottom: 20px;
    text-align: left;
}

label {
    display: block;
    /* Esto hace que el label ocupe su propia línea */
    margin-bottom: 8px;
    font-weight: bold;
    color: #555;
}

input[type="text"],
input[type="password"] {
    width: 100%;
    /* Ajusta para padding y borde */
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1em;
    box-sizing: border-box;
    transition: border-color 0.3s ease;
}

input[type="text"]:focus,
input[type="password"]:focus {
    border-color: #007bff;
    outline: none;
}

.password-container {
    position: relative;
    /* Eliminado display: flex aquí para que el label no se alinee con el input */
}

.password-input-wrapper {
    /* Nuevo contenedor para el input y el icono */
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-wrapper input {
    flex-grow: 1;
    padding-right: 40px;
    /* Espacio para el icono */
}

.password-input-wrapper img {
    position: absolute;
    right: 10px;
    cursor: pointer;
    width: 20px;
    /* Ajusta el tamaño del icono */
    height: 20px;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.password-input-wrapper img:hover {
    opacity: 1;
}

button {
    background-color: #007bff;
    color: white;
    padding: 14px 25px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.1em;
    width: 100%;
    margin-top: 20px;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

button:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
}

.error-message {
    color: #dc3545;
    /* Color rojo para errores */
    margin-top: 15px;
    font-weight: bold;
    font-size: 0.95em;
}

/* --- Estilos Responsive --- */
@media (max-width: 600px) {
    form {
        padding: 30px 20px;
        /* Reduce el padding en pantallas pequeñas */
        border-radius: 0;
        /* Elimina el borde redondeado en pantallas muy pequeñas */
        box-shadow: none;
        /* Elimina la sombra en pantallas muy pequeñas */
        max-width: 100%;
        /* Asegura que ocupe todo el ancho disponible */
    }

    h1 {
        font-size: 1.8em;
        margin-bottom: 25px;
    }

    input[type="text"],
    input[type="password"],
    button {
        font-size: 0.95em;
        padding: 10px;
        /* Reduce el padding de inputs y botón */
    }

    .password-input-wrapper input {
        padding-right: 35px;
        /* Ajusta el espacio para el icono */
    }

    .password-input-wrapper img {
        width: 18px;
        /* Reduce el tamaño del icono */
        height: 18px;
        right: 8px;
    }
}

@media (max-width: 400px) {
    form {
        padding: 20px 15px;
        /* Más reducción de padding */
    }

    h1 {
        font-size: 1.6em;
        margin-bottom: 20px;
    }
}