/* =========================================================
   IPGLOBE PBX - Tela de login moderna (responsiva)
   ========================================================= */

:root {
    --ip-teal: #0f8fa3;
    --ip-teal-dark: #0a6c80;
    --ip-green: #64b757;
    --ip-green-dark: #4c9a45;
    --ip-ink: #10212b;
    --ip-muted: #6b7c88;
    --ip-line: #e2e8ec;
    --ip-bg: #f5f8fa;
    --ip-danger: #d64545;
    --ip-radius: 14px;
    --ip-shadow: 0 18px 45px rgba(16, 33, 43, .10);
}

* { box-sizing: border-box; }

html, body {
    height: 100%;
}

body.login-page {
    margin: 0;
    padding: 0;
    background: var(--ip-bg);
    color: var(--ip-ink);
    font-family: "Inter", "Noto Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ---------- Layout ---------- */
.login-shell {
    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
    width: 100%;
}

/* ---------- Lado da marca ---------- */
.brand-side {
    position: relative;
    flex: 1 1 55%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 48px 56px;
    overflow: hidden;
    background-color: var(--ip-teal-dark);
    background-image: url("../images/login-brand-bg.jpg");
    background-size: cover;
    background-position: 12% bottom;
    background-repeat: no-repeat;
}

.brand-side:before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(150deg, rgba(10, 78, 94, .55) 0%, rgba(10, 78, 94, .10) 45%, rgba(40, 110, 60, .35) 100%);
}

.brand-inner {
    position: relative;
    z-index: 2;
    max-width: 520px;
}

.brand-logo {
    display: block;
    width: 240px;
    max-width: 60%;
    height: auto;
    filter: drop-shadow(0 2px 10px rgba(0, 0, 0, .25));
}

.brand-headline {
    margin: 40px 0 14px;
    font-size: 38px;
    line-height: 1.15;
    font-weight: 700;
    color: #fff;
    letter-spacing: -.5px;
    text-shadow: 0 2px 18px rgba(0, 0, 0, .18);
}

.brand-headline span {
    display: block;
    font-weight: 300;
    opacity: .92;
}

.brand-text {
    margin: 0;
    max-width: 420px;
    font-size: 16px;
    color: rgba(255, 255, 255, .92);
    text-shadow: 0 1px 12px rgba(0, 0, 0, .18);
}

.brand-features {
    position: relative;
    z-index: 2;
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
    margin-bottom: 8px;
}

