@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800&display=swap');
@import url('custom-theme.css');

:root {
    --primary-color: #3A4AFF;
    --primary-hover: #2938eb;
    --primary-active: #1f2dc7;
    --text-dark: #0f172a;
    --text-muted: #64748b;
    --input-bg: #f8fafc;
    --input-border: #e2e8f0;
    --card-border: #CBD5E1;
    --card-radius: 28px;
    --card-radius-mobile: 24px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Montserrat', sans-serif;
    -webkit-font-smoothing: antialiased;
}

html {
    width: 100%;
    height: 100%;
    min-height: 100%;
}

body {
    width: 100%;
    height: 100%;
    min-height: 100%;
    background: linear-gradient(to right, var(--primary-color, #3A4AFF) 53%, #ffffff 53%);
    color: var(--text-dark);
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* ========================================================
   CONTENEDOR PRINCIPAL:
   53% IZQUIERDA (un poquito más de la mitad) / 47% DERECHA
   ======================================================== */
.login-page-wrapper {
    width: 100%;
    height: 100vh;
    min-height: 100vh;
    display: grid;
    grid-template-columns: 53% 47%;
    align-items: stretch;
    position: relative;
    box-sizing: border-box;
    overflow-x: hidden;
}

/* ========================================================
   LADO IZQUIERDO: FONDO AZUL CON PUNTOS + CARD CARRUSEL
   ======================================================== */
.login-brand-side {
    background-color: var(--primary-color, #3A4AFF);
    background-image: radial-gradient(rgba(255, 255, 255, 0.22) 1.5px, transparent 1.5px);
    background-size: 22px 22px;
    background-position: center center;
    height: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 36px 28px;
    box-sizing: border-box;
    position: relative;
    z-index: 2;
    min-width: 0;
}

/* Tarjeta oscura redondeada con carrusel de 3 imágenes y 3 textos */
.login-showcase-card {
    width: 100%;
    max-width: 640px;
    height: calc(100vh - 84px);
    max-height: 675px;
    min-height: 500px;
    border-radius: 26px;
    overflow: hidden;
    position: relative;
    background-color: #050505;
    box-shadow: 0 28px 60px rgba(0, 0, 0, 0.36);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 30px 34px 28px 34px;
    box-sizing: border-box;
}

.showcase-slides-bg {
    position: absolute;
    inset: 0;
    z-index: 1;
    overflow: hidden;
    pointer-events: none;
}

.showcase-bg-item {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    opacity: 0;
    transform: scale(1.03);
    transition: opacity 0.85s ease, transform 5.5s ease;
}

.showcase-bg-item.is-active {
    opacity: 1;
    transform: scale(1);
}

.showcase-gradient-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    background: linear-gradient(180deg,
            rgba(0, 0, 0, 0.62) 0%,
            rgba(0, 0, 0, 0.08) 26%,
            rgba(0, 0, 0, 0.16) 58%,
            rgba(0, 0, 0, 0.88) 85%,
            rgba(0, 0, 0, 0.97) 100%);
}

.brand-top-header {
    position: relative;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 12px;
}

.brand-corner-logo {
    height: 36px;
    max-width: 170px;
    width: auto;
    object-fit: contain;
    display: block;
    user-select: none;
}

.showcase-return-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 17px;
    border-radius: 9999px;
    border: 1px solid rgba(255, 255, 255, 0.78);
    background: rgba(0, 0, 0, 0.42);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: #ffffff !important;
    font-size: 11.5px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.showcase-return-btn:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: #ffffff;
    transform: translateY(-1px);
}

.brand-bottom-info {
    position: relative;
    z-index: 3;
    width: 100%;
    max-width: 480px;
    margin: auto auto 0 auto;
    text-align: center;
}

.brand-bottom-title {
    font-size: 19px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 8px;
    letter-spacing: -0.2px;
    transition: opacity 0.28s ease, transform 0.28s ease;
}

.brand-bottom-desc {
    font-size: 12.5px;
    line-height: 1.55;
    color: rgba(255, 255, 255, 0.88);
    font-weight: 400;
    margin: 0 auto 20px auto;
    max-width: 440px;
    transition: opacity 0.28s ease, transform 0.28s ease;
}

.showcase-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.showcase-dot {
    width: 16px;
    height: 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.32);
    border: none;
    padding: 0;
    cursor: pointer;
    transition: all 0.3s ease;
}

.showcase-dot:hover {
    background: rgba(255, 255, 255, 0.65);
}

.showcase-dot.is-active {
    width: 28px;
    background: #ffffff;
}

/* ========================================================
   LADO DERECHO: FONDO BLANCO CON PATRÓN DE PUNTOS FINOS
   ======================================================== */
.login-form-side {
    background-color: #ffffff;
    background-image: radial-gradient(rgba(203, 213, 225, 0.65) 1px, transparent 1px);
    background-size: 20px 20px;
    background-position: center center;
    height: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    position: relative;
}

/* Card blanco centrado con borde delgado #CBD5E1 */
.login-card-container {
    background: #ffffff;
    border: 1px solid var(--card-border);
    border-radius: var(--card-radius);
    width: 100%;
    max-width: 410px;
    margin: 0 auto;
    padding: 38px 32px;
    box-sizing: border-box;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.03);
    position: relative;
    min-width: 0;
}

