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

/* Wrapper principal */
html.h-full,
body.login-page {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden !important;
    /* Prohibido el scroll en login */
}

.login-wrapper {
    height: 100vh;
    width: 100vw;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--erp-bg-page);
    overflow: hidden !important;
    position: fixed;
    top: 0;
    left: 0;
}

.login-container {
    display: flex;
    width: 100%;
    max-width: 1400px;
    height: 85vh;
    /* Un poco más bajo para asegurar margen */
    max-height: 750px;
    /* Capado para evitar scroll */
    background: var(--erp-bg-card);
    box-shadow: var(--erp-shadow-lg);
    border-radius: var(--erp-radius);
    overflow: hidden;
}

/* Panel Izquierdo - Formulario */
.login-form-panel {
    flex: 1;
    padding: 5px 40px;
    /* Reducido de 10px 40px */
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--erp-bg-card);
    overflow-y: hidden;
}

.login-form-content {
    width: 100%;
    max-width: 440px;
}

/* Logo */
.login-logo {
    text-align: center;
    margin-bottom: 5px;
    /* Reducido de 10px */
}

.logo-img {
    max-width: 90px;
    /* Reducido de 110px */
    height: auto;
}

.logo-placeholder {
    width: 140px;
    height: 40px;
    background: linear-gradient(135deg, var(--erp-teal-500) 0%, var(--erp-teal-700) 100%);
    border-radius: var(--erp-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 16px;
}

.logo-placeholder::before {
    content: '♻ ReSysCla';
    letter-spacing: 1px;
}

/* Título y Subtítulo */
.login-title {
    font-size: 20px;
    /* Reducido de 24px */
    font-weight: 700;
    color: var(--erp-gray-900);
    margin-bottom: 2px;
    /* Mínimo */
    letter-spacing: -0.025em;
}

.login-subtitle {
    font-size: 13px;
    /* Reducido ligeramente */
    color: var(--erp-gray-500);
    margin-bottom: 10px;
    /* Reducido de 15px */
}


.divider::before,
.divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 45%;
    height: 1px;
    background: var(--erp-gray-200);
}

.divider::before {
    left: 0;
}

.divider::after {
    right: 0;
}

.divider span {
    background: white;
    padding: 0 15px;
    color: var(--erp-gray-400);
    font-size: 13px;
    position: relative;
}

/* Formulario */
.login-form {
    width: 100%;
}

.form-group-modern {
    margin-bottom: 10px;
    /* Reducido de 15px */
}

.form-label-modern {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--erp-gray-600);
    margin-bottom: 8px;
}

.form-input-modern {
    width: 100%;
    height: 42px;
    /* Reducido de 46px */
    padding: 0 16px;
    border: 1px solid var(--erp-gray-200);
    border-radius: var(--erp-radius-sm);
    font-size: 14px;
    /* Reducido de 15px */
    color: var(--erp-gray-800);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background: #ffffff;
}

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

.form-input-modern:focus {
    outline: none;
    border-color: var(--erp-primary);
    box-shadow: 0 0 0 4px var(--erp-teal-100);
}

/* Campo de Contraseña */
.password-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.forgot-link {
    font-size: 13px;
    color: var(--erp-danger);
    text-decoration: none;
}

.forgot-link:hover {
    text-decoration: underline;
}

.password-field {
    position: relative;
}

.password-toggle-wrapper {
    position: relative;
    width: 100%;
}

.password-input {
    padding-right: 45px;
}

.password-toggle-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--erp-gray-400);
    cursor: pointer;
    font-size: 18px;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
    z-index: 10;
}

.password-toggle-btn:hover {
    color: var(--erp-teal-600);
}

.password-toggle-btn:focus {
    outline: none;
}

/* Checkbox Recordar */
.remember-checkbox {
    margin-top: 12px;
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
}

.checkbox-label {
    display: flex;
    align-items: center;
    font-size: 14px;
    color: var(--erp-gray-500);
    cursor: pointer;
    margin: 0;
}

.checkbox-input {
    width: 18px;
    height: 18px;
    margin-right: 8px;
    cursor: pointer;
    accent-color: var(--erp-teal-600);
}

/* Botón Sign In */
.btn-signin {
    width: 100%;
    height: 44px;
    /* Reducido de 48px */
    background: linear-gradient(135deg, var(--erp-teal-600) 0%, var(--erp-teal-800) 100%);
    border: none;
    border-radius: var(--erp-radius-sm);
    color: white;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 8px;
    /* Reducido */
    box-shadow: var(--erp-shadow-sm);
}

.btn-signin:hover {
    background: linear-gradient(135deg, var(--erp-teal-500) 0%, var(--erp-teal-700) 100%);
    transform: translateY(-1px);
    box-shadow: 0 8px 16px rgba(13, 148, 136, 0.3);
}

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

