/* ============================================
   Tema Fintools - Login Split Screen
   Tokens extraídos do OTFlow v2
   ============================================ */

/* ---- Import Font ---- */
@import url('https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@400;600;700&display=swap');

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

/* ---- Tokens ---- */
:root {
    /* Typography */
    --ft-font-family: 'Source Sans Pro', ui-sans-serif, system-ui, sans-serif;

    /* Colors */
    --ft-color-text-default: rgb(47, 48, 51);
    --ft-color-text-soft: rgb(112, 112, 119);
    --ft-color-text-disabled: rgb(160, 163, 171);
    --ft-color-brand-500: #d40000;
    --ft-color-page-bg: rgb(255, 255, 255);
    --ft-color-surface-card: rgb(255, 255, 255);
    --ft-color-surface-form: rgb(255, 255, 255);
    --ft-color-border-soft: rgb(234, 236, 240);
    --ft-color-border-default: rgb(218, 219, 227);
    --ft-color-border-emphasis: rgb(47, 48, 51);
    --ft-color-neutral-surface-mid: rgb(47, 48, 51);
    --ft-color-neutral-on-surface-mid: rgb(255, 255, 255);
    --ft-color-error: #cc2543;
    --ft-color-error-bg: #fdeef0;

    /* Spacing */
    --ft-spacing-field-gap: 16px;
    --ft-spacing-card-padding: 24px;
    --ft-spacing-outer-gap: 32px;
    --ft-spacing-heading-mb: 24px;

    /* Sizing */
    --ft-input-height: 44px;
    --ft-input-border-radius: 8px;
    --ft-input-padding-x: 16px;
    --ft-button-height: 44px;
    --ft-button-border-radius: 8px;
    --ft-card-border-radius: 6px;
    --ft-form-max-width: 380px;
}

/* ---- Base ---- */
body.fintools-login-body {
    font-family: var(--ft-font-family);
    background: var(--ft-color-page-bg);
    min-height: 100vh;
    overflow: hidden;
    color: var(--ft-color-text-default);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---- Layout Split Screen ---- */

.fintools-login-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* Painel esquerdo - Imagem */
.fintools-login-image-panel {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: #f5f5f5;
}

.fintools-login-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center 90%;
    background-repeat: no-repeat;
}

@media (min-aspect-ratio: 2/1) {
    .fintools-login-image {
        background-position: center 60%;
    }
}

@media (min-aspect-ratio: 3/1) {
    .fintools-login-image {
        background-position: center 50%;
    }
}

/* Painel direito - Formulário */
.fintools-login-form-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 16px;
    background: var(--ft-color-page-bg);
}

.fintools-login-form-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--ft-spacing-outer-gap);
    width: 100%;
    max-width: var(--ft-form-max-width);
}

/* ---- Logo + Brand Name ---- */

.fintools-login-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.fintools-login-logo img {
    height: 28px;
    width: auto;
}

.fintools-client-name {
    font-size: 22px;
    font-weight: 700;
    color: var(--ft-color-text-default);
    letter-spacing: 0.35px;
}

/* ---- Card / Form Container ---- */

.fintools-login-content {
    width: 100%;
    border: 1px solid var(--ft-color-border-soft);
    border-radius: var(--ft-card-border-radius);
    background: var(--ft-color-surface-card);
    padding: var(--ft-spacing-card-padding);
}

/* ---- Form Header ---- */

.fintools-form-header {
    margin-bottom: var(--ft-spacing-heading-mb);
}

.fintools-form-header h1 {
    font-size: 20px;
    font-weight: 600;
    color: var(--ft-color-text-default);
    line-height: 28px;
    margin-bottom: 4px;
}

.fintools-form-header p {
    font-size: 12px;
    color: var(--ft-color-text-soft);
    line-height: 16px;
}

/* ---- Form Groups ---- */

.fintools-form-group {
    margin-bottom: var(--ft-spacing-field-gap);
}

.fintools-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--ft-color-text-default);
    margin-bottom: 6px;
}