.brand-features li {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border-radius: 999px;
    font-size: 13.5px;
    font-weight: 500;
    color: #fff;
    background: rgba(255, 255, 255, .16);
    border: 1px solid rgba(255, 255, 255, .28);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

.brand-features svg { flex: none; }

/* ---------- Lado do formulário ---------- */
.form-side {
    flex: 0 0 480px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background: #fff;
    box-shadow: -18px 0 45px rgba(16, 33, 43, .08);
}

.form-inner {
    width: 100%;
    max-width: 360px;
}

.form-logo-mobile { display: none; }

.form-title {
    margin: 0 0 6px;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -.3px;
}

.form-subtitle {
    margin: 0 0 28px;
    color: var(--ip-muted);
    font-size: 14.5px;
}

/* Mensagem de erro */
.form-login-error {
    display: none;
    margin-bottom: 20px;
    padding: 12px 14px;
    border-radius: 10px;
    background: #fdecec;
    border: 1px solid #f6cdcd;
    color: #972c2c;
}

.form-login-error.is-visible { display: block; }
.form-login-error h3 { margin: 0 0 2px; font-size: 14px; font-weight: 700; }
.form-login-error p { margin: 0; font-size: 13px; }

/* Campos */
.field { margin-bottom: 18px; }

.field-label {
    display: block;
    margin-bottom: 7px;
    font-size: 13px;
    font-weight: 600;
    color: #46596a;
}

.field-control {
    position: relative;
    display: flex;
    align-items: center;
    background: #f7fafb;
    border: 1.5px solid var(--ip-line);
    border-radius: 12px;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.field-control:focus-within {
    background: #fff;
    border-color: var(--ip-teal);
    box-shadow: 0 0 0 4px rgba(15, 143, 163, .12);
}

.field-control .field-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 50px;
    color: #90a3ae;
    flex: none;
}

.field-control:focus-within .field-icon { color: var(--ip-teal); }

.field-control input {
    flex: 1 1 auto;
    width: 100%;
    height: 50px;
    padding: 0 8px 0 0;
    border: 0;
    outline: 0;
    background: transparent;
    font-size: 15px;
    font-family: inherit;
    color: var(--ip-ink);
}

.field-control input::placeholder { color: #a7b5be; }

.field-control input:-webkit-autofill {
    -webkit-text-fill-color: var(--ip-ink);
    -webkit-box-shadow: 0 0 0 1000px #f7fafb inset;
}

.toggle-pass {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 50px;
    border: 0;
    background: transparent;
    color: #90a3ae;
    cursor: pointer;
    border-radius: 0 12px 12px 0;
}

.toggle-pass:hover { color: var(--ip-teal); }
.toggle-pass:focus-visible { outline: 2px solid var(--ip-teal); outline-offset: -2px; }

.field.has-error .field-control {
    border-color: var(--ip-danger);
    background: #fdf5f5;
}

.field-hint {
    display: none;
    margin: 6px 2px 0;
    font-size: 12.5px;
    color: var(--ip-danger);
}

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

/* Linha de opções */
.form-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 4px 0 22px;
    font-size: 13.5px;
}

.checkbox {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #46596a;
    cursor: pointer;
    user-select: none;
}

.checkbox input {
    width: 16px;
    height: 16px;
    accent-color: var(--ip-teal);
    cursor: pointer;
}

.form-options a {
    color: var(--ip-teal);
    text-decoration: none;
    font-weight: 600;
}

.form-options a:hover { text-decoration: underline; }

/* Botão */
.btn-login {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    height: 50px;
    border: 0;
    border-radius: 12px;
    font-family: inherit;
    font-size: 15.5px;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    background: linear-gradient(100deg, var(--ip-teal) 0%, var(--ip-green) 100%);
    box-shadow: 0 10px 24px rgba(15, 143, 163, .28);
    transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}

.btn-login:hover { filter: brightness(1.05); box-shadow: 0 12px 28px rgba(15, 143, 163, .34); }
.btn-login:active { transform: translateY(1px); }
.btn-login:focus-visible { outline: 3px solid rgba(15, 143, 163, .35); outline-offset: 2px; }

.btn-login.is-loading { pointer-events: none; filter: saturate(.85) brightness(.98); }
.btn-login.is-loading .btn-label { opacity: .85; }

.spinner {
    display: none;
    width: 17px;
    height: 17px;
    border: 2px solid rgba(255, 255, 255, .45);
    border-top-color: #fff;
    border-radius: 50%;
    animation: ip-spin .7s linear infinite;
}

.btn-login.is-loading .spinner { display: block; }
.btn-login.is-loading .btn-icon { display: none; }

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

/* Rodapé */
.form-footer {
    margin-top: 30px;
    padding-top: 18px;
    border-top: 1px solid var(--ip-line);
    text-align: center;
    font-size: 12.5px;
    color: var(--ip-muted);
}

.form-footer a {
    color: var(--ip-teal);
    font-weight: 600;
    text-decoration: none;
}

.form-footer a:hover { text-decoration: underline; }

.brand-foot {
    position: relative;
    z-index: 2;
    font-size: 12.5px;
    color: rgba(255, 255, 255, .85);
}

.brand-foot a { color: #fff; text-decoration: none; font-weight: 600; }
.brand-foot a:hover { text-decoration: underline; }

/* Animação de entrada */
.form-inner, .brand-inner {
    animation: ip-fade-up .55s cubic-bezier(.22, .78, .35, 1) both;
}

.form-inner { animation-delay: .08s; }

@keyframes ip-fade-up {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: none; }
}

/* ---------- Responsivo ---------- */
@media (max-width: 1200px) {
    .brand-side { padding: 40px; }
    .brand-headline { font-size: 32px; }
    .form-side { flex-basis: 440px; }
}

@media (max-width: 980px) {
    .login-shell { flex-direction: column; }

    .brand-side {
        flex: none;
        min-height: 250px;
        padding: 30px 24px 50px;
        justify-content: flex-end;
        background-position: 22% 65%;
        text-align: center;
        align-items: center;
    }

    .brand-side:before {
        background: linear-gradient(180deg, rgba(10, 78, 94, .35) 0%, rgba(10, 78, 94, .15) 40%, rgba(10, 78, 94, .55) 100%);
    }

    .brand-inner { max-width: 100%; }
    .brand-logo { width: 190px; max-width: 62%; margin: 0 auto; }
    .brand-headline { margin: 16px 0 0; font-size: 20px; }
    .brand-headline span { display: inline; }
    .brand-text { display: none; }
    .brand-features { display: none; }
    .brand-foot { display: none; }

    .form-side {
        flex: 1 1 auto;
        align-items: flex-start;
        padding: 30px 22px 40px;
        border-radius: 22px 22px 0 0;
        margin-top: -22px;
        box-shadow: 0 -10px 30px rgba(16, 33, 43, .12);
        z-index: 3;
    }

    .form-inner { max-width: 420px; }
    .form-title { font-size: 22px; }
    .form-subtitle { margin-bottom: 22px; }
}

@media (max-width: 480px) {
    .brand-side { min-height: 215px; padding: 24px 18px 46px; }
    .brand-logo { width: 165px; }
    .brand-headline { font-size: 18px; margin-top: 12px; }
    .form-side { padding: 26px 18px 34px; }
    .field-control input { font-size: 16px; } /* evita zoom no iOS */
    .form-options { flex-direction: row; flex-wrap: wrap; }
}

@media (max-height: 620px) and (min-width: 981px) {
    .brand-headline { font-size: 28px; margin-top: 24px; }
    .brand-side { padding: 32px 40px; }
}

@media (prefers-reduced-motion: reduce) {
    .form-inner, .brand-inner { animation: none; }
    .spinner { animation-duration: 2s; }
}
