:root {
    --bg: #f7f9fc;
    --panel: #ffffff;
    --border: #e5e9f2;
    --text: #0f172a;
    --text-light: #64748b;
    --primary: #6366f1;
    --primary-600: #4f46e5;
    --primary-gradient: linear-gradient(135deg, #6366f1, #4f46e5);
    --shadow: 0 10px 30px rgba(2,6,23,.08);
    --shadow-lg: 0 20px 40px rgba(2,6,23,.12);
    --radius: 24px;
    --radius-sm: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Ubuntu, 'Helvetica Neue', sans-serif;
    background: var(--bg);
    min-height: 100vh;
    display: grid;
    place-items: center;
    color: var(--text);
    line-height: 1.5;
}

.container {
    width: 100%;
    padding: 16px;
}

.login-card {
    max-width: 900px;
    margin: 0 auto;
    background: var(--panel);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    overflow: hidden;
    min-height: 550px;
    transform: translateY(0);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.login-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

/* Mobile: sin hover effect para evitar problemas táctiles */
@media (max-width: 767px) {
    .login-card:hover {
        transform: translateY(0);
        box-shadow: var(--shadow);
    }
}

.card-side {
    flex: 1;
    padding: 40px;
}

/* Mobile: reducir padding */
@media (max-width: 767px) {
    .card-side {
        padding: 24px;
    }
}

.illustration {
    background-image: url('https://images.unsplash.com/photo-1579547944212-c4f4961a8dd8?auto=format&fit=crop&q=80');
    background-size: cover;
    background-position: center;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: white;
    padding: 60px 40px;
}

.illustration-overlay {
    position: absolute;
    inset: 0;
    background: var(--primary-gradient);
    opacity: 0.9;
    mix-blend-mode: multiply;
}

.illustration-content {
    position: relative;
    z-index: 1;
}

.illustration-content h2 {
    font-size: 2em;
    margin-bottom: 0.5em;
    font-weight: 700;
}

.form-side {
    display: flex;
    flex-direction: column;
}

.form-header {
    margin-bottom: 40px;
    text-align: center;
}

/* Mobile: reducir margin */
@media (max-width: 767px) {
    .form-header {
        margin-bottom: 24px;
    }
}

.logo {
    margin: 0 auto 20px;
    width: 48px;
    height: 48px;
}

/* Mobile: logo más pequeño */
@media (max-width: 767px) {
    .logo {
        width: 40px;
        height: 40px;
        margin-bottom: 16px;
    }
}

.logo-dot {
    width: 100%;
    height: 100%;
    background: var(--primary-gradient);
    border-radius: 50%;
    color: white;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 24px;
}

/* Mobile: logo texto más pequeño */
@media (max-width: 767px) {
    .logo-dot {
        font-size: 20px;
    }
}

.form-header h1 {
    font-size: 1.75em;
    margin-bottom: 0.5em;
}

/* Mobile: título más pequeño */
@media (max-width: 767px) {
    .form-header h1 {
        font-size: 1.5em;
    }
}

.subtitle {
    color: var(--text-light);
}

/* Mobile: subtitle más pequeño */
@media (max-width: 767px) {
    .subtitle {
        font-size: 0.875em;
    }
}

.login-form {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    position: relative;
}

.input-icon {
    position: relative;
}

.password-field {
    position: relative;
}

.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
    z-index: 10;
    height: 36px;
    width: 36px;
    margin: 0;
}

.toggle-password:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
}

.toggle-password:focus {
    outline: none;
    background: rgba(99, 102, 241, 0.1);
}

.toggle-password ion-icon {
    font-size: 20px;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Mobile: botón de toggle más grande para táctil */
@media (max-width: 767px) {
    .toggle-password {
        right: 8px;
        height: 40px;
        width: 40px;
    }
    
    .toggle-password ion-icon {
        font-size: 22px;
    }
}

.input-icon ion-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    font-size: 20px;
    pointer-events: none;
    transition: color 0.2s ease;
}

/* Mobile: ajustar posición del ícono */
@media (max-width: 767px) {
    .input-icon ion-icon {
        left: 14px;
        font-size: 18px;
    }
}

.input-icon input:focus + ion-icon {
    color: var(--primary);
}

input[type="text"],
input[type="password"] {
    width: 100%;
    padding: 14px 14px 14px 48px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text);
    font-size: 16px;
    transition: all 0.2s ease;
}

/* Input de contraseña con espacio para el botón toggle */
.password-field input[type="password"],
.password-field input[type="text"] {
    padding-right: 50px;
}

/* Mobile: inputs táctiles con altura mínima */
@media (max-width: 767px) {
    input[type="text"],
    input[type="password"] {
        padding: 12px 12px 12px 44px;
        min-height: 44px;
        font-size: 16px; /* evitar zoom en iOS */
    }
    
    .password-field input[type="password"],
    .password-field input[type="text"] {
        padding-right: 52px;
    }
}

input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99,102,241,.1);
}

.remember {
    display: flex;
    align-items: center;
    user-select: none;
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--text-light);
}

.checkbox input {
    display: none;
}

.checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-radius: 6px;
    position: relative;
    transition: all 0.2s ease;
}

/* Mobile: checkbox más grande para facilitar toque */
@media (max-width: 767px) {
    .checkmark {
        width: 22px;
        height: 22px;
    }
    
    .checkbox {
        padding: 8px 0;
        font-size: 0.9375em;
    }
}

.checkmark:after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) scale(0);
    transition: transform 0.2s ease;
}

.checkbox input:checked + .checkmark {
    background: var(--primary-gradient);
    border-color: var(--primary);
}

.checkbox input:checked + .checkmark:after {
    transform: rotate(45deg) scale(1);
}

.btn-login {
    margin-top: auto;
    padding: 14px 24px;
    background: var(--primary-gradient);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

/* Mobile: botón táctil con altura mínima */
@media (max-width: 767px) {
    .btn-login {
        padding: 12px 20px;
        min-height: 48px;
        font-size: 16px;
    }
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79,70,229,.3);
}

.btn-login ion-icon {
    font-size: 20px;
    transition: transform 0.2s ease;
}

.btn-login:hover ion-icon {
    transform: translateX(4px);
}

/* Botón de instalación PWA */
.btn-install {
    width: 100%;
    padding: 12px 24px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    margin-top: 12px;
}

.btn-install:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.btn-install:active {
    transform: translateY(0);
}

.btn-install ion-icon {
    font-size: 22px;
    transition: transform 0.2s ease;
}

.btn-install:hover ion-icon {
    transform: scale(1.1);
}

@media (max-width: 768px) {
    .login-card {
        flex-direction: column;
        border-radius: 16px;
        min-height: auto;
    }
    
    .illustration {
        display: none; /* Ocultar ilustración en mobile para ahorrar espacio */
    }
    
    .form-side {
        padding: 24px;
    }
}

/* Optimización para pantallas muy pequeñas (360px) */
@media (max-width: 400px) {
    .container {
        padding: 12px;
    }
    
    .login-card {
        border-radius: 12px;
    }
    
    .card-side {
        padding: 20px;
    }
    
    .form-header h1 {
        font-size: 1.375em;
    }
    
    .login-form {
        gap: 16px;
    }
}
