@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;
}

.register-hero-logo {
    width: 88px;
    height: 12px;
    margin-bottom: 32px;
}

/* 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 del registro: color fijo */
.auth-login__cta .btn-primary {
    background-color: #3c83f6 !important;
    border-color: #3c83f6 !important;
}

.auth-login__cta .btn-primary:hover,
.auth-login__cta .btn-primary:active,
.auth-login__cta .btn-primary:focus {
    background-color: #3c83f6 !important;
    border-color: #3c83f6 !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;
    }
}

