@import './login.css';

body.auth-body {
    background-color: #f4f6fb;
    font-family: "Inter", sans-serif;
    min-height: 100vh;
}

.auth-wrapper {
    min-height: 100vh;
}

/* Overrides específicos de las pantallas de auth oscuras (login/register) */
body.auth-body {
    background-color: #0e121b !important;
}

.auth-wrapper {
    background-color: transparent !important;
}

.auth-login__field .form-label {
    color: #9ca3af;
}

.auth-login__footer {
    color: #4b5563;
}

.auth-login__footer a {
    color: #6b7280;
    transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

.auth-login__footer a:hover {
    color: #e5e7eb;
    text-decoration: underline;
}

/* Selector de idioma dropdown arriba a la derecha */
.language-dropdown {
    position: relative;
    display: inline-block;
}

.language-dropdown summary { list-style: none; }
.language-dropdown summary::-webkit-details-marker { display: none; }

.language-dropdown__toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border-radius: 999px;
    border: 1px solid #1e293b;
    background-color: #0f172a;
    color: #e2e8f0;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease;
    white-space: nowrap;
}

.language-dropdown__toggle:hover {
    border-color: #334155;
    background-color: #1e293b;
}

.language-dropdown__toggle .flag-icon {
    width: 18px;
    height: 14px;
    border-radius: 2px;
}

.language-dropdown__toggle svg {
    width: 10px;
    height: 6px;
    transition: transform 0.2s ease;
}

.language-dropdown__menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 160px;
    padding: 4px;
    border-radius: 12px;
    border: 1px solid #1e293b;
    background-color: #0f172a;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
    z-index: 10;
}

.language-dropdown[open] .language-dropdown__menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.language-dropdown[open] .language-dropdown__toggle svg {
    transform: rotate(180deg);
}

.language-dropdown__item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.875rem;
    text-decoration: none;
    color: #cbd5e1;
    transition: background-color 0.1s ease, color 0.1s ease;
    white-space: nowrap;
}

.language-dropdown__item:hover {
    background-color: #1e293b;
    color: #f1f5f9;
}

.language-dropdown__item.is-active {
    color: #3b82f6;
}

.language-dropdown__item .flag-icon {
    width: 18px;
    height: 14px;
    border-radius: 2px;
}

.auth-login {
    --auth-login-card-width: 460px;
    --auth-login-card-padding: 3rem;
    --auth-login-gap: 1.5rem;
}

.auth-login__card {
    max-width: var(--auth-login-card-width);
    padding: var(--auth-login-card-padding) calc(var(--auth-login-card-padding) + 0.5rem);
    border-radius: 24px;
}

.auth-login__heading img {
    height: 42px;
    margin-bottom: 1.5rem !important;
}

.auth-login__heading h1 {
    margin-bottom: 0;
    font-size: 1.5rem;
}

/* Hero registro: tipografía y lista */
.register-hero-title {
    /* Mismo estilo visual que antes, sin variables raras */
    color: #f9fafb;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 3rem;
    font-style: normal;
    font-weight: 800;
    line-height: 1.2;
}

.register-hero-text {
    color: #9ca3af;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 16px;
    font-style: normal;
    font-weight: 400;
    line-height: 26px;
}

.register-hero-list {
    color: #e5e7eb;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
    font-style: normal;
    font-weight: 400;
    line-height: 20px;
}

.register-hero-list li,
.register-hero-list span {
    color: #e5e7eb;
}

/* Logo SocialNet.bot del hero de escritorio (login & register) */
.register-hero-logo,
.auth-hero-logo {
    display: block;
    width: 280px;
    max-width: 100%;
    height: auto;
    margin-bottom: 32px;
}

/* Logo SocialNet.bot visible sobre el formulario en móvil/tablet */
.auth-mobile-logo {
    display: block;
    width: 240px;
    max-width: 80%;
    height: auto;
    margin: 0 auto 24px;
}

.referral-register-brand {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 220px;
    height: 88px;
    max-width: 100%;
    padding: 0;
    overflow: hidden;
}

