﻿/* ===== RESET Y VARIABLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --color-primario: #b65c1d;
    --color-primario-hover: #9e4e19;
    --color-texto: #333;
    --color-texto-secundario: #666;
    --color-fondo: #f5f5f5;
    --color-blanco: #ffffff;
    --color-borde: #ddd;
    --sombra: 0 10px 25px rgba(0, 0, 0, 0.1);
    --borde-redondo: 25px;
    /* Añadir variable para el tamaño de imagen */
    --img-tamano: min(180px, 35vw); /* Ajustado a 180px como solicitaste */
}

/* ===== ESTILOS BASE ===== */
body {
    font-family: Arial, Helvetica, sans-serif;
    background-color: var(--color-fondo);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0;
    padding: 15px;
}

/* ===== CONTENEDOR PRINCIPAL ===== */
.contenedor {
    background: var(--color-blanco);
    padding: 40px 30px;
    width: 100%;
    max-width: 400px;
    border-radius: var(--borde-redondo);
    box-shadow: var(--sombra);
    text-align: center;
    transition: all 0.3s ease;
}

/* ===== TIPOGRAFÍA ===== */
h2 {
    color: #000;
    font-size: clamp(24px, 5vw, 28px);
    font-weight: 600;
    margin-bottom: 5px;
    letter-spacing: 1px;
}

.subtitulo {
    color: var(--color-texto-secundario);
    font-size: clamp(12px, 3vw, 14px);
    margin-bottom: 25px;
    font-style: italic;
}

/* ===== CAMPOS CON BOTÓN DE MOSTRAR CONTRASEÑA ===== */
.password-container {
    position: relative;
    width: 100%;
}

    .password-container input {
        width: 100%;
        padding-right: 45px;
    }

.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    margin: 0;
    font-size: 18px;
    border-radius: 50%;
    transition: all 0.3s ease;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

    .toggle-password:hover {
        background-color: rgba(0, 0, 0, 0.08);
        transform: translateY(-50%) scale(1.1);
    }

    .toggle-password:active {
        transform: translateY(-50%) scale(0.95);
    }

.eye-icon {
    font-size: 18px;
    opacity: 0.7;
    transition: opacity 0.3s;
    pointer-events: none;
}

.toggle-password:hover .eye-icon {
    opacity: 1;
}

/* Ajuste para móviles */
@media screen and (max-width: 480px) {
    .password-container input {
        padding-right: 40px;
    }

    .toggle-password {
        right: 8px;
        width: 32px;
        height: 32px;
    }

    .eye-icon {
        font-size: 16px;
    }
}

/* Ajuste para tablets */
@media screen and (max-width: 768px) {
    .toggle-password {
        right: 10px;
    }
}

/* Soporte para pantallas táctiles */
.toggle-password:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(182, 92, 29, 0.3);
    border-radius: 50%;
}

/* ===== IMAGEN DECORATIVA - VERSIÓN CORREGIDA ===== */
.imagen-decorativa {
    text-align: center;
    margin: 0 0 25px 0;
}

.img-cafe {
    /* Aumentado a 180px como solicitaste */
    width: min(180px, 40vw); /* Cambiado de 120px a 180px */
    height: auto;
    max-width: 100%;
    border-radius: 15px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    /* Mejor manejo de imágenes */
    object-fit: cover; /* Evita deformaciones */
    display: block; /* Elimina espacio extra debajo de la imagen */
    margin: 0 auto; /* Centrado perfecto */
}

    .img-cafe:hover {
        transform: scale(1.05);
        box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
    }

/* ===== CAMPOS DEL FORMULARIO ===== */
.campo {
    text-align: left;
    margin-bottom: 20px;
}

    .campo label {
        display: block;
        color: var(--color-texto);
        font-size: clamp(13px, 3vw, 14px);
        font-weight: 500;
        margin-bottom: 5px;
    }

.input-responsive {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--color-borde);
    border-radius: 10px;
    font-size: clamp(14px, 3.5vw, 16px);
    outline: none;
    transition: all 0.3s;
    background-color: #fafafa;
    -webkit-appearance: none;
    appearance: none;
}

    .input-responsive:focus {
        border-color: var(--color-primario);
        box-shadow: 0 0 0 3px rgba(182, 92, 29, 0.1);
    }

    .input-responsive::placeholder {
        color: #999;
        font-size: clamp(13px, 3vw, 14px);
    }

