/* style.css — SchistoSearch */

:root {
    /* Cor de destaque única */
    --accent: #0b7d73;
    --accent-dark: #086158;
    --accent-light: rgba(11, 125, 115, 0.10);
    --accent-lighter: rgba(11, 125, 115, 0.06);

    --bg: #F5F8F7;
    --surface: #FFFFFF;
    --text-primary: #1A2422;
    --text-secondary: #5C6866;
    --border: #DCE4E2;
    --border-hover: #C3CECC;
    --hover-bg: #EFF4F3;

    --success-bg: var(--accent-light);
    --success-text: var(--accent-dark);
    --error-bg: #FBEAE9;
    --error-text: #B3392F;

    --shadow-sm: 0 1px 2px rgba(20, 30, 28, 0.06);
    --shadow-md: 0 4px 16px rgba(20, 30, 28, 0.08), 0 1px 3px rgba(20, 30, 28, 0.06);
    --shadow-lg: 0 12px 32px rgba(20, 30, 28, 0.12), 0 2px 6px rgba(20, 30, 28, 0.06);

    --radius: 10px;
    --radius-pill: 24px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background-color: var(--bg);
    color: var(--text-primary);
    display: flex;
    justify-content: center;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;

    /* Textura sutil de retícula (grade atômica), para tirar o "chapado" do fundo */
    background-image:
        radial-gradient(circle, rgba(11, 125, 115, 0.11) 1.4px, transparent 1.4px),
        radial-gradient(circle, rgba(11, 125, 115, 0.06) 1px, transparent 1px);
    background-size: 28px 28px, 28px 28px;
    background-position: 0 0, 14px 14px;
}

.hidden { display: none !important; }
.view-container { width: 100%; max-width: 960px; padding: 24px; position: relative; z-index: 1; }

a { color: var(--accent); }

button:focus-visible,
input:focus-visible,
a:focus-visible,
select:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* --- Logo / wordmark de duas camadas (bold escuro + bold accent) --- */
.logo-mark {
    display: flex;
    justify-content: center;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-weight: 700;
    font-size: 24px;
    letter-spacing: -0.3px;
    margin: 0 0 8px 0;
}
.app-header .logo-mark { justify-content: flex-start; margin: 0; }
.logo-mark-lg { font-size: 38px; margin-bottom: 18px; }
.logo-dark { color: var(--text-primary); }
.logo-accent { color: var(--accent); }

/* --- Cards, com sombra em camadas para dar profundidade --- */
.card {
    background: var(--surface);
    border-radius: 16px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    padding: 40px 40px 28px;
}

.login-card {
    max-width: 420px;
    margin: 80px auto;
    text-align: center;
    position: relative;
    box-shadow: var(--shadow-lg);
}
.login-card::before {
    content: '';
    position: absolute;
    inset: -1px -1px auto -1px;
    height: 4px;
    border-radius: 16px 16px 0 0;
    background: linear-gradient(90deg, var(--accent), var(--accent-dark));
}
.login-card h1 { font-size: 20px; font-weight: 700; margin: 0 0 4px; }
.login-card .subtitle { font-size: 14px; font-weight: 300; color: var(--text-secondary); margin: 0 0 32px; }

/* --- Campos de formulário --- */
.field { margin: 0 0 20px; text-align: left; }

input[type="text"],
input[type="password"],
select {
    width: 100%;
    padding: 13px 15px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-sizing: border-box;
    font-size: 16px;
    font-weight: 300;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--surface);
    transition: border-color .15s ease, box-shadow .15s ease;
}

input[type="text"]:hover,
input[type="password"]:hover,
select:hover {
    border-color: var(--border-hover);
}

input[type="text"]:focus,
input[type="password"]:focus,
select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.form-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
}

.text-link {
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
}
.text-link:hover { text-decoration: underline; }

/* --- Botões pill, com leve gradiente pra dar volume --- */
.btn-pill {
    padding: 10px 24px;
    border-radius: var(--radius-pill);
    font-weight: 700;
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    border: 1px solid transparent;
    transition: box-shadow .15s ease, transform .15s ease, background .15s ease;
}

.btn-accent {
    background: linear-gradient(180deg, var(--accent) 0%, var(--accent-dark) 100%);
    color: #fff;
    box-shadow: var(--shadow-sm);
}
.btn-accent:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.btn-accent:active { transform: translateY(0); box-shadow: var(--shadow-sm); }

.btn-outline {
    background: var(--surface);
    color: var(--accent);
    border: 1px solid var(--border);
}
.btn-outline:hover { background: var(--hover-bg); border-color: var(--border-hover); }

/* --- Header do app --- */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding: 16px 8px;
    border-bottom: 1px solid var(--border);
}

.nav-tabs { display: flex; gap: 8px; }
.tab-btn {
    background: none;
    border: none;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 10px 16px;
    border-bottom: 3px solid transparent;
    margin-bottom: -1px;
    transition: color .15s ease, border-color .15s ease;
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 700; }

/* --- Resumo científico --- */
.about-block {
    max-width: 640px;
    margin: 0 auto 36px;
    padding: 20px 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: 4px 12px 12px 4px;
    box-shadow: var(--shadow-sm);
    text-align: left;
}
.about-block .eyebrow {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent);
    margin: 0 0 8px;
}
.about-block .about-text {
    font-size: 14px;
    font-weight: 300;
    line-height: 1.6;
    color: var(--text-primary);
    margin: 0;
}
.about-block .about-text strong { font-weight: 700; }