.login-form-inner {
    width: 100%;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    box-sizing: border-box;
    min-width: 0;
}

/* Logo centrado en el card */
.form-logo-box {
    display: flex;
    justify-content: center;
    margin-bottom: 22px;
    width: 100%;
}

.form-logo-img {
    height: 44px;
    max-height: 48px;
    width: auto;
    object-fit: contain;
    user-select: none;
    margin: 0 auto;
}

/* Encabezados del formulario centrados */
.form-headings {
    text-align: center;
    margin-bottom: 22px;
    width: 100%;
}

.form-headings h2 {
    font-size: 21px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 5px;
    letter-spacing: -0.3px;
}

.form-headings p {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 400;
    line-height: 1.4;
}

/* Mensaje de error */
.form-error-alert {
    background: #fef2f2;
    color: #dc2626;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 12.5px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 16px;
    border: 1px solid #fee2e2;
}

/* Formulario */
.login-form {
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

/* Grupos de campos */
.field-group {
    margin-bottom: 15px;
    width: 100%;
    box-sizing: border-box;
}

.field-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 6px;
}

.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
}

.input-with-icon svg {
    position: absolute;
    left: 14px;
    width: 17px;
    height: 17px;
    fill: #94a3b8;
    pointer-events: none;
    transition: fill 0.2s ease;
    flex-shrink: 0;
}

.input-with-icon input {
    width: 100%;
    height: 46px;
    padding: 10px 14px 10px 42px;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 10px;
    font-size: 13.5px;
    color: var(--text-dark);
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.input-with-icon input::placeholder {
    color: #94a3b8;
    font-size: 13px;
}

.input-with-icon input:focus {
    border-color: var(--primary-color);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(58, 74, 255, 0.12);
}

.input-with-icon input:focus+svg,
.input-with-icon:focus-within svg {
    fill: var(--primary-color);
}

/* Fila de opciones: Recordar credenciales y enlace alterno */
.login-options-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 6px;
    margin-bottom: 20px;
    width: 100%;
    flex-wrap: wrap;
}

.login-remember-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    user-select: none;
    transition: color 0.15s ease;
}

.login-remember-label:hover {
    color: #0f172a;
}

.login-remember-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary-color, #3A4AFF);
    cursor: pointer;
    margin: 0;
    border-radius: 4px;
}

/* Enlace alterno (usuario/admin) */
.switch-portal-link {
    display: inline-flex;
    align-items: center;
    margin: 0;
}

.switch-portal-link a {
    font-size: 11.5px;
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: none;
    transition: color 0.15s ease, text-decoration 0.15s ease;
}

