:root {
    --cyan: #00e5c9;
    --cyan-glow: rgba(0, 229, 201, 0.4);
    --cyan-dim: rgba(0, 229, 201, 0.15);
    --cyan-dark: rgba(0, 229, 201, 0.08);
    --bg: #0a0f1a;
    --bg-card: rgba(15, 23, 42, 0.8);
    --bg-card-solid: #0f172a;
    --bg-input: rgba(15, 23, 42, 0.6);
    --border: rgba(0, 229, 201, 0.12);
    --border-hover: rgba(0, 229, 201, 0.35);
    --border-focus: rgba(0, 229, 201, 0.6);
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    --error: #ef4444;
    --error-bg: rgba(239, 68, 68, 0.1);
    --success: #22c55e;
    --success-bg: rgba(34, 197, 94, 0.1);
}

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

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* ===== CANVAS DE PARTÍCULAS ===== */
#particles-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* ===== GRID TECNOLÓGICO ===== */
.tech-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(0, 229, 201, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 229, 201, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    mask-image: radial-gradient(ellipse at 50% 50%, black 30%, transparent 70%);
    -webkit-mask-image: radial-gradient(ellipse at 50% 50%, black 30%, transparent 70%);
}

/* ===== ORB GLOW ===== */
.orb-glow {
    position: fixed;
    width: 700px;
    height: 700px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 229, 201, 0.1) 0%, transparent 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
    pointer-events: none;
    animation: orbPulse 6s ease-in-out infinite;
}

@keyframes orbPulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.5; }
    50% { transform: translate(-50%, -50%) scale(1.2); opacity: 0.9; }
}

/* ===== SCANLINE ===== */
.scanline {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--cyan), transparent);
    opacity: 0.12;
    z-index: 2;
    pointer-events: none;
    animation: scanMove 10s linear infinite;
}

@keyframes scanMove {
    0% { top: -3px; }
    100% { top: 100vh; }
}

/* ===== LAYOUT PRINCIPAL ===== */
.main-container {
    position: relative;
    z-index: 10;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.login-wrapper {
    display: flex;
    width: 100%;
    max-width: 1100px;
    min-height: 600px;
    animation: fadeIn 0.8s ease-out;
}

/* ===== PANEL IZQUIERDO: BRANDING ===== */
.brand-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 60px 50px;
    position: relative;
}

.brand-logo {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 32px;
}

.brand-logo h1 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #fff 0%, var(--cyan) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.brand-tagline {
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 20px;
}

.brand-tagline span {
    color: var(--cyan);
    font-weight: 600;
}

.brand-desc {
    font-size: 1rem;
    color: var(--text-dim);
    line-height: 1.7;
    max-width: 380px;
}

.brand-features {
    margin-top: 40px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.feature-item svg {
    width: 20px;
    height: 20px;
    color: var(--cyan);
    flex-shrink: 0;
}

.brand-footer {
    margin-top: auto;
    padding-top: 40px;
    font-size: 0.75rem;
    color: var(--text-dim);
    letter-spacing: 0.05em;
}

/* ===== PANEL DERECHO: FORMULARIO (estilo CRM) ===== */
.form-panel {
    width: 480px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 40px;
}

.form-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 44px 40px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    position: relative;
    overflow: hidden;
}

.form-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--cyan), transparent);
    opacity: 0.6;
}

/* Header del formulario */
.form-header {
    text-align: center;
    margin-bottom: 32px;
}

.logo-circle {
    width: 64px;
    height: 64px;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(0, 229, 201, 0.15), rgba(0, 229, 201, 0.05));
    border: 1px solid rgba(0, 229, 201, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    box-shadow: 0 0 20px var(--cyan-dim);
    overflow: hidden;
}

.logo-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 18px;
}

.form-header h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.4rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 8px;
    line-height: 1.3;
}

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

/* ===== CAMPOS DE FORMULARIO ===== */
.form-group {
    margin-bottom: 16px;
    position: relative;
}

.input-wrapper {
    position: relative;
}

.input-wrapper .input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
    transition: color 0.3s;
    pointer-events: none;
}

.input-wrapper .input-icon svg {
    width: 18px;
    height: 18px;
}

.form-input {
    width: 100%;
    padding: 14px 16px 14px 48px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 14px;
    color: var(--text);
    font-size: 0.95rem;
    font-family: 'Inter', sans-serif;
    transition: all 0.3s ease;
    outline: none;
}

.form-input::placeholder {
    color: var(--text-dim);
}

.form-input:focus {
    border-color: var(--border-focus);
    background: rgba(15, 23, 42, 0.8);
    box-shadow: 0 0 0 3px var(--cyan-dark), 0 0 20px var(--cyan-dim);
}

.form-input:focus + .input-icon,
.input-wrapper:focus-within .input-icon {
    color: var(--cyan);
}

/* Password con ojo */
.input-wrapper.password-wrapper .form-input {
    padding-right: 48px;
}