.fintools-input {
    width: 100%;
    height: var(--ft-input-height);
    padding: 0 var(--ft-input-padding-x);
    font-size: 14px;
    font-family: var(--ft-font-family);
    color: var(--ft-color-text-default);
    background: var(--ft-color-surface-form);
    border: 1px solid var(--ft-color-border-default);
    border-radius: var(--ft-input-border-radius);
    outline: none;
    transition: border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.fintools-input:hover {
    border-color: var(--ft-color-border-emphasis);
    box-shadow: 0 0 0 1px var(--ft-color-border-emphasis);
}

.fintools-input:focus {
    border-color: var(--ft-color-border-emphasis);
    box-shadow: 0 0 0 1px var(--ft-color-border-emphasis);
}

.fintools-input::placeholder {
    color: var(--ft-color-text-disabled);
}

.fintools-input:not(:empty) {
    border-color: var(--ft-color-border-emphasis);
}

/* ---- Password Toggle ---- */

.fintools-password-wrapper {
    position: relative;
}

.fintools-password-wrapper .fintools-input {
    padding-right: 44px;
}

.fintools-password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 50%;
    cursor: pointer;
    color: var(--ft-color-text-soft);
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.fintools-password-toggle:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--ft-color-text-default);
}

/* ---- Form Options ---- */

.fintools-form-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--ft-spacing-field-gap);
}

.fintools-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
}

.fintools-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    border: 1px solid var(--ft-color-border-default);
    border-radius: 4px;
    cursor: pointer;
    accent-color: var(--ft-color-text-default);
}

.fintools-checkbox label {
    font-size: 14px;
    font-weight: 400;
    color: var(--ft-color-text-default);
    cursor: pointer;
    user-select: none;
}

.fintools-forgot-password {
    font-size: 12px;
    color: var(--ft-color-brand-500);
    text-decoration: none;
    font-weight: 500;
}

.fintools-forgot-password:hover {
    text-decoration: underline;
}

/* ---- Buttons ---- */

.fintools-form-buttons {
    margin-top: 8px;
}

.fintools-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: var(--ft-button-height);
    font-size: 14px;
    font-weight: 600;
    font-family: var(--ft-font-family);
    line-height: 20px;
    border: none;
    border-radius: var(--ft-button-border-radius);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.fintools-btn-primary {
    background: var(--ft-color-neutral-surface-mid);
    color: var(--ft-color-neutral-on-surface-mid);
}

.fintools-btn-primary:hover {
    background: rgb(65, 66, 70);
}

.fintools-btn-primary:active {
    background: rgb(35, 36, 39);
}

.fintools-btn-primary:disabled {
    opacity: 0.5;
    pointer-events: none;
}

.fintools-btn-secondary {
    background: transparent;
    color: var(--ft-color-text-default);
    border: 1px solid var(--ft-color-border-default);
}

.fintools-btn-secondary:hover {
    background: rgba(0, 0, 0, 0.04);
}

/* ---- Alerts ---- */

.fintools-alert {
    padding: 14px 18px;
    border-radius: var(--ft-input-border-radius);
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 1.4;
}

.fintools-alert-error {
    background: var(--ft-color-error-bg);
    color: var(--ft-color-error);
}

.fintools-alert-warning {
    background: #fef7e5;
    color: #744600;
}

.fintools-alert-success {
    background: #e6faef;
    color: #006d31;
}

.fintools-alert-info {
    background: #e5f7f9;
    color: #006383;
}

.fintools-alert-text {
    flex: 1;
}

/* ---- Field Validation ---- */

.fintools-field-error {
    display: none;
    font-size: 12px;
    color: var(--ft-color-error);
    font-weight: 600;
    margin-top: 6px;
}

.fintools-has-error .fintools-input {
    border-color: var(--ft-color-error);
}

.fintools-has-error .fintools-input:hover {
    box-shadow: 0 0 0 1px var(--ft-color-error);
}



.fintools-has-error .fintools-field-error {
    display: block;
}


/* ---- Footer ---- */

.fintools-login-footer {
    text-align: center;
}

.fintools-login-footer p {
    font-size: 12px;
    color: var(--ft-color-text-soft);
}

/* ---- OTP Instruction ---- */

.fintools-otp-instruction {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: rgb(248, 249, 250);
    border: 1px solid var(--ft-color-border-soft);
    border-radius: var(--ft-input-border-radius);
    padding: 14px 16px;
    margin-bottom: var(--ft-spacing-field-gap);
}

.fintools-otp-instruction-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    background: var(--ft-color-neutral-surface-mid);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ft-color-neutral-on-surface-mid);
}

.fintools-otp-instruction-icon svg {
    width: 18px;
    height: 18px;
}

