/**
 * LOGIN - Diseño Empresarial Split Screen
 * Sistema de Gestión Integral
 * Paleta: Azules corporativos con transparencias
 */

/* =================================================================
   VARIABLES LOCALES DEL LOGIN
   ================================================================= */
:root {
    --login-primary: #1DA1F2;
    --login-primary-dark: #1A8CD8;
    --login-secondary: #6EC1E4;
    --login-accent: #339BDE;
    --login-accent-light: #A8D8F0;
    --login-accent-lighter: #A8D8F0;
    --login-dark: #0B162A;
    --login-text-dark: #070707;
    --login-text-muted: #545454;
    --login-text-light: #7A7A7A;
    --login-border: #CCCCCC;
    --login-bg-light: #F4F6F9;
    --login-bg-input: #EFF2F3;
    --login-bg-card: rgba(255, 255, 255, 0.95);
    --login-success: #66DD66;
    --login-error: #CD201F;
    --login-gradient: linear-gradient(135deg, #1DA1F2 0%, #339BDE 50%, #1A8CD8 100%);
    --login-shadow: 0 8px 32px rgba(29, 161, 242, 0.15);
    --login-shadow-lg: 0 16px 48px rgba(29, 161, 242, 0.2);
    --login-radius: 16px;
    --login-radius-lg: 24px;
    --login-radius-sm: 12px;
}

/* =================================================================
   RESET BODY PARA LOGIN
   ================================================================= */
body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--login-bg-light);
    min-height: 100vh;
    overflow-x: hidden;
}

/* =================================================================
   CONTENEDOR PRINCIPAL - SPLIT SCREEN
   ================================================================= */
.login-container {
    min-height: 100vh;
    display: flex;
    flex-direction: row;
    position: relative;
}

/* =================================================================
   PANEL IZQUIERDO - BRANDING CON IMAGEN
   ================================================================= */
.login-panel-left {
    flex: 0 0 45%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    padding: 4rem;
    position: relative;
    overflow: hidden;
    background: var(--login-dark);
}

/* ══════════════════════════════════════════════════════
   SLIDESHOW DE IMÁGENES
   ══════════════════════════════════════════════════════ */
.login-slideshow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.login-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transform: scale(1.08);
    transition: opacity 1.2s cubic-bezier(0.4, 0, 0.2, 1),
        transform 6s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: opacity, transform;
}

.login-slide--active {
    opacity: 1;
    transform: scale(1);
    transition: opacity 1.2s cubic-bezier(0.4, 0, 0.2, 1),
        transform 6s cubic-bezier(0.4, 0, 0.2, 1);
}

.login-slide--exit {
    opacity: 0;
    transform: scale(0.96);
    transition: opacity 1.2s cubic-bezier(0.4, 0, 0.2, 1),
        transform 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Indicadores del slideshow */
.login-slide-indicators {
    display: flex;
    gap: 0.5rem;
    margin-top: 2rem;
    position: relative;
    z-index: 3;
}

.login-slide-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
}

.login-slide-dot:hover {
    background: rgba(255, 255, 255, 0.7);
    transform: scale(1.2);
}

.login-slide-dot--active {
    background: #fff;
    width: 28px;
    border-radius: 5px;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

/* Overlay semitransparente */
.login-image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.25);
    z-index: 1;
}

/* ── Banner de logos de empresas del grupo ── */
.login-empresas-banner {
    position: relative;
    z-index: 3;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 20px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 16px;
    padding: 18px 30px;
    margin-bottom: 50px;
    max-width: 480px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.login-empresas-track {
    position: relative;
    width: 260px;
    height: 85px;
    flex-shrink: 0;
}

.login-empresa-logo-item {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: translateY(8px) scale(0.92);
    transition: opacity 0.7s ease, transform 0.7s ease;
    pointer-events: none;
}

.login-empresa-logo--active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.login-empresa-logo-img {
    max-width: 100%;
    max-height: 80px;
    height: auto;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.login-empresa-logo--fermar {
    max-height: 62px;
    transform: scale(0.95);
}

.login-empresa-logo--big {
    max-height: 100px;
    transform: scale(1.3);
}

/* Logos específicos que necesitan más tamaño */
.login-empresa-logo-img[src*="logo-ingenieria-alquileres"],
.login-empresa-logo-img[src*="empresa-logo-699613"] {
    max-height: 110px;
    transform: scale(1.35);
}

/* Logo Fermar: reducir un poco */
.login-empresa-logo-img[src*="logo-fermar"] {
    max-height: 65px;
    transform: scale(0.92);
}

.login-empresas-label {
    font-size: 1.35rem;
    font-weight: 700;
    color: white;
    letter-spacing: 2px;
    white-space: nowrap;
    line-height: 1.3;
    text-transform: uppercase;
    text-shadow:
        2px 2px 0 rgba(0, 0, 0, 0.8),
        -1px -1px 0 rgba(0, 0, 0, 0.8),
        1px -1px 0 rgba(0, 0, 0, 0.8),
        -1px 1px 0 rgba(0, 0, 0, 0.8),
        1px 1px 0 rgba(0, 0, 0, 0.8),
        0 0 20px rgba(0, 0, 0, 0.7);
}

/* Contenido sobre la imagen */
.login-brand-content {
    position: relative;
    z-index: 2;
}

/* Elementos decorativos del panel izquierdo */
.login-panel-left::before {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    top: -150px;
    right: -150px;
    border-radius: 50%;
    z-index: 2;
}

.login-panel-left::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.08) 0%, transparent 70%);
    bottom: -100px;
    left: -100px;
    border-radius: 50%;
    z-index: 2;
}

