/* ==========================================================================
   LOGIN STYLES - ZenCita
   Estilos específicos para la página de login
   Archivo: assets/css/login.css
   ========================================================================== */

/* ==========================================================================
   VARIABLES Y CONFIGURACIÓN BASE
   ========================================================================== */
:root {
    /* Colores principales */
    --primary-color: rgb(11, 163, 173);
    --primary-hover: rgba(154, 222, 227, 0.8);
    --error-color: #d63031;
    --error-bg: #ffe6e6;
    --info-color: #1976d2;
    --info-bg: #e3f2fd;

    /* Escala de grises */
    --text-dark: #333;
    --text-medium: #666;
    --text-light: #6c757d;
    --border-color: #e1e1e1;
    --white: #fff;

    /* Sombras */
    --shadow-light: rgba(0, 0, 0, 0.1);
    --shadow-medium: rgba(0, 0, 0, 0.2);
    --shadow-heavy: rgba(0, 0, 0, 0.3);

    /* Bordes redondeados */
    --border-radius-sm: 8px;
    --border-radius-md: 12px;
    --border-radius-lg: 16px;

    /* Transiciones */
    --transition: all 0.3s ease;
}

/* ==========================================================================
   ESTILOS BASE Y RESET
   ========================================================================== */
body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    font-family: 'Public Sans', sans-serif;
    -webkit-text-size-adjust: 100%;
}

/* Prevenir scroll horizontal */
html,
body {
    overflow-x: hidden;
}

/* ==========================================================================
   CONTENEDOR PRINCIPAL DEL LOGIN
   ========================================================================== */
.login-container {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}

/* Tarjeta de login - Estilo glassmorphism */
.login-card {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius-lg);
    padding: 32px 24px;
    box-shadow: 0 8px 32px var(--shadow-medium);
    width: 100%;
    max-width: 400px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-sizing: border-box;
}

/* ==========================================================================
   ENCABEZADO DEL LOGIN
   ========================================================================== */
.login-header {
    text-align: center;
    margin-bottom: 24px;
}

.login-header h2 {
    color: var(--text-dark);
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 24px;
    line-height: 1.3;
}

.login-header p {
    color: var(--text-medium);
    font-size: 15px;
    line-height: 1.4;
    margin: 0;
}

/* ==========================================================================
   FORMULARIO Y ELEMENTOS DE ENTRADA
   ========================================================================== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-dark);
    font-weight: 500;
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-md);
    font-size: 16px;
    transition: var(--transition);
    background: var(--white);
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(11, 163, 173, 0.1);
}

/* Cabecera del grupo de contraseña */
.form-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

/* ==========================================================================
   BOTONES PRINCIPALES
   ========================================================================== */
.btn-primary {
    width: 100%;
    padding: 16px;
    background: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: var(--border-radius-md);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.btn-primary:hover,
.btn-primary:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--primary-hover);
}

.btn-primary:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* ==========================================================================
   ENLACES Y TEXTO SECUNDARIO
   ========================================================================== */
.auth-link-text {
    text-align: center;
    margin-top: 20px;
    color: var(--text-medium);
    font-size: 14px;
    line-height: 1.4;
}

.auth-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.auth-link:hover {
    text-decoration: underline;
}

.auth-link:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.forgot-password {
    color: var(--primary-color) !important;
    text-decoration: none;
    font-size: 13px;
    white-space: nowrap;
}

.forgot-password:hover {
    text-decoration: underline;
}

.forgot-password:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* ==========================================================================
   MENSAJES DE ALERTA Y ERROR
   ========================================================================== */
.error-message {
    background: var(--error-bg);
    color: var(--error-color);
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 20px;
    border-left: 4px solid var(--error-color);
    font-size: 14px;
    line-height: 1.4;
}

.alert-info {
    background: var(--info-bg);
    color: var(--info-color);
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 20px;
    border-left: 4px solid var(--info-color);
    font-size: 14px;
    line-height: 1.4;
}

/* ==========================================================================
   BOTONES DE PRUEBA
   ========================================================================== */
.test-buttons-container {
    margin-top: 10px;
}

