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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    background: #000;
    min-height: 100vh;
    overflow-x: hidden;
}

.main-container {
    display: flex;
    min-height: 100vh;
    position: relative;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    gap: 4rem; /* Separación fija y moderada */
    flex-wrap: wrap;
}

/* Sección de imagen */
.image-section {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #0a0e12;
    z-index: 0;
    overflow: hidden;
}

#auth-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: auto;
    z-index: 1;
}

.image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, transparent 0%, rgba(0,0,0,0.8) 100%);
    z-index: 2;
    pointer-events: none;
}

.image-content {
    z-index: 2;
    text-align: center;
    max-width: 500px;
    padding: 2rem;
}

.image-content h1 {
    font-size: 3.5rem;
    font-weight: 900;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.image-content p {
    font-size: 1.3rem;
    opacity: 0.9;
    line-height: 1.6;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    z-index: 5;
    position: relative;
}

.container-3d-wrapper {
    perspective: 1200px;
    display: inline-block;
    width: 60px;
    height: 48px;
    vertical-align: middle;
    transform: scale(1.6);
    transform-origin: center center;
    margin-left: 0; /* Reiniciado a 0 para que use el gap natural */
    margin-bottom: 5px; /* Alineación vertical fina respecto a la palabra Log */
}

.container-3d {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transform: rotateX(-15deg) rotateY(25deg);
}

.container-3d .face {
    position: absolute;
    top: 50%;
    left: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #1d9bf0;
    /* Efecto corrugado de contenedor de carga */
    background: repeating-linear-gradient(90deg, rgba(29, 155, 240, 0.1), rgba(29, 155, 240, 0.1) 4px, rgba(0, 0, 0, 0.6) 4px, rgba(0, 0, 0, 0.6) 8px);
    box-shadow: inset 0 0 10px rgba(29, 155, 240, 0.3);
}

.container-3d .front, .container-3d .back { width: 60px; height: 48px; }
.container-3d .right, .container-3d .left { width: 32px; height: 48px; }
.container-3d .top, .container-3d .bottom { width: 60px; height: 32px; background: #0a0e12; border: 2px solid #1d9bf0; }

.container-3d .front  { transform: translate(-50%, -50%) translateZ(16px); }
.container-3d .back   { transform: translate(-50%, -50%) rotateY(180deg) translateZ(16px); }
.container-3d .right  { transform: translate(-50%, -50%) rotateY(90deg) translateZ(30px); }
.container-3d .left   { transform: translate(-50%, -50%) rotateY(-90deg) translateZ(30px); }
.container-3d .top    { transform: translate(-50%, -50%) rotateX(90deg) translateZ(24px); }
.container-3d .bottom { transform: translate(-50%, -50%) rotateX(-90deg) translateZ(24px); }

.ia-text {
    font-size: 1.6rem;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 0 8px #1d9bf0;
}

.brand-column {
    flex: 0 1 450px; /* Tamaño máximo fijo para que no crezca sin límite */
    min-width: 320px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem 0;
}

.main-logo {
    animation: float 6s ease-in-out infinite;
    border-radius: 16px;
    max-height: 180px !important;
    background-color: transparent;
}

.company-logo-wrapper {
    width: 180px;
    height: 180px;
    background-color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 0 25px rgba(255, 255, 255, 0.15);
    margin: 0 auto;
    animation: float 6s ease-in-out infinite;
    padding: 15px; /* Crea un marco interior blanco */
}

.company-custom-logo {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Asegura que no se deforme ni se recorte, respetando sus proporciones rectangulares */
}

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

.form-column {
    flex: 0 1 480px; /* Tamaño máximo en Desktop */
    min-width: 320px;
    z-index: 10;
    display: flex;
    justify-content: center;
}

.glass-card {
    background: rgba(15, 20, 25, 0.65);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    padding: 2.5rem 2.5rem;
    width: 100%;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6);
}

/* Sección del formulario */
.form-section {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
}

.brand-header {
    margin-bottom: 2rem;
}

.brand-title {
    font-size: 4rem;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px; /* Separación pedida */
    line-height: 1;
}

.brand-subtitle {
    font-size: 1.25rem;
    color: #8899a6;
    margin-top: 1rem;
}

.logo-container {
    text-align: center;
    margin-bottom: 2rem;
}

.logo-icon {
    color: #1d9bf0;
    background: rgba(29, 155, 240, 0.1);
    padding: 1rem;
    border-radius: 50%;
    margin-bottom: 0.5rem;
}

.form-container {
    max-width: 350px;
    margin: 0 auto;
    width: 100%;
}

.form-title {
    color: #fff;
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    text-align: center;
}

.user-type-selector {
    margin-bottom: 2rem;
}

.user-type-buttons {
    display: flex;
    border: 1px solid #536471;
    border-radius: 50px;
    overflow: hidden;
    background: #16181c;
}

.user-type-btn {
    flex: 1;
    padding: 12px 16px;
    background: transparent;
    color: #e7e9ea;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.85rem;
    font-weight: 500;
    text-align: center;
    position: relative;
}

.user-type-btn.active {
    background: #1d9bf0;
    color: #000;
    font-weight: 700;
}

.user-type-btn:not(.active):hover {
    background: rgba(231, 233, 234, 0.1);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    color: #e7e9ea;
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    display: block;
}

.form-control {
    background: #000;
    border: 1px solid #536471;
    border-radius: 6px;
    color: #e7e9ea;
    padding: 16px;
    font-size: 1.1rem;
    width: 100%;
    transition: all 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: #1d9bf0;
    box-shadow: 0 0 0 2px rgba(29, 155, 240, 0.2);
    background: #000;
    color: #e7e9ea;
}

.form-control::placeholder {
    color: #71767b;
}

.field-group {
    display: none;
}

.field-group.active {
    display: block;
}

.password-field {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #71767b;
    cursor: pointer;
    transition: color 0.2s;
}

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

.btn-login {
    background: #1d9bf0;
    color: #000;
    border: none;
    border-radius: 50px;
    padding: 16px;
    font-size: 1.1rem;
    font-weight: 700;
    width: 100%;
    cursor: pointer;
    transition: all 0.2s;
    margin: 2rem 0 1rem;
}

.btn-login:hover:not(:disabled) {
    background: #1a8cd8;
}

.btn-login:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.register-link {
    text-align: center;
    margin-top: 2rem;
    padding: 2rem 0 1rem;
    border-top: 1px solid #2f3336;
    flex-shrink: 0;
}

.register-link p {
    color: #71767b;
    margin-bottom: 1rem;
}

.register-link a {
    color: #1d9bf0;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.register-link a:hover {
    color: #1a8cd8;
    text-decoration: underline;
}

.alert {
    background: #1a1d23;
    border: 1px solid #fd4d4d;
    border-radius: 6px;
    color: #f4212e;
    padding: 12px 16px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.info-panel {
    background: rgba(29, 155, 240, 0.1);
    border: 1px solid rgba(29, 155, 240, 0.3);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 1.5rem;
    display: none;
}

.info-panel.show {
    display: block;
}

.info-panel h6 {
    color: #1d9bf0;
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.info-panel p {
    color: #e7e9ea;
    font-size: 0.85rem;
    margin: 0;
    opacity: 0.8;
}

/* Responsive */
@media (max-width: 768px) {
    .glass-card {
        padding: 2rem 1.5rem;
        border-radius: 20px;
    }

    .brand-title {
        font-size: 2.2rem;
    }
}
@media (max-width: 480px) {
    .glass-card {
        padding: 1.5rem 1rem;
    }
    .brand-title {
        font-size: 2rem;
    }
}

/* Landscape orientation for mobile */
@media (max-height: 600px) and (orientation: landscape) {
    .main-container {
        flex-direction: row;
    }

    .image-section {
        flex: 0 0 40%;
        min-height: 100vh;
        order: 0;
    }

    .form-section {
        flex: 1;
        border-left: 1px solid #2f3336;
        border-top: none;
        overflow-y: auto;
        max-height: 100vh;
    }

    .logo-container {
        margin-bottom: 1rem;
    }

    .form-title {
        margin-bottom: 1rem;
    }

    .user-type-selector {
        margin-bottom: 1rem;
    }

    .form-group {
        margin-bottom: 1rem;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {
    .image-section {
        background-size: cover;
        background-position: center;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .user-type-btn:hover {
        background: transparent;
    }

    .user-type-btn:not(.active):active {
        background: rgba(231, 233, 234, 0.1);
    }

    .btn-login:hover {
        background: #1d9bf0;
        transform: none;
    }

    .btn-login:active {
        background: #1a8cd8;
    }

    .password-toggle:hover {
        color: #71767b;
    }

    .password-toggle:active {
        color: #e7e9ea;
    }
}

/* Animaciones */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top: 2px solid #000;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}
/* --- STYLES FOR DRAG CAPTCHA --- */
.captcha-container {
    margin-top: 1.5rem;
    user-select: none;
}

.captcha-track {
    width: 100%;
    height: 50px;
    background: #16181c;
    border: 1px solid #2f3336;
    border-radius: 50px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.captcha-text {
    font-size: 0.85rem;
    color: #71767b;
    z-index: 1;
    transition: opacity 0.3s;
}

.captcha-handle {
    width: 46px;
    height: 46px;
    background: #1d9bf0;
    border-radius: 50%;
    position: absolute;
    left: 2px;
    top: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    z-index: 2;
    box-shadow: 0 2px 10px rgba(29, 155, 240, 0.3);
    color: #000;
    transition: background 0.2s;
}

.captcha-handle:active {
    cursor: grabbing;
}

.captcha-handle.success {
    background: #00ba7c;
    color: white;
}

.captcha-track.success {
    border-color: #00ba7c;
    background: rgba(0, 186, 124, 0.1);
}

.captcha-track.success .captcha-text {
    color: #00ba7c;
    font-weight: 600;
}

.captcha-handle {
    touch-action: none;
}

.company-login-logo {
    max-width: 200px;
    max-height: 80px;
    object-fit: contain;
    background: white;
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}