/* Panel Derecho - Carousel */
.login-carousel-panel {
    flex: 1;
    background: linear-gradient(135deg, var(--erp-teal-600) 0%, var(--erp-teal-900) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.login-carousel-panel::after {
    content: '';
    position: absolute;
    inset: 0;
    background: url('../src/logos/logo.png') no-repeat center;
    background-size: 150%;
    opacity: 0.05;
    pointer-events: none;
}

.carousel-content {
    text-align: center;
    padding: 20px;
    /* Reducido de 30px */
    color: white;
    max-width: 500px;
    position: relative;
}

.carousel-navigation {
    display: flex;
    justify-content: space-between;
    margin-bottom: 40px;
}

.carousel-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.carousel-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.carousel-image-placeholder {
    width: 240px;
    /* Reducido */
    height: 160px;
    /* Reducido de 200px */
    background: rgba(255, 255, 255, 0.15);
    margin: 0 auto 20px;
    /* Reducido margen */
    border-radius: 12px;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.recycle-icon {
    animation: float 3s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }
}

.carousel-title {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 16px;
    color: white;
}

.carousel-text {
    font-size: 16px;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 50px;
}

.carousel-indicators {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.indicator {
    width: 32px;
    height: 4px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 2px;
    cursor: pointer;
    transition: all 0.3s;
}

.indicator.active {
    background: white;
}

.indicator:hover {
    background: rgba(255, 255, 255, 0.7);
}

/* Errores de validación de Yii2 */
.help-block {
    color: var(--erp-danger);
    font-size: 12px;
    margin-top: 4px;
}

.has-error .form-input-modern {
    border-color: var(--erp-danger);
}

/* Estilos para las transiciones del carousel */
.carousel-slide {
    display: none;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    width: 100%;
}

.carousel-slide.active {
    display: block;
    opacity: 1;
    animation: fadeIn 0.5s ease-in-out;
}

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

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

/* Ocultar elementos del layout en login */
.login-wrapper~header,
.login-wrapper~footer,
body.login-page header,
body.login-page footer,
body.login-page .navbar {
    display: none !important;
}

/* Asegurar que el wrapper ocupe todo el espacio */
body.login-page {
    margin: 0;
    padding: 0;
}

/* Responsive */
@media (max-width: 1024px) {
    .login-carousel-panel {
        display: none;
    }

    .login-form-panel {
        padding: 40px 30px;
    }
}

@media (max-width: 768px) {
    .login-wrapper {
        padding: 0;
    }

    .login-container {
        max-width: 100%;
        min-height: 100vh;
        box-shadow: none;
        border-radius: 0;
    }

    .login-form-panel {
        padding: 30px 20px;
        width: 100%;
    }

    .login-form-content {
        max-width: 100%;
    }

    .logo-placeholder {
        width: 120px;
        height: 36px;
        font-size: 14px;
    }

    .login-title {
        font-size: 24px;
    }

    .login-subtitle {
        font-size: 13px;
    }

    .social-buttons {
        flex-direction: column;
        gap: 10px;
    }

    .google-btn {
        flex: 1;
    }

    .social-btn.icon-btn {
        flex: 1;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .login-form-panel {
        padding: 20px 15px;
    }

    .login-logo {
        margin-bottom: 30px;
    }

    .login-title {
        font-size: 22px;
    }

    .form-input-modern {
        height: 42px;
        font-size: 13px;
    }

    .btn-signin {
        height: 38px;
        /* Compacto */
        font-size: 14px;
    }
}

#page-loader {
    position: fixed;
    inset: 0;
    background: var(--erp-bg-card);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--erp-gray-100);
    border-top: 4px solid var(--erp-teal-600);
    border-radius: 50%;
    animation: spin 0.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

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

.logo-text {
    margin-top: -10px;
    font-size: 24px;
    /* Reducido de 28px */
    font-weight: 800;
    letter-spacing: 4px;
    color: var(--erp-teal-800);
    text-transform: uppercase;
}

/* Detalle visual opcional */
.logo-text::after {
    content: '';
    display: block;
    width: 80px;
    height: 4px;
    margin: 4px auto 0;
    background: linear-gradient(to right,
            var(--erp-teal-400),
            var(--erp-teal-600));
    border-radius: 10px;
}

/* Ajustes para pantallas con poca altura */
@media (max-height: 700px) {
    .login-container {
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }

    .login-logo {
        margin-bottom: 5px;
    }

    .logo-img {
        max-width: 100px;
    }

    .logo-text {
        font-size: 24px;
    }

    .login-title {
        font-size: 22px;
        margin-bottom: 4px;
    }

    .login-subtitle {
        margin-bottom: 10px;
    }

    .form-group-modern {
        margin-bottom: 10px;
    }

    .form-input-modern {
        height: 40px;
    }

    .btn-signin {
        height: 42px;
    }

    .carousel-image-placeholder {
        width: 200px;
        height: 140px;
        margin-bottom: 15px;
    }

    .carousel-title {
        font-size: 20px;
        margin-bottom: 10px;
    }

    .carousel-text {
        margin-bottom: 20px;
    }

    .captcha-container img {
        height: 35px;
    }
}