.referral-register-brand--mobile {
    display: flex;
    width: 100%;
    max-width: 240px;
    margin-left: auto;
    margin-right: auto;
    justify-content: center;
}

.referral-register-brand__image {
    display: block;
    max-width: 100%;
    max-height: 76px;
    width: auto;
    height: auto;
    object-fit: contain;
}

/* Tamaño y posición de la imagen central en escritorio (login & register) */
.register-hero-image img {
    max-height: 750px;
    max-width: 520px;
    transform: translateX(50px);
}

.auth-login__form-body {
    display: flex;
    flex-direction: column;
    gap: var(--auth-login-gap);
}

.auth-login__field .form-control {
    height: 56px;
}

.auth-login__cta .btn {
    height: auto;
    min-height: 44px;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    border-radius: 12px;
}

.auth-login__remember {
    display: flex;
    align-items: center;
    margin-top: 0.25rem;
    margin-bottom: 1rem !important;
}

/* En el registro, los mensajes de error de términos deben ir debajo, no al lado */
#registerForm .auth-login__remember {
    flex-direction: column;
    align-items: flex-start;
}

.auth-login__help a {
    font-size: 0.9rem;
}

@media (min-width: 992px) {
    .auth-login__illustration {
        flex: 0 0 33.3333%;
        max-width: 33.3333%;
        padding: 0 2rem;
    }

    .auth-login__form {
        flex: 0 0 66.6667%;
        max-width: 66.6667%;
    }
}

.bg-auth-illustration {
    background: #eef1f7;
    padding: 2rem;
    position: relative;
    min-height: 100vh;
}

.hero-graphic {
    width: 100%;
    max-width: 720px;
    max-height: 95vh;
    object-fit: contain;
    display: block;
}

.highlight-badge {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    padding: 0.5rem 1.25rem;
    border-radius: 999px;
    letter-spacing: 0.08em;
    font-size: 0.75rem;
}

.auth-card {
    max-width: 520px;
    border-radius: 28px;
    border: 1px solid #edf1ff;
    box-shadow: 0 25px 120px rgba(15, 23, 42, 0.08);
    background: #fff;
}

.auth-card .logo {
    height: 80px;
}

.form-label {
    color: #1f2937;
}

.form-control {
    border-radius: 16px;
    border-color: #e2e8f0;
    padding: 0.9rem 1.25rem;
}

/* Borde rojo claro cuando hay error de validación (Laravel añade .is-invalid) */
.auth-login__field .form-control.is-invalid,
.auth-login__field .form-control.is-invalid:focus {
    border-color: #dc3545 !important;
    box-shadow: none;
}

.auth-login__field .form-check-input.is-invalid,
.auth-login__field .form-check-input.is-invalid:focus {
    border-color: #dc3545 !important;
    box-shadow: none;
}

/* Grupo completo del teléfono en rojo cuando hay error */
.auth-login__field .phone-input.is-invalid {
    border-color: #dc3545 !important;
}

.auth-login__field .phone-input.is-invalid .dropdown-toggle {
    border-color: #dc3545 !important;
}

.form-control:focus {
    border-color: #4c6ef5;
    box-shadow: 0 0 0 0.15rem rgba(76, 110, 245, 0.15);
}

/* Auth oscuro: intercambiar colores de texto y placeholder en los inputs */
body.auth-body .form-control.form-control-solid {
    color: var(--bs-gray-500) !important;
}

body.auth-body .form-control.form-control-solid::placeholder {
    color: var(--bs-gray-700) !important;
}

.input-group-text {
    border-radius: 16px 0 0 16px;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
}

.input-group .form-control {
    border-radius: 0 16px 16px 0;
}

.phone-input .flag-icon {
    width: 28px;
    height: 20px;
    object-fit: cover;
    flex-shrink: 0;
    border-radius: 2px;
}

/* Phone Input Wrapper */
.phone-input-wrapper {
    position: relative;
}

.phone-input.overflow-visible {
    overflow: visible !important;
}

/* Country Selector Dropdown */
.country-selector {
    flex-shrink: 0;
    position: relative;
}