/* Logo en el card del formulario */
.login-card-logo {
    text-align: center;
    margin: 0 auto 1.5rem auto;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 90px;
}

.login-card-logo-img {
    max-width: 340px;
    width: 100%;
    height: auto;
    max-height: 90px;
    object-fit: contain;
    transition: all 0.3s ease;
}

.login-card-logo-img:hover {
    transform: scale(1.02);
}

.login-brand-title {
    font-size: 2.75rem;
    font-weight: 700;
    color: white;
    line-height: 1.2;
    margin: 0 0 1.25rem 0;
    max-width: 400px;
    position: relative;
    z-index: 1;
    letter-spacing: -0.5px;
    text-shadow:
        3px 3px 0 rgba(0, 0, 0, 0.8),
        -1px -1px 0 rgba(0, 0, 0, 0.8),
        1px -1px 0 rgba(0, 0, 0, 0.8),
        -1px 1px 0 rgba(0, 0, 0, 0.8),
        1px 1px 0 rgba(0, 0, 0, 0.8),
        0 0 40px rgba(0, 0, 0, 0.9);
}

.login-brand-subtitle {
    font-size: 1.125rem;
    color: rgba(255, 255, 255, 1);
    margin: 0;
    max-width: 360px;
    line-height: 1.6;
    position: relative;
    z-index: 1;
    text-shadow:
        2px 2px 0 rgba(0, 0, 0, 0.8),
        -1px -1px 0 rgba(0, 0, 0, 0.8),
        1px -1px 0 rgba(0, 0, 0, 0.8),
        -1px 1px 0 rgba(0, 0, 0, 0.8),
        1px 1px 0 rgba(0, 0, 0, 0.8),
        0 0 30px rgba(0, 0, 0, 0.8);
}

/* =================================================================
   PANEL DERECHO - FORMULARIO
   ================================================================= */
.login-panel-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: var(--login-bg-light);
    position: relative;
}

/* Decoración sutil en panel derecho */
.login-panel-right::before {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(0, 51, 102, 0.03) 0%, transparent 70%);
    top: 10%;
    right: 5%;
    border-radius: 50%;
}

/* =================================================================
   TARJETA DE LOGIN
   ================================================================= */
.login-card {
    background: var(--login-bg-card);
    backdrop-filter: blur(20px);
    border-radius: var(--login-radius-lg);
    box-shadow: var(--login-shadow);
    max-width: 440px;
    width: 100%;
    padding: 3rem;
    position: relative;
    z-index: 1;
    border: 1px solid rgba(255, 255, 255, 0.8);
    animation: login-fadeIn 0.5s ease-out;
}

@keyframes login-fadeIn {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =================================================================
   HEADER DEL FORMULARIO
   ================================================================= */
.login-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.login-header-title {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--login-text-dark);
    margin: 0 0 0.5rem 0;
    letter-spacing: -0.5px;
}

.login-header-subtitle {
    font-size: 0.95rem;
    color: var(--login-text-muted);
    margin: 0;
    font-weight: 400;
}

/* Logo oculto en split - visible en mobile */
.login-logo {
    display: none;
}

.login-title {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--login-text-dark);
    margin: 0 0 0.5rem 0;
    letter-spacing: -0.5px;
}

.login-subtitle {
    font-size: 0.95rem;
    color: var(--login-text-muted);
    margin: 0;
    font-weight: 400;
}

/* =================================================================
   FORMULARIO
   ================================================================= */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.login-input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.login-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--login-text-dark);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.login-label-required {
    color: var(--login-error);
    font-weight: 500;
}