/* ===== BOTÓN ===== */
.btn-iniciar {
    width: 100%;
    padding: clamp(12px, 4vw, 14px);
    background-color: var(--color-primario);
    color: var(--color-blanco);
    border: none;
    border-radius: 12px;
    font-size: clamp(15px, 4vw, 16px);
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
    margin: 10px 0 20px 0;
    -webkit-tap-highlight-color: transparent;
}

    .btn-iniciar:hover {
        background-color: var(--color-primario-hover);
    }

    .btn-iniciar:active {
        transform: scale(0.98);
    }

/* ===== ENLACE DE REGISTRO ===== */
.registro {
    text-align: center;
    border-top: 1px solid #eee;
    padding-top: 20px;
}

    .registro p {
        color: var(--color-texto-secundario);
        font-size: clamp(13px, 3vw, 14px);
    }

.link-registro {
    color: var(--color-primario);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

    .link-registro:hover {
        text-decoration: underline;
    }

/* ===== MEDIA QUERIES ACTUALIZADOS ===== */

/* Tablets (hasta 768px) */
@media screen and (max-width: 768px) {
    .contenedor {
        max-width: 90%;
        padding: 35px 25px;
    }

    /* Tamaño de imagen para tablet */
    .img-cafe {
        width: 160px; /* Aumentado de 110px a 160px */
    }

    .campo {
        margin-bottom: 18px;
    }

    .input-responsive {
        padding: 11px 14px;
    }
}

/* Móviles grandes (hasta 480px) */
@media screen and (max-width: 480px) {
    body {
        padding: 10px;
        background: linear-gradient(135deg, var(--color-fondo) 0%, #e8e8e8 100%);
    }

    .contenedor {
        padding: 25px 20px;
        border-radius: 20px;
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    }

    h2 {
        margin-bottom: 3px;
    }

    .subtitulo {
        margin-bottom: 20px;
    }

    .imagen-decorativa {
        margin: 0 0 20px 0;
    }

    /* Tamaño de imagen para móvil grande */
    .img-cafe {
        width: 130px; /* Aumentado de 90px a 130px */
    }

    .campo {
        margin-bottom: 15px;
    }

    .input-responsive {
        padding: 10px 12px;
    }

    .btn-iniciar {
        margin: 5px 0 15px 0;
        padding: 12px;
    }

    .registro {
        padding-top: 15px;
    }
}

/* Móviles pequeños (hasta 320px) */
@media screen and (max-width: 320px) {
    .contenedor {
        padding: 20px 15px;
    }

    h2 {
        font-size: 22px;
    }

    .subtitulo {
        font-size: 11px;
    }

    /* Tamaño de imagen para móvil pequeño */
    .img-cafe {
        width: 100px; /* Aumentado de 70px a 100px */
    }

    .input-responsive {
        padding: 8px 10px;
    }

    .btn-iniciar {
        padding: 10px;
        font-size: 14px;
    }

    .registro p {
        font-size: 12px;
    }
}

/* ===== ORIENTACIÓN LANDSCAPE ===== */
@media screen and (orientation: landscape) and (max-height: 500px) {
    body {
        align-items: flex-start;
        padding-top: 20px;
    }

    .contenedor {
        margin: 20px auto;
    }

    /*  En lugar de ocultar, reducir tamaño */
    .imagen-decorativa {
        margin: 0 0 10px 0;
    }

    .img-cafe {
        width: 80px; /* Tamaño reducido pero visible */
    }
}

/* ===== PANTALLAS GRANDES ===== */
@media screen and (min-width: 1200px) {
    .contenedor {
        max-width: 450px;
        padding: 45px 40px;
    }

    /* Tamaño para desktop grande */
    .img-cafe {
        width: 220px; /* Aumentado de 140px a 220px */
    }

    h2 {
        font-size: 32px;
    }

    .subtitulo {
        font-size: 16px;
        margin-bottom: 30px; /* Más espacio para imagen grande */
    }

    .input-responsive {
        font-size: 16px;
    }
}

/* Para pantallas muy grandes (4K) */
@media screen and (min-width: 2000px) {
    .contenedor {
        max-width: 600px;
        padding: 60px 50px;
    }

    .img-cafe {
        width: 300px;
    }

    h2 {
        font-size: 42px;
    }

    .subtitulo {
        font-size: 20px;
    }
}

/* ===== ANIMACIONES ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.contenedor {
    animation: fadeIn 0.5s ease-out;
}

/*  Clase utilitaria para imágenes responsivas */
.img-responsive {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ===== ALERTAS ===== */
.alert {
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 25px;
    font-size: 14px;
    text-align: left;
    animation: slideIn 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    border-left: 5px solid #28a745;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-left: 5px solid #dc3545;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