.country-selector .dropdown-toggle {
    border-radius: 16px 0 0 16px;
    background-color: #f5f8fa;
    min-width: 120px;
    height: 56px;
}

.country-selector .dropdown-toggle::after {
    display: none;
}

.country-selector .dropdown-toggle:hover,
.country-selector .dropdown-toggle:focus {
    background-color: #eef1f7;
}

.country-dropdown-menu {
    max-height: 320px;
    overflow: hidden;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    min-width: 280px;
    padding: 0;
    z-index: 1050;
    position: absolute;
    top: 100%;
    left: 0;
}

.country-dropdown-menu .dropdown-search {
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 1;
}

.country-dropdown-menu .dropdown-search .form-control {
    border-radius: 8px;
    height: 38px;
    font-size: 0.875rem;
}

.country-list {
    max-height: 250px;
    overflow-y: auto;
    padding: 0.25rem 0;
}

.country-item {
    padding: 0.5rem 1rem;
    transition: background-color 0.15s ease;
}

.country-item:hover,
.country-item:focus {
    background-color: #f5f8fa;
}

.country-item .flag-icon {
    width: 24px;
    height: 18px;
    object-fit: cover;
    border-radius: 2px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.country-item .country-name {
    font-size: 0.9rem;
    color: #1f2937;
}

.phone-prefix-display {
    font-size: 0.95rem;
}

/* Phone Status Indicator */
.phone-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 1;
    color: #fff;
    transition: background-color 0.2s ease;
}

.phone-status:not(.valid):not(.invalid) {
    background-color: #9ca3af;
}

.phone-status:not(.valid):not(.invalid)::before {
    content: '?';
}

.phone-status.valid {
    background-color: #2eb85c;
}

.phone-status.valid::before {
    content: '✔';
}

.phone-status.invalid {
    background-color: #d14343;
}

.phone-status.invalid::before {
    content: '✖';
}

.phone-status.empty {
    background-color: #9ca3af;
}

.phone-status.empty::before {
    content: '?';
}

.password-field .toggle-password {
    border: none;
    border-left: 0;
    border-radius: 0 12px 12px 0;
    font-weight: 600;
    color: #4c6ef5;
}

.password-field .toggle-password:focus {
    box-shadow: none;
}

.password-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 1;
    color: #fff;
    background-color: #d14343;
}

.password-status::before {
    content: '✖';
}

.password-status.valid {
    background-color: #2eb85c;
}

.password-status.valid::before {
    content: '✔';
}

.password-status.invalid {
    background-color: #d14343;
}

.password-status.invalid::before {
    content: '✖';
}

.btn-primary {
    border-radius: 12px;
    box-shadow: 0 18px 30px rgba(76, 110, 245, 0.25);
}

/* Botones grandes más estilizados en pantallas de auth (menos "gordos") */
.auth-login .btn-lg {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    height: auto;
}

.btn-primary:focus {
    box-shadow: 0 0 0 0.15rem rgba(76, 110, 245, 0.4);
}

/* Botón principal (registro y login): único azul relleno de la pantalla.
   Va más grande que el resto para que se lea como LA acción, sin que compitan
   con él los botones sociales (que quedan en blanco). */
.auth-login__cta .btn-primary {
    background-color: var(--auth-telegram-blue) !important;
    border-color: var(--auth-telegram-blue) !important;
    padding: 0.9rem 1.6rem !important;
    font-size: 17px;
    font-weight: 700;
    box-shadow: 0 6px 24px rgba(42, 171, 238, 0.35);
}

.auth-login__cta .btn-primary:hover,
.auth-login__cta .btn-primary:active,
.auth-login__cta .btn-primary:focus {
    background-color: var(--auth-telegram-blue-hover) !important;
    border-color: var(--auth-telegram-blue-hover) !important;
}

