/**
 * Dr. Man - Sistema de Gestión de Mantenimiento
 * Estilos para login de aplicación web (Desktop-first)
 */

:root {
    /* Colores Dr. Simi */
    --primary: #29B6F6;
    --primary-dark: #1E88E5;
    --primary-light: #4FC3F7;
    --accent: #FFD700;
    --accent-dark: #FFC107;
    
    /* Grises */
    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --gray-600: #4B5563;
    --gray-700: #374151;
    --gray-800: #1F2937;
    --gray-900: #111827;
    
    /* Estados */
    --error: #EF4444;
    --error-bg: #FEF2F2;
    --success: #10B981;
    --success-bg: #ECFDF5;
    
    /* Sombras */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    /* Transiciones */
    --transition: all 0.2s ease;
}

/* Reset y base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Layout principal */
.login-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Panel de branding (Izquierda) */
.brand-panel {
    flex: 1;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.brand-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.3;
}

.brand-content {
    position: relative;
    z-index: 1;
    max-width: 500px;
    width: 100%;
}

.brand-header {
    text-align: center;
    margin-bottom: 60px;
}

.brand-logo {
    width: 120px;
    height: 120px;
    margin-bottom: 24px;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.2));
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-15px); }
}

.brand-title {
    font-size: 3rem;
    font-weight: 800;
    color: white;
    margin-bottom: 12px;
    letter-spacing: -0.02em;
}

.brand-subtitle {
    font-size: 1.25rem;
    color: rgba(255, 255, 255, 0.95);
    font-weight: 500;
}

.brand-features {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.feature-item {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.feature-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.feature-icon svg {
    width: 24px;
    height: 24px;
    color: white;
}

.feature-text h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: white;
    margin-bottom: 6px;
}

.feature-text p {
    font-size: 0.9375rem;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.5;
}

.brand-footer {
    margin-top: 60px;
    text-align: center;
    padding-top: 40px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.brand-footer p {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.875rem;
}

/* Panel de formulario (Derecha) */
.form-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
    position: relative;
}

.form-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 60px;
    max-width: 520px;
    width: 100%;
    margin: 0 auto;
}

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

.form-header h2 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 12px;
    letter-spacing: -0.02em;
}

.form-header p {
    font-size: 1rem;
    color: var(--gray-600);
}

/* Alerts */
.alert {
    display: flex;
    gap: 12px;
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 24px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-error {
    background: var(--error-bg);
    border: 1px solid var(--error);
}

.alert-success {
    background: var(--success-bg);
    border: 1px solid var(--success);
}

.alert-icon {
    flex-shrink: 0;
}

.alert-icon svg {
    width: 20px;
    height: 20px;
}

.alert-error .alert-icon svg {
    color: var(--error);
}

.alert-success .alert-icon svg {
    color: var(--success);
}

.alert-content {
    font-size: 0.9375rem;
    line-height: 1.5;
}

.alert-error .alert-content {
    color: #991B1B;
}

.alert-success .alert-content {
    color: #065F46;
}

/* Formulario */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700);
    letter-spacing: 0.01em;
}

.input-group {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    z-index: 1;
}

.input-icon svg {
    width: 20px;
    height: 20px;
    color: var(--gray-400);
    transition: var(--transition);
}

/* CORREGIDO: Usar focus-within en lugar de ~ */
.input-group:focus-within .input-icon svg {
    color: var(--primary);
}

.form-input {
    width: 100%;
    padding: 14px 16px 14px 48px;
    border: 2px solid var(--gray-200);
    border-radius: 10px;
    font-size: 1rem;
    font-family: inherit;
    color: var(--gray-900);
    background: white;
    transition: var(--transition);
}

.form-input:hover {
    border-color: var(--gray-300);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--gray-50);
    box-shadow: 0 0 0 3px rgba(41, 182, 246, 0.1);
}

.form-input::placeholder {
    color: var(--gray-400);
}

