@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, BRANDING Y COHETE 3D
   ======================================================== */
.login-brand-side {
    background-color: var(--primary-color);
    height: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 44px 36px 40px 48px;
    box-sizing: border-box;
    position: relative;
    z-index: 2;
    min-width: 0;
}

.brand-top-header {
    display: flex;
    align-items: center;
}

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

/* Cohete con buen tamaño y bien ubicado */
.brand-hero-center {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 12px 0;
    margin-left: -6px;
}

.brand-rocket-art {
    width: 100%;
    max-width: 440px;
    height: auto;
    display: block;
    user-select: none;
    filter: drop-shadow(0 20px 30px rgba(0, 0, 0, 0.16));
    animation: rocketGentleFloat 5s ease-in-out infinite;
}

@keyframes rocketGentleFloat {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-8px);
    }
}

.brand-bottom-info {
    max-width: 420px;
}

.brand-bottom-title {
    font-size: 19px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 6px;
    letter-spacing: -0.2px;
}

.brand-bottom-desc {
    font-size: 13px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 400;
}

/* ========================================================
   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);
}

/* Enlace alterno (usuario/admin) */
.switch-portal-link {
    display: flex;
    justify-content: flex-end;
    margin-top: 4px;
    margin-bottom: 18px;
    width: 100%;
}

.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);
    }

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

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

    .brand-hero-center {
        display: none;
    }

    .brand-bottom-info {
        display: none;
    }

    /* 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;
    }
}