@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800;900&display=swap');

:root {
    --bg-dark: #070a13;
    --bg-panel: #0b0f19;
    --bg-card: rgba(15, 23, 42, 0.6);
    --bg-input: rgba(15, 23, 42, 0.8);
    --color-primary: #3b82f6; /* Modern Blue */
    --color-primary-hover: #2563eb;
    --color-primary-glow: rgba(59, 130, 246, 0.15);
    --color-success: #10b981; /* Modern Green */
    --color-success-hover: #059669;
    --color-success-glow: rgba(16, 185, 129, 0.15);
    --color-danger: #ef4444;
    --color-danger-bg: rgba(239, 68, 68, 0.1);
    --color-danger-border: rgba(239, 68, 68, 0.2);
    --border-card: rgba(255, 255, 255, 0.05);
    --border-input: rgba(255, 255, 255, 0.08);
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --text-label: #e5e7eb;
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-sans);
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ══════════════════════════════════════════════════
   SPLIT LAYOUT SYSTEM
   ══════════════════════════════════════════════════ */
.login-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* Visual Panel (Left side) */
.login-visual-panel {
    flex: 1.3;
    position: relative;
    background-color: var(--bg-dark);
    background-image: radial-gradient(circle at 30% 30%, #0d1527 0%, #070a13 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 6% 8%;
    overflow: hidden;
    border-right: 1px solid rgba(255, 255, 255, 0.02);
}

.pcb-ambient-layer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 50% 50%, rgba(16, 185, 129, 0.03) 0%, transparent 60%);
    pointer-events: none;
}

.pcb-grid-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.18;
    pointer-events: none;
}

.pcb-grid-svg svg {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.visual-content {
    position: relative;
    z-index: 10;
    max-width: 600px;
    animation: fadeInVisual 1s ease-out;
}

.visual-logo-container {
    margin-bottom: 2.5rem;
}

.visual-logo {
    height: 64px;
    width: auto;
    object-fit: contain;
}

.visual-title {
    font-size: clamp(2rem, 3.5vw, 3rem);
    font-weight: 800;
    line-height: 1.2;
    color: #ffffff;
    margin-bottom: 1.5rem;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #ffffff 0%, #d1d5db 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.visual-subtitle {
    font-size: 1.15rem;
    color: var(--text-muted);
    line-height: 1.6;
    font-weight: 400;
}

/* Form Panel (Right side) */
.login-form-panel {
    width: 480px;
    min-width: 450px;
    background-color: var(--bg-panel);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 3rem 2.5rem;
    position: relative;
    z-index: 20;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.25);
}

.login-card-container {
    width: 100%;
    max-width: 380px;
    margin: 0 auto;
    animation: fadeInForm 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Mobile-only and Header branding */
.form-logo-container {
    display: none;
    justify-content: center;
    margin-bottom: 2rem;
}

.form-logo {
    height: 48px;
    width: auto;
    object-fit: contain;
}

.form-header {
    margin-bottom: 2.5rem;
}

.form-header h2 {
    font-size: 1.8rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 0.5rem;
    letter-spacing: -0.01em;
}

.form-header p {
    font-size: 0.95rem;
    color: var(--text-muted);
}

/* ══════════════════════════════════════════════════
   FORM CONTROLS & FIELDS
   ══════════════════════════════════════════════════ */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-label);
    margin-bottom: 0.5rem;
}

.password-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.forgot-password-link {
    font-size: 0.8rem;
    color: var(--color-primary);
    text-decoration: none;
    transition: color 0.2s;
}

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

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 1rem;
    color: var(--text-muted);
    font-size: 1rem;
    pointer-events: none;
    transition: color 0.2s;
}

.form-input {
    width: 100%;
    background-color: var(--bg-input);
    border: 1px solid var(--border-input);
    border-radius: 8px;
    padding: 0.75rem 1rem 0.75rem 2.75rem;
    color: #ffffff;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}

.form-input::placeholder {
    color: rgba(156, 163, 175, 0.45);
}

.form-input:focus {
    outline: none;
    border-color: var(--color-primary);
    background-color: rgba(15, 23, 42, 0.95);
    box-shadow: 0 0 0 4px var(--color-primary-glow);
}

.form-input:focus ~ .input-icon {
    color: var(--color-primary);
}

/* Mostrar/Ocultar contraseña */
.toggle-password {
    position: absolute;
    right: 0.75rem;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: color 0.2s;
}

.toggle-password:hover {
    color: #ffffff;
}

.toggle-password:focus {
    outline: none;
    color: var(--color-primary);
}

/* Recordar Sesión Checkbox */
.form-actions-row {
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
}

.remember-me-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-muted);
    user-select: none;
}