.form-input.error {
    border-color: var(--error);
}

.form-input.error:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.input-group:focus-within.error .input-icon svg {
    color: var(--error);
}

.field-error {
    font-size: 0.875rem;
    color: var(--error);
    font-weight: 500;
    transition: var(--transition);
}

/* Password toggle button */
.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: var(--transition);
    z-index: 2;
}

.password-toggle:hover {
    background: var(--gray-100);
}

.password-toggle:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.password-toggle svg {
    width: 20px;
    height: 20px;
    color: var(--gray-500);
    transition: var(--transition);
}

.password-toggle:hover svg {
    color: var(--gray-700);
}

/* Actions */
.form-actions {
    display: flex;
    justify-content: flex-end;
}

.link-forgot {
    font-size: 0.9375rem;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.link-forgot:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.link-forgot:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Botón submit */
.btn-submit {
    width: 100%;
    padding: 16px 24px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    position: relative;
    overflow: hidden;
}

.btn-submit::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.btn-submit:hover::before {
    left: 100%;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

.btn-submit:focus {
    outline: 3px solid rgba(41, 182, 246, 0.4);
    outline-offset: 2px;
}

.btn-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.btn-submit:disabled:hover {
    transform: none;
    box-shadow: var(--shadow-md);
}

.btn-arrow {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
}

.btn-submit:not(:disabled):hover .btn-arrow {
    transform: translateX(4px);
}

/* Spinner de carga */
.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-left: 8px;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Footer del formulario */
.form-footer {
    margin-top: 32px;
    text-align: center;
}

.form-footer p {
    font-size: 0.875rem;
    color: var(--gray-600);
}

.form-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.form-footer a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.form-footer a:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Footer info */
.footer-info {
    padding: 24px 60px;
    border-top: 1px solid var(--gray-200);
    text-align: center;
}

.footer-info p {
    font-size: 0.875rem;
    color: var(--gray-500);
}

/* Responsive */
@media (max-width: 1024px) {
    .brand-panel {
        padding: 40px;
    }
    
    .form-container {
        padding: 40px;
    }
    
    .footer-info {
        padding: 24px 40px;
    }
}

@media (max-width: 768px) {
    .login-wrapper {
        flex-direction: column;
    }
    
    .brand-panel {
        min-height: 40vh;
        padding: 40px 24px;
    }
    
    .brand-header {
        margin-bottom: 40px;
    }
    
    .brand-logo {
        width: 80px;
        height: 80px;
    }
    
    .brand-title {
        font-size: 2rem;
    }
    
    .brand-subtitle {
        font-size: 1rem;
    }
    
    .brand-features {
        gap: 24px;
    }
    
    .feature-item {
        gap: 16px;
    }
    
    .feature-icon {
        width: 40px;
        height: 40px;
    }
    
    .feature-text h3 {
        font-size: 1rem;
    }
    
    .feature-text p {
        font-size: 0.875rem;
    }
    
    .brand-footer {
        margin-top: 40px;
        padding-top: 24px;
    }
    
    .form-container {
        padding: 40px 24px;
    }
    
    .form-header h2 {
        font-size: 1.5rem;
    }
    
    .footer-info {
        padding: 24px;
    }
}

@media (max-width: 480px) {
    .form-container {
        padding: 32px 20px;
    }
    
    .form-header {
        margin-bottom: 32px;
    }
    
    .login-form {
        gap: 20px;
    }
    
    .btn-submit {
        padding: 14px 20px;
    }
}

/* Accesibilidad: Prefers Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .brand-logo {
        animation: none;
    }
    
    .btn-submit::before {
        display: none;
    }
}

/* Mejorar contraste en modo de alto contraste */
@media (prefers-contrast: high) {
    .form-input {
        border-width: 3px;
    }
    
    .btn-submit {
        border: 3px solid var(--primary-dark);
    }
    
    .link-forgot,
    .form-footer a {
        text-decoration: underline;
    }
}