.login-input-wrapper {
    position: relative;
}

.login-input {
    width: 100%;
    padding: 1rem 1.25rem;
    font-size: 16px;
    font-family: inherit;
    border: 1.5px solid var(--login-border);
    border-radius: var(--login-radius-sm);
    background: var(--login-bg-input);
    color: var(--login-text-dark);
    transition: box-shadow 0.15s ease, background-color 0.15s ease, color 0.15s ease;
    box-sizing: border-box;
}

.login-input:hover {
    border-color: #d1d5db;
    background: white;
}

.login-input:focus {
    outline: none;
    border-color: #1DA1F2;
    background: white;
    box-shadow: 0 0 0 3px rgba(51, 155, 222, 0.1);
}

.login-input::placeholder {
    color: var(--login-text-light);
}

.login-input-help {
    font-size: 0.8rem;
    color: var(--login-text-light);
    margin-top: 0.25rem;
}

/* Input con icono de mostrar contraseña */
.login-input--with-icon {
    padding-right: 3.5rem;
}

.login-password-toggle {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--login-text-light);
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.25s ease;
    border-radius: 8px;
}

.login-password-toggle:hover {
    color: var(--login-accent);
    background: rgba(29, 161, 242, 0.08);
}

.login-password-toggle svg {
    width: 20px;
    height: 20px;
}

/* =================================================================
   OPCIONES (Recordarme, Olvidé contraseña)
   ================================================================= */
.login-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0.25rem 0;
}

.login-remember {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    cursor: pointer;
}

.login-remember input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--login-accent);
    cursor: pointer;
    border-radius: 4px;
}

.login-remember-text {
    font-size: 0.875rem;
    color: var(--login-text-muted);
    user-select: none;
}

.login-forgot {
    font-size: 0.875rem;
    color: var(--login-accent);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.25s ease;
}

.login-forgot:hover {
    color: var(--login-primary);
    text-decoration: underline;
}

/* =================================================================
   CHECKBOX TRATAMIENTO DE DATOS
   ================================================================= */
.login-consent {
    margin: 0.25rem 0 0;
    background: #F4F7FA;
    border: 1px solid #E8ECF0;
    border-radius: 10px;
    padding: 12px 14px;
}

.login-consent-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    position: relative;
}

.login-consent-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.login-consent-check {
    width: 18px;
    height: 18px;
    min-width: 18px;
    border: 2px solid #C5CDD6;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    background: #fff;
    margin-top: 1px;
}

.login-consent-check::after {
    content: '';
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) scale(0);
    transition: transform 0.15s ease;
}

.login-consent-label input:checked~.login-consent-check {
    background: var(--login-primary);
    border-color: var(--login-primary);
}

.login-consent-label input:checked~.login-consent-check::after {
    transform: rotate(45deg) scale(1);
}

.login-consent-label input:focus-visible~.login-consent-check {
    box-shadow: 0 0 0 3px rgba(29, 161, 242, 0.2);
}

.login-consent-text {
    font-size: 0.72rem;
    color: #6B7885;
    line-height: 1.5;
    user-select: none;
}

.login-consent-link {
    color: var(--login-primary);
    text-decoration: none;
    font-weight: 600;
}

.login-consent-link:hover {
    text-decoration: underline;
}

.login-consent--error .login-consent-check {
    border-color: var(--login-error);
    animation: login-consent-shake 0.4s ease;
}

.login-consent-msg {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 0;
    padding: 0 12px;
    background: #FFF0F0;
    border: 1px solid transparent;
    border-radius: 8px;
    color: #DC2626;
    font-size: 0.73rem;
    font-weight: 500;
    line-height: 1.4;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.login-consent-msg svg {
    flex-shrink: 0;
}

.login-consent-msg--visible {
    opacity: 1;
    max-height: 60px;
    margin-top: 8px;
    padding: 8px 12px;
    border-color: #FECACA;
}

@keyframes login-consent-shake {

    0%,
    100% {
        transform: translateX(0);
    }

    20%,
    60% {
        transform: translateX(-4px);
    }

    40%,
    80% {
        transform: translateX(4px);
    }
}

/* =================================================================
   BOTÓN SUBMIT
   ================================================================= */
.login-btn-submit {
    width: 100%;
    padding: 1rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    color: white;
    background: var(--login-gradient);
    border: none;
    border-radius: var(--login-radius-sm);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(0, 51, 102, 0.25);
    margin-top: 0.75rem;
    position: relative;
    overflow: hidden;
}

.login-btn-submit::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    transition: left 0.5s ease;
}

.login-btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 51, 102, 0.35);
}

.login-btn-submit:hover::before {
    left: 100%;
}