.switch-portal-link a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* Botón Iniciar Sesión */
.btn-login-action {
    width: 100%;
    height: 48px;
    background: var(--primary-color);
    color: #ffffff;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(58, 74, 255, 0.28);
    transition: background-color 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.btn-login-action:hover {
    background: var(--primary-hover);
    box-shadow: 0 6px 18px rgba(58, 74, 255, 0.38);
}

.btn-login-action:active {
    transform: scale(0.99);
}

/* Copyright footer centrado abajo del card - COLOR NEGRO */
.card-bottom-footer {
    margin-top: 22px;
    text-align: center;
    font-size: 11.5px;
    color: #000000 !important;
    font-weight: 600;
    letter-spacing: 0.2px;
    width: 100%;
}

/* ========================================================
   RESPONSIVE DESIGN (PANTALLAS MEDIANAS, TABLETS Y MÓVILES)
   ======================================================== */

/* Laptops medianas (1050px a 1300px) */
@media (max-width: 1300px) {
    body {
        background: linear-gradient(to right, var(--primary-color, #3A4AFF) 52%, #ffffff 52%);
    }

    .login-page-wrapper {
        grid-template-columns: 52% 48%;
    }

    .brand-rocket-art {
        max-width: 400px;
    }

    .login-brand-side {
        padding: 36px 30px;
    }
}

/* Tablets / Pantallas intermedias (821px a 1050px) */
@media (max-width: 1050px) {
    body {
        background: linear-gradient(to right, var(--primary-color, #3A4AFF) 50%, #ffffff 50%);
    }

    .login-page-wrapper {
        grid-template-columns: 50% 50%;
    }

    .login-brand-side {
        padding: 32px 24px;
    }

    .brand-rocket-art {
        max-width: 330px;
    }

    .login-form-side {
        padding: 28px 18px;
    }

    .login-card-container {
        padding: 32px 24px;
        max-width: 390px;
    }
}

/* Móviles y pantallas verticales (<= 820px) */
@media (max-width: 820px) {
    html {
        height: auto;
    }

    body {
        align-items: stretch;
        background-color: #ffffff;
        background-image: radial-gradient(rgba(203, 213, 225, 0.65) 1px, transparent 1px);
        background-size: 20px 20px;
        min-height: 100vh;
        height: auto;
    }

    .login-page-wrapper {
        display: flex;
        flex-direction: column;
        width: 100%;
        min-height: 100vh;
        align-items: center;
    }

    /* En móvil: logo de esquina centrado con barra azul */
    .login-brand-side {
        width: 100%;
        min-height: auto;
        height: auto;
        padding: 24px 16px 20px 16px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
        background-color: var(--primary-color);
        box-shadow: 0 4px 14px rgba(58, 74, 255, 0.15);
    }

    .login-showcase-card {
        min-height: auto;
        height: auto;
        max-height: none;
        background: transparent;
        box-shadow: none;
        padding: 0;
        border-radius: 0;
    }

    .showcase-slides-bg,
    .showcase-gradient-overlay,
    .brand-bottom-info {
        display: none;
    }

    .brand-top-header {
        justify-content: space-between;
        width: 100%;
        display: flex;
    }

    .brand-corner-logo {
        height: 34px;
        margin: 0;
    }

    /* En móvil: card del formulario centrado con fondo de puntos */
    .login-form-side {
        width: 100%;
        flex: 1;
        min-height: auto;
        height: auto;
        padding: 28px 16px 36px 16px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        box-sizing: border-box;
        background-color: transparent;
        background-image: none;
    }

    .login-card-container {
        padding: 30px 22px;
        border-radius: var(--card-radius-mobile);
        max-width: 380px;
        width: 100%;
        box-sizing: border-box;
        margin: 0 auto;
        border: 1px solid var(--card-border);
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
    }

    .login-form-inner {
        max-width: 100%;
        width: 100%;
        align-items: center;
    }

    .form-logo-box {
        margin-bottom: 18px;
        width: 100%;
        display: flex;
        justify-content: center;
    }

    .form-logo-img {
        height: 40px;
        margin: 0 auto;
    }

    .form-headings {
        margin-bottom: 20px;
        text-align: center;
        width: 100%;
    }

    .form-headings h2 {
        font-size: 19.5px;
    }

    .form-headings p {
        font-size: 12.5px;
    }

    .login-form {
        width: 100%;
    }

    .field-group label {
        font-size: 12.5px;
    }

    .input-with-icon input {
        height: 44px;
        font-size: 13px;
    }

    .btn-login-action {
        height: 46px;
        font-size: 14px;
    }

    .card-bottom-footer {
        margin-top: 20px;
        font-size: 11px;
        text-align: center;
        width: 100%;
        color: #000000 !important;
    }
}

/* ========================================================
   SELECTOR DE IDIOMA Y MONEDA (TOP RIGHT DROPDOWN)
   ======================================================== */
.login-top-bar {
    position: absolute;
    top: 24px;
    right: 28px;
    z-index: 200;
    display: flex;
    align-items: center;
    gap: 12px;
}

.lang-selector-wrap {
    position: relative;
    user-select: none;
}

.lang-pill-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 38px;
    padding: 0 16px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 9999px;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.05);
    cursor: pointer;
    font-family: 'Montserrat', sans-serif;
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    outline: none;
}

.lang-pill-btn:hover {
    background: #ffffff;
    border-color: #cbd5e1;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
    transform: translateY(-1px);
}

.lang-pill-btn.is-open {
    border-color: var(--primary-color, var(--accent, #3A4AFF));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-color, var(--accent, #3A4AFF)) 15%, transparent);
}

.lang-pill-flag {
    font-size: 15px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
}

.lang-pill-text {
    display: inline-flex;
    align-items: center;
    letter-spacing: -0.2px;
}

.lang-pill-arrow {
    color: #64748b;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.lang-pill-btn.is-open .lang-pill-arrow {
    transform: rotate(180deg);
}

/* Dropdown Menu Popup */
.lang-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 236px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    padding: 10px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.14), 0 4px 12px rgba(15, 23, 42, 0.06);
    display: none;
    z-index: 1000;
    box-sizing: border-box;
}

.lang-dropdown-menu.is-open {
    display: flex;
    flex-direction: column;
    animation: langMenuDropIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes langMenuDropIn {
    from {
        opacity: 0;
        transform: translateY(-6px) scale(0.97);
    }

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

/* Segmented Tab Bar: Idioma / Moneda */
.lang-tab-bar {
    display: flex;
    background: #f1f5f9;
    border-radius: 12px;
    padding: 3px;
    margin-bottom: 8px;
    gap: 3px;
}

.lang-tab-item {
    flex: 1;
    border: none;
    background: transparent;
    padding: 6px 12px;
    border-radius: 9px;
    font-family: 'Montserrat', sans-serif;
    font-size: 12px;
    font-weight: 700;
    color: #64748b;
    cursor: pointer;
    text-align: center;
    transition: all 0.18s ease;
}

.lang-tab-item:hover {
    color: #0f172a;
}

.lang-tab-item.is-active {
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
}

/* Options List */
.lang-options-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.lang-option-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 12px;
    border-radius: 10px;
    text-decoration: none;
    color: #1e293b;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.16s ease;
    user-select: none;
}

.lang-option-item:hover {
    background: #f8fafc;
    color: #0f172a;
}

.lang-option-item.is-active {
    background: var(--primary-color, var(--accent, #3A4AFF)) !important;
    color: #ffffff !important;
}

.lang-opt-left {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.lang-opt-flag {
    font-size: 16px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
}

.lang-opt-name {
    letter-spacing: -0.2px;
}

.lang-check-icon {
    flex-shrink: 0;
    stroke: currentColor;
}

.lang-option-item.is-active .lang-check-icon {
    stroke: #ffffff;
}

@media (max-width: 900px) {
    .login-top-bar {
        position: absolute;
        top: 14px;
        right: 16px;
    }

    .lang-pill-btn {
        height: 35px;
        padding: 0 12px;
        font-size: 12px;
    }

    .lang-dropdown-menu {
        width: 220px;
    }
}