.test-buttons-row {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.test-buttons-row:first-child {
    margin-top: 0;
}

.test-btn {
    flex: 1;
    padding: 8px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: var(--transition);
    color: black;
    text-align: center;
    font-family: inherit;
}

.test-btn-owner {
    background: #4ECDC4;
}

.test-btn-admin {
    background: #D7BDE2;
}

.test-btn-client {
    background: #F8C471;
}

.test-btn-worker {
    background: #85C1E9;
}

.test-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.test-btn:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* ==========================================================================
   OVERLAY DE CARGA
   ========================================================================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.loading-content {
    background: var(--white);
    border-radius: var(--border-radius-md);
    padding: 2rem;
    text-align: center;
    box-shadow: 0 10px 30px var(--shadow-heavy);
    min-width: 200px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

.loading-text {
    color: var(--text-dark);
    font-weight: 500;
    font-size: 16px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* ==========================================================================
   DISEÑO RESPONSIVE - MÓVIL FIRST
   ========================================================================== */

/* Teléfonos pequeños (hasta 320px) */
@media (max-width: 320px) {
    .login-card {
        padding: 20px 16px;
    }

    .login-header h2 {
        font-size: 20px;
    }

    .form-group input {
        padding: 14px;
    }

    .test-buttons-row {
        flex-direction: column;
        gap: 8px;
    }
}

/* Teléfonos (hasta 480px) */
@media (max-width: 480px) {
    .login-container {
        padding: 12px;
        align-items: flex-start;
        padding-top: 40px;
    }

    .login-card {
        padding: 24px 20px;
        margin: 0;
        border-radius: var(--border-radius-md);
        max-width: 100%;
    }

    .login-header h2 {
        font-size: 22px;
    }

    .login-header p {
        font-size: 14px;
    }

    .form-group {
        margin-bottom: 16px;
    }

    .form-group input {
        padding: 16px;
        font-size: 16px;
    }

    .btn-primary {
        padding: 16px;
        font-size: 16px;
    }

    .auth-link-text {
        font-size: 13px;
    }
}

/* Tabletas (769px a 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .login-card {
        max-width: 450px;
        padding: 40px 32px;
    }
}

/* Pantallas grandes (desde 1200px) */
@media (min-width: 1200px) {
    .login-card {
        max-width: 450px;
    }
}

/* ==========================================================================
   MEJORAS DE ACCESIBILIDAD Y USABILIDAD
   ========================================================================== */

/* Tamaños mínimos para objetivos táctiles en móviles */
@media (max-width: 768px) {

    .btn-primary,
    .form-group input {
        min-height: 48px;
    }

    .auth-link,
    .forgot-password {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }

    .test-btn {
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* Safe area insets para teléfonos con notch */
@supports(padding: max(0px)) {
    .login-container {
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
        padding-bottom: max(16px, env(safe-area-inset-bottom));
    }
}

/* Pantallas de alta densidad */
@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {
    .login-card {
        border-width: 0.5px;
    }
}

/* Mejoras de rendimiento para animaciones */
@media (prefers-reduced-motion: reduce) {

    .btn-primary,
    .form-group input,
    .loading-overlay,
    .test-btn {
        transition: none;
    }

    .loading-spinner {
        animation: none;
        border: 4px solid #f3f3f3;
        border-top: 4px solid var(--primary-color);
    }

    .btn-primary:hover,
    .btn-primary:active,
    .test-btn:hover {
        transform: none;
    }
}

/* Mejoras de contraste para accesibilidad */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #0066cc;
        --error-color: #990000;
        --info-color: #004499;
        --text-dark: #000000;
        --text-medium: #333333;
        --border-color: #000000;
    }

    .login-card {
        border: 2px solid var(--border-color);
    }
}

.social-login-container {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e0e0e0;
}

.social-login-separator {
    text-align: center;
    margin-bottom: 1.5rem;
    position: relative;
}

.social-login-separator span {
    background: white;
    padding: 0 1rem;
    color: #666;
    font-size: 0.9rem;
}

.social-login-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.social-login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 1px solid #ddd;
    background: white;
    color: #333;
}

.social-login-btn:hover {
    background: #f5f5f5;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.social-login-btn.google-btn {
    border-color: #ddd;
}

.social-login-btn.google-btn:hover {
    border-color: #4285f4;
}

.social-logo {
    width: 20px;
    height: 20px;
    margin-right: 10px;
}