.fintools-otp-instruction-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.fintools-otp-instruction-text strong {
    font-size: 13px;
    font-weight: 600;
    color: var(--ft-color-text-default);
    line-height: 1.4;
}

.fintools-otp-instruction-text span {
    font-size: 12px;
    color: var(--ft-color-text-soft);
    line-height: 1.5;
}

/* ---- Back Link ---- */

.fintools-back-link {
    margin-top: 16px;
    text-align: center;
}

.fintools-back-link a {
    font-size: 14px;
    color: var(--ft-color-brand-500);
    text-decoration: none;
}

.fintools-back-link a:hover {
    text-decoration: underline;
}

/* ---- Registration ---- */

.fintools-registration {
    margin-top: 24px;
    text-align: center;
    font-size: 14px;
    color: var(--ft-color-text-soft);
}

.fintools-registration a {
    color: var(--ft-color-brand-500);
    text-decoration: none;
    font-weight: 500;
}

.fintools-registration a:hover {
    text-decoration: underline;
}

/* ---- Info Section ---- */

.fintools-info {
    margin-top: 16px;
    font-size: 12px;
    color: var(--ft-color-text-soft);
    text-align: center;
}

/* ---- TOTP Configuration ---- */

.fintools-totp-steps {
    margin-bottom: var(--ft-spacing-field-gap);
}

.fintools-totp-step {
    margin-bottom: 16px;
}

.fintools-totp-step-text {
    font-size: 12px;
    color: var(--ft-color-text-default);
    line-height: 1.5;
    margin-bottom: 8px;
}

.fintools-totp-step-hint {
    font-size: 11px;
    color: var(--ft-color-text-soft);
    line-height: 1.4;
}

.fintools-totp-apps {
    list-style: disc;
    padding-left: 20px;
    font-size: 12px;
    color: var(--ft-color-text-soft);
    margin-top: 4px;
    display: flex;
    gap: 32px;
}

.fintools-totp-apps li {
    margin-bottom: 2px;
}

.fintools-totp-details {
    list-style: none;
    padding: 0;
    font-size: 12px;
    color: var(--ft-color-text-soft);
}

.fintools-totp-details li {
    margin-bottom: 2px;
}

.fintools-totp-qr {
    text-align: center;
}

.fintools-totp-qr img {
    max-width: 200px;
    height: auto;
    border-radius: 4px;
}

.fintools-totp-secret {
    background: #f5f5f5;
    border: 1px solid var(--ft-color-border-soft);
    border-radius: 6px;
    padding: 12px;
    text-align: center;
    margin: 8px 0;
    word-break: break-all;
}

.fintools-totp-secret code {
    font-family: monospace;
    font-size: 14px;
    color: var(--ft-color-text-default);
    letter-spacing: 1px;
}

.fintools-totp-link {
    display: block;
    font-size: 12px;
    color: var(--ft-color-brand-500);
    text-decoration: none;
    text-align: center;
}

.fintools-totp-link:hover {
    text-decoration: underline;
}

/* TOTP page wider container */
.fintools-page-config-totp .fintools-login-form-container {
    max-width: 600px;
}

/* TOTP page: alert flutuante no topo para não ocupar espaço do form */
.fintools-page-config-totp .fintools-alert {
    position: fixed;
    top: 16px;
    left: 25%;
    transform: translateX(-50%);
    z-index: 1000;
    max-width: 560px;
    width: calc(100% - 32px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    animation: fintools-alert-slide-in 0.3s ease-out;
    margin-bottom: 0;
}

@keyframes fintools-alert-slide-in {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* TOTP page: scroll apenas no form-panel para telas com pouca altura */
.fintools-page-config-totp .fintools-login-form-panel {
    height: 100vh;
    max-height: 100vh;
    overflow-y: auto;
    align-items: flex-start;
}

/* ============================================
   Responsividade
   ============================================ */

@media (max-width: 1024px) {
    .fintools-login-image-panel {
        display: none;
    }

    .fintools-login-wrapper {
        justify-content: center;
        align-items: center;
        background: var(--ft-color-page-bg);
    }

    .fintools-login-form-panel {
        flex: none;
        width: 100%;
        max-width: 520px;
        background: transparent;
        padding: 40px 24px;
    }

    .fintools-login-form-container {
        min-height: auto;
    }
}

@media (max-width: 480px) {
    .fintools-login-form-panel {
        padding: 24px 16px;
    }

    .fintools-form-header h1 {
        font-size: 18px;
    }
}