.remember-me-checkbox input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border: 1px solid var(--border-input);
    border-radius: 4px;
    background-color: var(--bg-input);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: background-color 0.2s, border-color 0.2s;
}

.remember-me-checkbox input[type="checkbox"]:checked {
    background-color: var(--color-success);
    border-color: var(--color-success);
}

.remember-me-checkbox input[type="checkbox"]:checked::after {
    content: "✓";
    font-size: 11px;
    color: #ffffff;
    font-weight: bold;
    position: absolute;
}

.remember-me-checkbox input[type="checkbox"]:focus {
    outline: none;
    box-shadow: 0 0 0 3px var(--color-success-glow);
}

/* ══════════════════════════════════════════════════
   BUTTONS & ALERTS
   ══════════════════════════════════════════════════ */
.submit-btn {
    width: 100%;
    background-color: var(--color-success);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 0.85rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: background-color 0.2s, transform 0.1s, box-shadow 0.2s;
}

.submit-btn:hover:not(:disabled) {
    background-color: var(--color-success-hover);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.submit-btn:active:not(:disabled) {
    transform: scale(0.985);
}

.submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.submit-btn:focus {
    outline: none;
    box-shadow: 0 0 0 4px var(--color-success-glow);
}

.btn-icon {
    font-size: 0.9rem;
    transition: transform 0.2s;
}

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

/* Alertas */
.login-alert {
    padding: 0.85rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    line-height: 1.4;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    animation: slideDown 0.3s ease-out;
}

.alert-danger {
    background-color: var(--color-danger-bg);
    border: 1px solid var(--color-danger-border);
    color: #fca5a5;
}

.alert-danger i {
    color: var(--color-danger);
    margin-top: 0.1rem;
}

.alert-success {
    background-color: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: #a7f3d0;
}

.alert-success i {
    color: var(--color-success);
    margin-top: 0.1rem;
}

.alert-warning {
    background-color: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.2);
    color: #fde68a;
}

.alert-warning i {
    color: #f59e0b;
    margin-top: 0.1rem;
}

/* ══════════════════════════════════════════════════
   FOOTER & BRANDS
   ══════════════════════════════════════════════════ */
.form-footer {
    margin-top: 3rem;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.03);
    padding-top: 1.5rem;
}

.support-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.support-link {
    color: var(--text-main);
    text-decoration: underline;
    transition: color 0.2s;
}

.support-link:hover {
    color: var(--color-primary);
}

.horizonlabs-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.horizonlabs-brand a {
    color: var(--text-main);
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s;
}

.horizonlabs-brand a:hover {
    color: var(--color-primary);
}

/* ══════════════════════════════════════════════════
   ANIMATIONS & RESPONSIVENESS
   ══════════════════════════════════════════════════ */
@keyframes fadeInVisual {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInForm {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

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

/* Responsive breakdowns */
@media (max-width: 1023px) {
    .login-visual-panel {
        display: none;
    }
    
    .login-form-panel {
        width: 100%;
        min-width: 100%;
        background-color: var(--bg-dark);
        background-image: radial-gradient(circle at 50% 50%, #0f172a 0%, #070a13 100%);
        padding: 3rem 1.5rem;
    }
    
    .login-card-container {
        max-width: 360px;
    }
    
    .form-logo-container {
        display: flex;
    }
}

@media (max-height: 700px) and (min-width: 1024px) {
    .login-visual-panel {
        padding: 3rem;
    }
    .form-footer {
        margin-top: 1.5rem;
    }
}

/* ══════════════════════════════════════════════════
   ACCESSIBILITY: REDUCED MOTION PREFERENCE
   ══════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-delay: 0s !important;
        animation-duration: 0s !important;
        animation-iteration-count: 1 !important;
        transition-delay: 0s !important;
        transition-duration: 0s !important;
    }
    
    .pcb-grid-svg animate {
        display: none !important;
    }
    
    .submit-btn:hover:not(:disabled) .btn-icon {
        transform: none !important;
    }
}
