/* ===== Reset & Base ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    background: #e8ecf0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    color: #1e293b;
}

/* ===== Card principal ===== */
.login-card {
    display: flex;
    width: 760px;
    max-width: 100%;
    background: #ffffff;
    border-radius: 6px;
    overflow: hidden;
    box-shadow:
        0 4px 6px -1px rgba(0, 0, 0, 0.10),
        0 2px 4px -2px rgba(0, 0, 0, 0.06);
}

/* ===== Painel do formulário ===== */
.login-panel {
    flex: 0 0 50%;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 468px;
}

/* ===== Painel do banner ===== */
.login-banner {
    flex: 0 0 50%;
    height: 468px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 0 6px 6px 0;
}

/* ===== Marca ===== */
.login-brand {
    text-align: center;
    margin-bottom: 1.5rem;
}

.login-brand-icon {
    font-size: 2.25rem;
    color: #1e40af;
    display: block;
    margin-bottom: 0.35rem;
    line-height: 1;
}

.login-brand h1 {
    font-size: 1.2rem;
    font-weight: 700;
    color: #1e293b;
    letter-spacing: -0.01em;
    margin-bottom: 0.15rem;
}

.login-brand p {
    font-size: 0.8rem;
    color: #94a3b8;
}

/* ===== Alerta de erro ===== */
.login-alert {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-left: 4px solid #ef4444;
    border-radius: 4px;
    padding: 0.6rem 0.8rem;
    margin-bottom: 1rem;
    font-size: 0.82rem;
    color: #b91c1c;
    line-height: 1.4;
}

.login-alert i {
    flex-shrink: 0;
    font-size: 0.9rem;
}

/* ===== Grupos de campos ===== */
.form-group {
    margin-bottom: 0.6rem;
}

/* ===== Input com ícone ===== */
.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 0.75rem;
    color: #94a3b8;
    font-size: 0.9rem;
    pointer-events: none;
    z-index: 1;
    transition: color 0.15s;
}

.form-input {
    width: 100%;
    padding: 0.62rem 0.75rem 0.62rem 2.25rem;
    font-size: 0.9rem;
    color: #1e293b;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
    font-family: inherit;
}

.form-input:focus {
    border-color: #3b82f6;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.10);
}

.form-input:focus ~ .input-icon,
.input-wrapper:focus-within .input-icon {
    color: #3b82f6;
}

.form-input.is-invalid {
    border-color: #ef4444;
}

.form-input.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.10);
}

.form-input::placeholder {
    color: #cbd5e1;
}

/* ===== Input de senha com botão toggle ===== */
.form-input.has-toggle {
    padding-right: 2.5rem;
}

.btn-password-toggle {
    position: absolute;
    right: 0.65rem;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: #94a3b8;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    transition: color 0.15s;
    line-height: 1;
    z-index: 1;
}

.btn-password-toggle:hover {
    color: #3b82f6;
}

.invalid-message {
    font-size: 0.75rem;
    color: #ef4444;
    margin-top: 0.25rem;
    padding-left: 0.1rem;
}

/* ===== Toggle "Permanecer conectado" ===== */
.toggle-label-wrap {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    cursor: pointer;
    user-select: none;
    margin-top: 0.5rem;
    margin-bottom: 1rem;
}

.toggle-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-track {
    position: relative;
    width: 36px;
    height: 20px;
    background: #e2e8f0;
    border-radius: 10px;
    flex-shrink: 0;
    transition: background 0.2s;
}

.toggle-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: #ffffff;
    border-radius: 50%;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease;
}

.toggle-input:checked ~ .toggle-track {
    background: #3b82f6;
}

.toggle-input:checked ~ .toggle-track .toggle-thumb {
    transform: translateX(16px);
}

.toggle-label {
    font-size: 0.85rem;
    color: #64748b;
}

/* ===== Botão submit ===== */
.btn-submit {
    width: 100%;
    padding: 0.7rem;
    background: #1e3a5f;
    color: #ffffff;
    border: none;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: inherit;
}

.btn-submit:hover {
    background: #1e40af;
    box-shadow: 0 2px 8px rgba(30, 64, 175, 0.3);
}

.btn-submit:active {
    background: #1e3a8a;
    box-shadow: none;
}

.btn-submit:disabled {
    opacity: 0.6;
    pointer-events: none;
}

/* ===== Spinner de loading ===== */
.btn-spinner {
    width: 15px;
    height: 15px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: auth-spin 0.65s linear infinite;
    display: none;
    flex-shrink: 0;
}

.btn-submit.is-loading .btn-spinner {
    display: block;
}

.btn-submit.is-loading .btn-text {
    display: none;
}

@keyframes auth-spin {
    to { transform: rotate(360deg); }
}

/* ===== Footer ===== */
.login-footer {
    text-align: center;
    margin-top: 1.25rem;
    font-size: 0.8rem;
    color: #6b7280;
}

/* ===== Responsividade ===== */
@media (max-width: 767px) {
    body {
        padding: 0;
        background: #ffffff;
    }

    .login-card {
        border-radius: 0;
        box-shadow: none;
        width: 100%;
        min-height: 100dvh;
    }

    .login-banner {
        display: none;
    }

    .login-panel {
        flex: 1;
        width: 100%;
        height: auto;
        min-height: 100dvh;
        padding: 2rem 1.5rem;
        justify-content: center;
    }

    .login-footer {
        display: none;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .login-card {
        width: 680px;
    }
}