@media (max-width: 991.98px) {
    .auth-card {
        border-radius: 0;
        max-width: 100%;
        box-shadow: none;
        border: none;
    }

    .auth-wrapper {
        background: #fff;
    }

    .auth-login__card {
        padding: 2.5rem 1.75rem;
        border-radius: 0;
        max-width: 100%;
    }

    /* Mobile phone input and flag fixes */
    .phone-input-wrapper .input-group {
        flex-wrap: nowrap;
    }

    .phone-input-wrapper .country-selector {
        flex-shrink: 0;
    }

    .country-selector .dropdown-toggle {
        min-width: 100px;
        padding: 0 0.75rem;
        height: 52px;
    }

    .country-selector .dropdown-toggle .flag-icon {
        width: 22px;
        height: 16px;
        flex-shrink: 0;
    }

    .country-selector .dropdown-toggle .phone-prefix-display {
        font-size: 0.875rem;
    }

    .country-selector .dropdown-toggle .fa-chevron-down {
        font-size: 0.5rem;
        margin-left: 0.25rem !important;
    }

    .phone-input-wrapper .phone-input #register-phone-number {
        min-width: 0;
        flex: 1;
    }

    .country-dropdown-menu {
        min-width: 260px;
        max-width: calc(100vw - 3rem);
        left: 0 !important;
        right: auto !important;
    }

    .country-item .flag-icon {
        width: 20px;
        height: 14px;
        flex-shrink: 0;
    }

    .country-item .country-name {
        font-size: 0.825rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* Portátiles/monitores medianos: ocultar la imagen central y desplazar un poco el formulario hacia la derecha */
@media (min-width: 992px) and (max-width: 1599.98px) {
    .auth-login__illustration {
        flex: 0 0 45%;
        max-width: 45%;
    }

    .register-hero-image {
        display: none !important;
    }
}

/* Móviles/tablets: solo formulario, sin columna central */
@media (max-width: 991.98px) {
    .register-hero-image {
        display: none !important;
    }
}

/* ==========================================================================
   Identidad Telegram en login y registro (BSC-461)
   --------------------------------------------------------------------------
   El fondo oscuro se mantiene; lo que cambia es el acento: el azul de Telegram
   sustituye al azul genérico anterior (#3c83f6) en el botón principal, los
   checks del hero y el foco de los campos.

   La paleta de los campos va en variables para que /registro (que carga
   registro.css después y tiene su propio tema rosa/violeta) siga viéndose
   igual, mientras /register adopta la del boceto sin duplicar marcado.
   ========================================================================== */
:root {
    --auth-telegram-blue: #2aabee;
    --auth-telegram-blue-hover: #1f97d6;
    --auth-telegram-blue-soft: #7fd0f7;
}

.auth-login {
    --auth-field-bg: #1d2435;
    --auth-field-border: #1f2937;
    --auth-field-height: 44px;
    --auth-panel-bg: #151b28;
    --auth-panel-border: #1f2937;
}

/* Distintivo "para Telegram" junto al logo (partial auth.partials.telegram-badge) */
.auth-telegram-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 9px;
    border-radius: 999px;
    background-color: rgba(42, 171, 238, 0.18);
    color: var(--auth-telegram-blue-soft);
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    vertical-align: middle;
}

.auth-telegram-badge__icon {
    flex-shrink: 0;
}

/* En el hero de escritorio el logo lleva su propio margen inferior, así que el
   distintivo se saca a su misma línea base en un contenedor aparte. */
.auth-brand-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 32px;
}

.auth-brand-row .register-hero-logo,
.auth-brand-row .auth-hero-logo {
    margin-bottom: 0;
}

.auth-brand-row--mobile {
    justify-content: center;
    margin-bottom: 24px;
}

.auth-brand-row--mobile .auth-mobile-logo {
    margin: 0;
}

/* Cifras del hero */
.auth-stat-value {
    color: #f8fafc;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.2;
}

/* Foco de los campos en azul Telegram (incluye el teléfono, que es un grupo) */
.auth-login .form-control:focus,
.auth-login .phone-input:focus-within {
    border-color: var(--auth-telegram-blue) !important;
    box-shadow: 0 0 0 3px rgba(42, 171, 238, 0.18);
}

/* Enlaces de acento dentro de las pantallas de auth */
.auth-login .link-primary {
    color: var(--auth-telegram-blue-soft) !important;
}

.auth-login .link-primary:hover {
    color: #a6e0fb !important;
}