.login-btn-submit:active {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(0, 51, 102, 0.2);
}

.login-btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* =================================================================
   FOOTER
   ================================================================= */
.login-footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1.75rem;
    border-top: 1px solid var(--login-border);
}

.login-footer-text {
    font-size: 0.875rem;
    color: var(--login-text-muted);
    margin: 0 0 1rem 0;
}

.login-footer-text--small {
    font-size: 0.75rem;
    color: var(--login-text-light);
    line-height: 1.5;
}

.login-footer-link-small {
    color: var(--login-accent);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.25s ease;
    display: inline-block;
    margin-left: 0.25rem;
}

.login-footer-link-small:hover {
    color: var(--login-primary);
    text-decoration: underline;
}

.login-footer-link {
    color: var(--login-accent);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.25s ease;
}

.login-footer-link:hover {
    color: var(--login-primary);
    text-decoration: underline;
}

.login-footer-copyright {
    font-size: 0.75rem;
    color: var(--login-text-light);
    margin: 0;
}

/* =================================================================
   MENSAJES DE ERROR/ÉXITO
   ================================================================= */
.login-alert {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-radius: var(--login-radius-sm);
    margin-bottom: 1.25rem;
    animation: login-alertSlide 0.3s ease-out;
}

@keyframes login-alertSlide {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-alert--error {
    background: rgba(205, 32, 31, 0.08);
    border: 1px solid rgba(205, 32, 31, 0.2);
    color: var(--login-error);
}

.login-alert--success {
    background: rgba(102, 221, 102, 0.1);
    border: 1px solid rgba(102, 221, 102, 0.3);
    color: #2d8a2d;
}

.login-alert--warning {
    background: rgba(255, 193, 7, 0.1);
    border: 1px solid rgba(255, 193, 7, 0.3);
    color: #856404;
}

.login-alert-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.login-alert-content {
    flex: 1;
}

.login-alert-title {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.125rem;
}

.login-alert-message {
    font-size: 0.875rem;
    line-height: 1.5;
}

/* =================================================================
   LOADING STATE
   ================================================================= */
.login-btn-submit--loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.login-btn-submit--loading::after {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    top: 50%;
    left: 50%;
    margin: -11px 0 0 -11px;
    border: 2.5px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: login-spinner 0.8s linear infinite;
}

@keyframes login-spinner {
    to {
        transform: rotate(360deg);
    }
}

/* =================================================================
   RESPONSIVE - TABLET
   ================================================================= */
@media (max-width: 1024px) {
    .login-panel-left {
        flex: 0 0 40%;
        padding: 3rem;
    }

    .login-brand-title {
        font-size: 2.25rem;
    }

    .login-card {
        padding: 2.5rem;
    }
}

/* =================================================================
   RESPONSIVE - MOBILE
   ================================================================= */
@media (max-width: 768px) {
    .login-container {
        flex-direction: column;
    }

    .login-panel-left {
        display: none;
        /* Ocultar en móviles */
    }

    .login-panel-right {
        flex: 1;
        padding: 2rem 1.5rem 3rem;
        width: 100%;
    }

    .login-card {
        padding: 2rem 1.5rem;
        border-radius: var(--login-radius);
        max-width: 100%;
    }

    .login-card-logo-img {
        max-width: 260px;
        max-height: 100px;
    }

    .login-title {
        font-size: 1.5rem;
    }

    .login-options {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
}

/* =================================================================
   RESPONSIVE - MOBILE PEQUEÑO
   ================================================================= */
@media (max-width: 480px) {
    .login-panel-left {
        padding: 2rem 1.5rem;
    }

    .login-brand-logo {
        width: 48px;
        height: 48px;
        margin-bottom: 1.5rem;
    }

    .login-brand-title {
        font-size: 1.5rem;
    }

    .login-brand-subtitle {
        font-size: 0.9rem;
    }

    .login-panel-right {
        padding: 1.5rem 1rem 2.5rem;
    }

    .login-card {
        padding: 1.75rem 1.25rem;
    }

    .login-card-logo-img {
        max-width: 220px;
        max-height: 85px;
    }

    .login-input {
        padding: 0.875rem 1rem;
    }
}

/* =================================================================
   ACCESSIBILITY
   ================================================================= */
@media (prefers-reduced-motion: reduce) {

    .login-card,
    .login-alert {
        animation: none;
    }

    .login-btn-submit::before {
        display: none;
    }

    .login-btn-submit--loading::after {
        animation: none;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .login-input {
        border-width: 2px;
    }

    .login-btn-submit {
        border: 2px solid white;
    }
}