.toggle-password {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-dim);
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s;
    border-radius: 6px;
}

.toggle-password:hover {
    color: var(--cyan);
    background: rgba(0, 229, 201, 0.08);
}

.toggle-password svg {
    width: 20px;
    height: 20px;
}

/* ===== BOTÓN LOGIN ===== */
.btn-login {
    width: 100%;
    padding: 16px;
    margin-top: 8px;
    background: linear-gradient(135deg, var(--cyan), #00b4a0);
    border: none;
    border-radius: 14px;
    color: var(--bg);
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    letter-spacing: 0.02em;
}

.btn-login::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;
}

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

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px var(--cyan-glow), 0 0 40px var(--cyan-dim);
}

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

.btn-login:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-login .spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(10, 15, 26, 0.3);
    border-top-color: var(--bg);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}

.btn-login.loading .btn-text {
    display: none;
}

.btn-login.loading .spinner {
    display: block;
}

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

/* ===== OLVIDASTE CONTRASEÑA ===== */
.forgot-link {
    display: block;
    text-align: center;
    margin-top: 20px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
    transition: color 0.3s;
    background: none;
    border: none;
    cursor: pointer;
}

.forgot-link:hover {
    color: var(--cyan);
}

/* ===== MODAL: RECUPERAR CONTRASEÑA ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 15, 26, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    margin: 20px;
    position: relative;
    transform: translateY(30px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.5);
}

.modal-overlay.active .modal-card {
    transform: translateY(0) scale(1);
}

.modal-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--cyan), transparent);
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: none;
    border: 1px solid var(--border);
    color: var(--text-dim);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.modal-close:hover {
    border-color: var(--border-hover);
    color: var(--text);
    background: rgba(0, 229, 201, 0.05);
}

.modal-close svg {
    width: 16px;
    height: 16px;
}

.modal-header {
    text-align: center;
    margin-bottom: 28px;
}

.modal-header h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.25rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 6px;
}

.modal-header p {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.modal-form .form-group {
    margin-bottom: 20px;
}

.modal-form .btn-login {
    margin-top: 8px;
}

.modal-back {
    display: block;
    text-align: center;
    margin-top: 20px;
    color: var(--text-dim);
    font-size: 0.85rem;
    text-decoration: none;
    transition: color 0.3s;
    background: none;
    border: none;
    cursor: pointer;
    width: 100%;
    font-family: 'Inter', sans-serif;
}

.modal-back:hover {
    color: var(--cyan);
}

/* ===== ESTADO ÉXITO EN MODAL ===== */
.success-state {
    text-align: center;
    display: none;
}

.success-state.show {
    display: block;
    animation: fadeIn 0.5s ease;
}

.success-state .success-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--success-bg);
    border: 1px solid rgba(34, 197, 94, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.success-state .success-icon svg {
    width: 32px;
    height: 32px;
    color: var(--success);
}

.success-state h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.2rem;
    color: #fff;
    margin-bottom: 8px;
}

.success-state p {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 24px;
}

/* ===== DIVIDER ===== */
.divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 24px 0;
    color: var(--text-dim);
    font-size: 0.8rem;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border), transparent);
}

/* ===== SSO / OAUTH ===== */
.sso-buttons {
    display: flex;
    gap: 12px;
}

.btn-sso {
    flex: 1;
    padding: 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-muted);
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-sso:hover {
    border-color: var(--border-hover);
    background: rgba(15, 23, 42, 0.8);
    color: var(--text);
}

.btn-sso svg {
    width: 18px;
    height: 18px;
}

/* ===== FOOTER DEL FORMULARIO ===== */
.form-footer {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    text-align: center;
}

.form-footer p {
    font-size: 0.8rem;
    color: var(--text-dim);
}

/* ===== ALERTAS ===== */
.alert {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.85rem;
    margin-bottom: 20px;
    display: none;
    align-items: center;
    gap: 10px;
    animation: shake 0.4s ease;
}

.alert.show {
    display: flex;
}

.alert-error {
    background: var(--error-bg);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

.alert-success {
    background: var(--success-bg);
    border: 1px solid rgba(34, 197, 94, 0.2);
    color: #86efac;
}

.alert svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}

/* ===== ANIMACIONES ===== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
    .login-wrapper {
        flex-direction: column;
        max-width: 480px;
    }
    .brand-panel {
        padding: 40px 30px;
        text-align: center;
        align-items: center;
    }
    .brand-desc {
        max-width: 100%;
    }
    .brand-features {
        display: none;
    }
    .brand-footer {
        display: none;
    }
    .form-panel {
        width: 100%;
        padding: 0 20px 40px;
    }
    .form-card {
        padding: 32px 28px;
    }
}

@media (max-width: 480px) {
    .brand-logo h1 {
        font-size: 1.8rem;
    }
    .form-card {
        padding: 28px 22px;
        border-radius: 20px;
    }
    .form-header h2 {
        font-size: 1.2rem;
    }
}