/* Botón principal (registro y login): único azul relleno de la pantalla.
   Va más grande que el resto para que se lea como LA acción, sin que compitan
   con él los botones sociales. */
.auth-login__cta .btn-primary {
    background-color: var(--auth-telegram-blue) !important;
    border-color: var(--auth-telegram-blue) !important;
    padding: 0.9rem 1.6rem !important;
    font-size: 17px;
    font-weight: 700;
    box-shadow: 0 6px 24px rgba(42, 171, 238, 0.35);
}

.auth-login__cta .btn-primary:hover,
.auth-login__cta .btn-primary:active,
.auth-login__cta .btn-primary:focus {
    background-color: var(--auth-telegram-blue-hover) !important;
    border-color: var(--auth-telegram-blue-hover) !important;
}

/* ==========================================================================
   Composición del boceto (login y registro)
   --------------------------------------------------------------------------
   Columnas al 50%, formulario sin tarjeta interior (los campos se apoyan
   directamente en el fondo), campos más bajos y con esquinas de 6px, y
   botones sociales oscuros para que el único relleno azul sea el CTA.
   Todo va acotado a .auth-telegram-page para no arrastrar /registro ni /login.
   ========================================================================== */
.auth-telegram-page {
    --auth-field-bg: #141a21;
    --auth-field-border: #2b333c;
    --auth-field-height: 42px;
    --auth-panel-bg: transparent;
    --auth-panel-border: transparent;
}

.auth-telegram-page .auth-form-panel {
    padding: 0 !important;
}

/* El formulario ya no vive dentro de una tarjeta: .auth-card trae de serie el
   fondo blanco del tema claro, así que aquí se neutraliza. */
.auth-telegram-page .auth-card {
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

.auth-telegram-page .register-hero-title {
    font-size: 36px;
    font-weight: 700;
    line-height: 1.12;
    letter-spacing: -0.02em;
}

.auth-telegram-page .register-hero-text {
    font-size: 15px;
    line-height: 1.55;
    color: #aab3bc;
}

.auth-telegram-page .auth-login__field .form-control,
.auth-telegram-page .phone-input,
.auth-telegram-page .country-selector .dropdown-toggle {
    border-radius: 6px !important;
}

.auth-telegram-page .password-field .form-control {
    border-radius: 6px 0 0 6px !important;
}

.auth-telegram-page .password-field .toggle-password {
    border-radius: 0 6px 6px 0 !important;
}

.auth-telegram-page .phone-input .form-control {
    border-radius: 0 6px 6px 0 !important;
}

.auth-telegram-page .country-selector .dropdown-toggle {
    border-radius: 6px 0 0 6px !important;
}

.auth-telegram-page .auth-login__cta .btn-primary {
    border-radius: 8px;
}

/* Botones sociales: oscuros con borde, no blancos. Van con !important porque
   Metronic pinta .btn.btn-light con su propia variable de color. */
.auth-telegram-page .btn.btn-light {
    background-color: var(--auth-field-bg) !important;
    border: 1px solid var(--auth-field-border) !important;
    border-radius: 6px;
    color: #f8fafc !important;
    font-size: 14px;
    font-weight: 500;
}

.auth-telegram-page .btn.btn-light:hover,
.auth-telegram-page .btn.btn-light:focus,
.auth-telegram-page .btn.btn-light:active {
    background-color: #1b222b !important;
    border-color: #3a444f !important;
    color: #ffffff !important;
}

/* Distintivo "+1% ingresos" del botón de X: gris, para no competir con el CTA. */
.register-x-chip {
    display: inline-flex;
    align-items: center;
    margin-left: 8px;
    padding: 2px 7px;
    border-radius: 999px;
    background-color: #1e252d;
    color: #aab3bc;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.4;
}

/* La columna del hero va un punto más oscura que la del formulario, como en
   el boceto, para separar visualmente las dos mitades. */
.auth-telegram-page .auth-login__illustration {
    background-color: #070a0d;
}

@media (min-width: 992px) {
    .auth-telegram-page .auth-login__illustration {
        flex: 0 0 50%;
        max-width: 50%;
    }
}
