/**
 * Support Board - Tela de login e chat
 * Estilos do card centralizado (login/cadastro) e do widget de chat.
 */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background: linear-gradient(160deg, #e8eef4 0%, #d4dce6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Modo logado: cabeçalho + área do chat */
body.sb-logged-in {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: 0;
    min-height: 100vh;
}

.board-topbar {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    width: 100%;
    min-height: 56px;
    padding: 0 20px;
    background: #fff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}

.board-topbar__brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1a1a2e;
    letter-spacing: -0.02em;
}

.board-topbar__logout-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    font-size: 0.875rem;
    font-weight: 600;
    color: #fff;
    background: #2d6ee0;
    text-decoration: none;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
}

.board-topbar__logout-btn:hover {
    background: #2359b8;
    color: #fff;
    text-decoration: none;
}

.board-chat-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    min-height: 0;
}

.board-chat-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    max-width: 100%;
}

.login-card {
    width: 100%;
    max-width: 380px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    padding: 0 0 32px 0;
}

.login-card__logo {
    padding: 32px 24px 16px;
    text-align: center;
    background: #fff;
    border-bottom: 1px solid #eee;
}

.login-card__logo.is-hidden {
    display: none;
}

.login-card.is-register .login-card__logo {
    display: none;
}

.login-card.is-register .login-card__form {
    padding-top: 20px;
}

.login-card__logo img {
    width: 180px;
    height: 180px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

.login-card__form {
    padding: 28px 32px 0;
}

.login-card .field {
    margin-bottom: 18px;
}

.login-card .field label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #444;
}

.login-card .field input {
    width: 100%;
    padding: 12px 14px;
    font-size: 1rem;
    border: 1px solid #ccc;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s;
}

.login-card .field input:focus {
    border-color: #2d6ee0;
}

.login-card .field input::placeholder {
    color: #999;
}

.login-card__msg {
    margin-bottom: 14px;
    padding: 10px 12px;
    font-size: 0.875rem;
    border-radius: 8px;
    display: none;
}

.login-card__msg.visible {
    display: block;
}

.login-card__msg.error {
    background: #fde8e8;
    color: #b91c1c;
}

.login-card__msg.success {
    background: #dcfce7;
    color: #166534;
}

.login-card__submit {
    width: 100%;
    margin-top: 8px;
    padding: 14px;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    background: #2d6ee0;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.login-card__submit:hover {
    background: #2359b8;
}

.login-card__submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.login-card__links {
    margin-top: 20px;
    text-align: center;
}

.login-card__links a {
    font-size: 1rem;
    color: #012cbb;
    text-decoration: none;
}

.login-card__links a:hover {
    text-decoration: underline;
}

.login-card__links a + a {
    margin-left: 0.5rem;
}

.login-card__links .sep {
    margin: 0 0.35rem;
    color: #999;
    font-size: 0.8rem;
}

.login-card__view {
    display: none;
}

.login-card__view.visible {
    display: block;
}

#register-msg {
    margin-top: 8px;
    margin-bottom: 4px;
}

/* Chat: esconde bolha flutuante */
.sb-chat-btn {
    display: none !important;
}

.sb-btn-icon {
    display: none !important;
}

/*
 * Card colado ao chat: o SB posiciona .sb-body em absolute bottom/right dentro de .sb-chat.
 * Colocamos .sb-body no fluxo para o invólucro .sb-chat ter o mesmo tamanho do painel (sem área vazia).
 */
body.sb-logged-in .sb-chat {
    position: relative !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;
    top: auto !important;
    width: auto !important;
    height: auto !important;
    max-width: none !important;
    display: inline-block !important;
    vertical-align: top;
    line-height: 0;
    font-size: 0;
    overflow: visible !important;
    background: transparent !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    z-index: 1;
}

/* Painel padrão SB: 385×650 — aqui 2× largura e +50% altura → 770×975 */
body.sb-logged-in .sb-chat > .sb-body {
    position: relative !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;
    top: auto !important;
    display: flex !important;
    font-size: 14px;
    line-height: normal;
    width: 770px !important;
    max-width: min(770px, calc(100vw - 32px)) !important;
    max-height: min(975px, calc(100vh - 120px)) !important;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.12) !important;
    border-radius: 16px !important;
    overflow: hidden !important;
}

/* Modo ampliado: 650×850 → 1300×1275 (mesma regra 2× / +50%) */
body.sb-logged-in .sb-chat.sb-chat-large > .sb-body {
    width: min(1300px, calc(100vw - 32px)) !important;
    max-width: min(1300px, calc(100vw - 32px)) !important;
    max-height: min(1275px, calc(100vh - 120px)) !important;
}

.sb-header-close {
    display: none !important;
}

/* Loading centralizado sobre a viewport */
.board-loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    font-size: 1rem;
    color: #555;
    background: rgba(255, 255, 255, 0.9);
    padding: 12px 18px;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

@media (max-width: 520px) {
    .board-topbar {
        padding: 0 14px;
        min-height: 52px;
    }

    .board-topbar__brand {
        font-size: 1.1rem;
    }

    .board-topbar__logout-btn {
        padding: 8px 14px;
        font-size: 0.8125rem;
    }

    body.sb-logged-in .sb-chat > .sb-body {
        width: 100% !important;
        max-width: 100% !important;
        max-height: calc(100vh - 100px) !important;
    }
}