/* --- Seção de pesquisa --- */
.section-search { padding: 32px 8px 8px; text-align: center; }

.search-eyebrow {
    font-size: 14px;
    font-weight: 300;
    color: var(--text-secondary);
    margin: 0 0 20px;
}

.search-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 640px;
    margin: 0 auto;
    padding: 6px 8px 6px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-sm);
    transition: box-shadow .15s ease, border-color .15s ease;
}
.search-pill:hover,
.search-pill:focus-within {
    box-shadow: var(--shadow-md);
    border-color: transparent;
}

.search-icon { color: var(--text-secondary); flex-shrink: 0; }

.search-pill input[type="text"] {
    border: none;
    padding: 8px 4px;
    box-shadow: none !important;
    font-size: 16px;
    font-weight: 400;
}
.search-pill input[type="text"]:focus { box-shadow: none; }

.search-pill .btn-pill { flex-shrink: 0; }

/* Toggle Switch */
.toggle-switch {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 18px 0 0;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 300;
}

/* --- Área de resultados --- */
.result-area {
    text-align: center;
    margin: 40px auto 0;
    padding-top: 28px;
    border-top: 1px solid var(--border);
    max-width: 480px;
}
#mol-image { max-width: 280px; height: auto; }

/* Card unificado de resultado: rotulo (Ativo/Inativo) + probabilidade do modelo */
.result-card {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 220px;
    margin: 4px auto 0;
    padding: 20px 32px;
    border-radius: 16px;
}
.result-card-active { background-color: var(--success-bg); }
.result-card-inactive { background-color: var(--error-bg); }
.result-card-value { font-size: 32px; font-weight: 700; line-height: 1.1; }
.result-card-active .result-card-value { color: var(--success-text); }
.result-card-inactive .result-card-value { color: var(--error-text); }
.result-card-caption { font-size: 13px; font-weight: 300; color: var(--text-secondary); }

/* Card de aviso de dominio de aplicabilidade: aparece antes do resultado quando a
   molecula esta fora do dominio, e expande para revelar o resultado do modelo */
.warning-card {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    padding: 14px 18px;
    border: 1px solid var(--error-text);
    border-radius: 12px;
    background-color: var(--error-bg);
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    transition: background-color .15s ease;
}
.warning-card:hover { background-color: #F8DAD7; }
.warning-icon { flex-shrink: 0; font-size: 20px; }
.warning-copy { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.warning-title { font-size: 14px; font-weight: 700; color: var(--error-text); }
.warning-subtitle { font-size: 12px; font-weight: 300; color: var(--error-text); line-height: 1.4; }
.warning-chevron {
    flex-shrink: 0;
    font-size: 14px;
    color: var(--error-text);
    transition: transform .15s ease;
}
.warning-card[aria-expanded="true"] .warning-chevron { transform: rotate(180deg); }
.warning-card + .result-card { margin-top: 16px; }

.info-text { font-size: 14px; font-weight: 300; color: var(--text-secondary); line-height: 1.5; }

/* --- Histórico --- */
.history-active { color: var(--success-text); }
.history-inactive { color: var(--error-text); }
.history-unreliable { color: var(--text-secondary); font-style: italic; }
.history-area { margin: 48px auto 0; max-width: 640px; text-align: left; }
.history-area h3 {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 4px;
}
.history-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 4px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    font-weight: 300;
    transition: background .15s ease;
}
.history-item:hover { background: var(--hover-bg); }

/* --- Contribuição --- */
.main-card { max-width: 560px; margin: 0 auto; text-align: left; }
.main-card h2 { font-size: 20px; font-weight: 700; margin-top: 0; }
.contribute-form .field { margin-bottom: 16px; }

/* --- Usuários (admin) --- */
.users-toolbar { display: flex; gap: 8px; margin-bottom: 20px; }
.users-toolbar input[type="text"] { margin: 0; }
.users-toolbar .btn-pill { flex-shrink: 0; }

.users-list { list-style: none; margin: 0; padding: 0; }
.user-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 4px;
    border-bottom: 1px solid var(--border);
}
.user-item-empty { color: var(--text-secondary); font-size: 14px; font-weight: 300; justify-content: center; }
.user-item-name { flex: 1; font-size: 14px; font-weight: 400; word-break: break-all; }
.user-item-badge {
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
}
.badge-admin { background-color: var(--accent-light); color: var(--accent-dark); }
.badge-user { background-color: var(--hover-bg); color: var(--text-secondary); }
.user-toggle-btn { flex-shrink: 0; padding: 6px 14px; font-size: 12px; }

.users-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 20px;
}
.users-page-info { font-size: 13px; font-weight: 300; color: var(--text-secondary); text-align: center; flex: 1; }

.btn-pill:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-pill:disabled:hover { transform: none; box-shadow: none; background: var(--surface); }

/* --- Mensagens --- */
.error-msg { color: var(--error-text); font-size: 13px; text-align: left; margin: -8px 0 4px; }
.success-msg { color: var(--success-text); font-size: 13px; font-weight: 700; text-align: left; margin: -8px 0 4px; }

/* --- Responsivo --- */
@media (max-width: 480px) {
    .login-card { margin: 32px auto; padding: 32px 24px 24px; }
    .search-pill { flex-wrap: nowrap; padding-left: 14px; }
    .search-pill .btn-pill { padding: 10px 14px; }
    .app-header { flex-wrap: wrap; gap: 12px; }
    .about-block { padding: 16px 18px; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}