/* ==========================================================================
   Palavra com Estudo — Estilos principais
   ========================================================================== */

:root {
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --border: #334155;
    --border-strong: #475569;
    --text-color: #f8fafc;
    --text-muted: #94a3b8;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --success: #10b981;
    --success-hover: #059669;
    --danger: #ef4444;
    --fav-color: #f59e0b;
    --link: #93c5fd;
    --text-soft: #cbd5e1;
    --text-faint: #64748b;
    --danger-text: #fca5a5;
    --danger-text-strong: #fecaca;
    --warn-text: #fcd34d;
    --warn-text-soft: #fde68a;
    --success-text: #6ee7b7;
    --success-text-soft: #a7f3d0;
    --header-bg: rgba(15, 23, 42, 0.92);
    --table-head: rgba(15, 23, 42, 0.5);
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    color-scheme: dark;

    /* Animação dos menus flutuantes */
    --float-shift: 10px;
    --float-duration: 220ms;
    --float-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; }

/* Largura máxima do conteúdo do site. O cabeçalho, o botão de tema e a barra
   do usuário (canto superior direito) ficam fora desse limite. */
:root { --page-max: 1140px; }
.tabs, main, .site-footer { max-width: var(--page-max); margin-left: auto; margin-right: auto; }

body {
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 20px;
}

/* ---------- Cabeçalho ---------- */
.header-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
    text-align: center;
}
.site-logo {
    width: 90px;
    height: 90px;
    object-fit: contain;
    border-radius: 50%;
    margin-bottom: 10px;
    box-shadow: var(--shadow);
}
h1 { margin: 5px 0 20px; font-size: 24px; }

/* ---------- Abas ---------- */
.tabs {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid var(--border);
    padding-bottom: 15px;
    flex-wrap: wrap;
}
.tab-btn {
    background-color: var(--card-bg);
    color: var(--text-color);
    border: 1px solid var(--border-strong);
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    font-size: 15px;
    transition: background-color 0.2s, border-color 0.2s;
}
.tab-btn:hover { border-color: var(--accent); }
.tab-btn.active { background-color: var(--accent); border-color: var(--accent); }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ---------- Grade de cards ---------- */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}
.card {
    background-color: var(--card-bg);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: var(--shadow);
    transition: transform 0.2s;
    position: relative;
}
.card:hover { transform: translateY(-4px); }
.card p {
    font-size: 14px;
    text-align: center;
    margin: 10px 0;
    word-break: break-word;
    flex-grow: 1;
}

.fav-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    color: #cbd5e1;
    z-index: 10;
    transition: background 0.2s, color 0.2s;
}
.fav-btn:hover { background: rgba(0, 0, 0, 0.8); }
.fav-btn.favorited { color: var(--fav-color); }

.thumb-container {
    width: 100%;
    height: 250px;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
}
.thumb-container canvas,
.thumb-container img.custom-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.thumb-container canvas { opacity: 0; transition: opacity 0.3s; }
.thumb-container canvas.is-loaded { opacity: 1; }
.audio-thumb { font-size: 48px; color: var(--text-muted); cursor: default; }

.action-btn {
    background-color: var(--accent);
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    width: 100%;
    transition: background 0.2s;
}
.action-btn:hover { background-color: var(--accent-hover); }
audio { width: 100%; margin-top: 10px; }
.empty-msg { text-align: center; color: var(--text-muted); grid-column: 1 / -1; padding: 40px; }

/* ---------- Bíblia ---------- */
.bible-container {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
    max-width: 900px;
    margin: 0 auto;
}
.bible-controls {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 25px;
    justify-content: center;
    background: var(--bg-color);
    padding: 15px;
    border-radius: 10px;
    border: 1px solid var(--border);
}
.control-group { flex: 1; min-width: 140px; }
.control-group label {
    font-size: 12px;
    color: var(--text-muted);
    display: block;
    margin-bottom: 4px;
}
.bible-controls select {
    width: 100%;
    background: var(--card-bg);
    color: var(--text-color);
    border: 1px solid var(--border-strong);
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: border-color 0.2s;
}
.bible-controls select:hover,
.bible-controls select:focus { border-color: var(--accent); outline: none; }

.bible-text {
    line-height: 1.8;
    font-size: 17px;
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 10px;
}
.bible-text hr { border-color: var(--border); margin-bottom: 15px; }
.bible-text p { text-align: left; margin: 0 0 12px; }
.bible-text sup {
    color: var(--accent);
    font-weight: bold;
    margin-right: 5px;
    user-select: none;
}
.bible-text ::selection { background: rgba(59, 130, 246, 0.35); }

/* ==========================================================================
   Menu flutuante de canetas (aparece ao selecionar texto)
   Entrada: fade-in + sobe 10px | Saída: fade-out + desce 10px
   ========================================================================== */
.highlight-menu {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 200px;
    max-width: 250px;
    padding: 10px;
    background: var(--card-bg);
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.55);

    /* Estado oculto */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(var(--float-shift));
    transition:
        opacity var(--float-duration) ease,
        transform var(--float-duration) var(--float-ease),
        visibility 0s linear var(--float-duration); /* esconde só depois do fade */
}
/* Quando não há espaço acima, o menu abre abaixo do texto e entra vindo de cima */
.highlight-menu.is-below { --float-shift: -10px; }

.highlight-menu.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
    transition:
        opacity var(--float-duration) ease,
        transform var(--float-duration) var(--float-ease),
        visibility 0s;
}

.highlight-menu__title { font-size: 12px; font-weight: bold; }
.highlight-menu__colors { display: flex; gap: 6px; flex-wrap: wrap; }
.highlight-menu hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; width: 100%; }

.color-dot {
    width: 24px;
    height: 24px;
    padding: 0;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: scale 0.12s, border-color 0.12s, opacity 0.2s ease, transform 0.2s var(--float-ease);
}
.color-dot:hover,
.color-dot:focus-visible { scale: 1.15; border-color: #fff; outline: none; }

/* Leve efeito em cascata nas bolinhas ao abrir */
.highlight-menu .color-dot { opacity: 0; transform: translateY(4px); }
.highlight-menu.is-visible .color-dot {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0s, 0s, calc(60ms + var(--i, 0) * 25ms), calc(60ms + var(--i, 0) * 25ms);
}

/* ---------- Toast (feedback) ---------- */
.toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    z-index: 10001;
    padding: 10px 18px;
    background: var(--card-bg);
    color: var(--text-color);
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.55);
    font-size: 14px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translate(-50%, var(--float-shift));
    transition:
        opacity var(--float-duration) ease,
        transform var(--float-duration) var(--float-ease),
        visibility 0s linear var(--float-duration);
}
.toast.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
    transition:
        opacity var(--float-duration) ease,
        transform var(--float-duration) var(--float-ease),
        visibility 0s;
}

/* ---------- Leitor de PDF (modal) ---------- */
.pdf-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.9);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0s linear 0.2s;
}
.pdf-modal.is-open { opacity: 1; visibility: visible; transition: opacity 0.2s ease, visibility 0s; }
.pdf-modal__bar {
    padding: 10px;
    background: var(--card-bg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}
.pdf-modal__title { font-weight: bold; }
.pdf-modal__close {
    background: var(--danger);
    border: none;
    color: #fff;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
}
.pdf-modal iframe { width: 100%; flex: 1; border: none; background: #fff; }

/* ---------- Marcações ---------- */
.highlight-group {
    background: var(--card-bg);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    border-left: 5px solid var(--group-color, #eab308);
}
.highlight-group h3 { margin: 0 0 10px; font-size: 16px; }
.highlight-item {
    background: var(--bg-color);
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 8px;
    font-size: 14px;
}
.highlight-item__ref {
    color: var(--accent);
    font-weight: bold;
    font-size: 12px;
    display: block;
    margin-bottom: 4px;
}
.highlight-item__text { margin: 0 0 8px; color: var(--text-soft); text-align: left; }

/* ---------- Configurações ---------- */
.settings-box {
    background: var(--bg-color);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
    font-size: 13px;
}
.settings-hint { color: var(--text-muted); font-size: 14px; }
.color-config-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.color-config-row input[type="color"] {
    width: 40px;
    height: 35px;
    border: none;
    background: none;
    cursor: pointer;
}
.color-config-row input[type="text"] {
    background: var(--card-bg);
    border: 1px solid var(--border-strong);
    color: var(--text-color);
    padding: 6px 10px;
    border-radius: 4px;
    flex-grow: 1;
}

/* ---------- Botões utilitários ---------- */
.btn {
    border: none;
    color: #fff;
    cursor: pointer;
    font-weight: bold;
    border-radius: 6px;
    transition: background 0.2s;
}
.btn-salvar { background: var(--accent); padding: 8px 16px; font-size: 14px; margin-top: 10px; }
.btn-salvar:hover { background: var(--accent-hover); }
.btn-share { background: var(--success); padding: 6px 12px; font-size: 12px; margin: 5px 5px 0 0; border-radius: 4px; }
.btn-share:hover { background: var(--success-hover); }
.btn-share--block { width: 100%; margin: 0; }
.btn-add { background: var(--success); padding: 6px 12px; border-radius: 4px; margin-top: 15px; }
.btn-danger { background: var(--danger); padding: 6px 10px; border-radius: 4px; font-weight: normal; }
.btn-del {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 11px;
    margin-top: 5px;
    padding: 0;
}

/* ==========================================================================
   Conta do usuário
   ========================================================================== */
.user-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    min-height: 36px;
    margin-bottom: 4px;
}
.user-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px 4px 4px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 14px;
}
.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}
.user-avatar--initial {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    font-weight: bold;
    font-size: 13px;
}
.user-name { font-weight: 600; }

.plan-badge {
    font-size: 11px;
    font-weight: bold;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--border);
    color: var(--text-color);
}
.plan-badge--plano1 { background: #0e7490; }
.plan-badge--plano2 { background: #7c3aed; }
.plan-badge--plano3 { background: linear-gradient(135deg, #f59e0b, #d97706); color: #111827; }

.logout-form { margin: 0; }
.btn-logout {
    background: transparent;
    color: var(--text-color);
    border: 1px solid var(--border-strong);
    padding: 6px 12px;
    font-size: 13px;
}
.btn-logout:hover { border-color: var(--danger); color: var(--danger-text-strong); }
.btn-login { background: var(--accent); padding: 8px 18px; font-size: 14px; }
.btn-login:hover { background: var(--accent-hover); }

/* ---------- Modal de login (mesma animação: fade + 10px) ---------- */
.login-modal {
    position: fixed;
    inset: 0;
    z-index: 10002;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    visibility: hidden;
    pointer-events: none;
    transition: visibility 0s linear var(--float-duration);
}
.login-modal.is-open { visibility: visible; pointer-events: auto; transition: visibility 0s; }

.login-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 23, 0.75);
    opacity: 0;
    transition: opacity var(--float-duration) ease;
}
.login-modal.is-open .login-modal__backdrop { opacity: 1; }

.login-modal__card {
    position: relative;
    width: 100%;
    max-width: 380px;
    padding: 28px 24px 20px;
    background: var(--card-bg);
    border: 1px solid var(--border-strong);
    border-radius: 14px;
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.6);
    text-align: center;
    opacity: 0;
    transform: translateY(var(--float-shift));
    transition: opacity var(--float-duration) ease, transform var(--float-duration) var(--float-ease);
}
.login-modal.is-open .login-modal__card { opacity: 1; transform: translateY(0); }

.login-modal__close {
    position: absolute;
    top: 10px;
    right: 12px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
}
.login-modal__logo { width: 56px; height: 56px; border-radius: 50%; }
.login-modal__card h2 { margin: 10px 0 6px; font-size: 20px; }
.login-modal__text { color: var(--text-muted); font-size: 14px; margin: 0 0 18px; }
.login-modal__providers { display: flex; flex-direction: column; gap: 10px; }
.login-modal__warn { color: var(--danger-text); font-size: 13px; }
.login-modal__small { color: var(--text-muted); font-size: 11px; margin: 16px 0 0; }

/* Botões nas cores recomendadas pelas diretrizes de cada marca */
.btn-provider {
    display: block;
    padding: 11px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 15px;
    text-decoration: none;
    transition: filter 0.15s;
}
.btn-provider:hover { filter: brightness(0.94); }
.btn-provider--google { background: #fff; color: #1f1f1f; border: 1px solid #747775; }
.btn-provider--apple  { background: #000; color: #fff; border: 1px solid #000; }

/* Botão oficial do Google (renderizado pelo próprio Google) */
.gsi-slot {
    display: flex;
    justify-content: center;
    min-height: 44px;
    width: 100%;
    transition: opacity 0.2s;
}
.gsi-slot.is-loading { opacity: 0.5; pointer-events: none; }
.gsi-status { font-size: 12px; color: var(--danger-text); text-align: center; margin: 4px 0 0; }
.gsi-status[hidden] { display: none; }

.btn-provider--email { background: transparent; color: var(--text-color); border: 1px solid var(--border-strong); }
.btn-provider--email:hover { border-color: var(--accent); filter: none; }
.login-modal__signup { font-size: 13px; color: var(--text-muted); margin: 14px 0 0; }
.login-modal__signup a, .auth-links a, .auth-link { color: var(--link); }

.auth-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
    font-size: 12px;
    margin: 4px 0;
}
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; border-top: 1px solid var(--border); }

/* ---------- Páginas de conta (/auth/) ---------- */
.auth-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 28px 24px;
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    gap: 12px;
    animation: auth-in var(--float-duration) var(--float-ease) both;
}
@keyframes auth-in { from { opacity: 0; transform: translateY(var(--float-shift)); } }
.auth-card__brand { align-self: center; }
.auth-card__brand img { border-radius: 50%; }
.auth-card__title { text-align: center; font-size: 22px; margin: 0 0 6px; }
.auth-text { color: var(--text-muted); font-size: 14px; margin: 0; }

.auth-form { display: flex; flex-direction: column; gap: 6px; }
.auth-form label { font-size: 13px; color: var(--text-muted); margin-top: 6px; }
.auth-form label small { color: var(--text-faint); }
.auth-form input[type="text"],
.auth-form input[type="email"],
.auth-form input[type="password"] {
    background: var(--bg-color);
    border: 1px solid var(--border-strong);
    color: var(--text-color);
    padding: 11px 12px;
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.2s;
}
.auth-form input:focus { outline: none; border-color: var(--accent); }
.auth-check { display: flex; align-items: center; gap: 8px; color: var(--text-color) !important; }
.auth-submit { margin-top: 10px; padding: 12px; font-size: 15px; }
.auth-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.auth-alert { border-radius: 8px; padding: 10px 14px; font-size: 14px; }
.auth-alert ul { margin: 0; padding-left: 18px; }
.auth-alert p { margin: 4px 0; }
.auth-alert--error { background: rgba(239, 68, 68, 0.12); border: 1px solid rgba(239, 68, 68, 0.4); color: var(--danger-text-strong); }
.auth-alert--success { background: rgba(16, 185, 129, 0.12); border: 1px solid rgba(16, 185, 129, 0.4); color: var(--success-text-soft); }

.auth-links { text-align: center; font-size: 13px; color: var(--text-muted); margin: 4px 0 0; display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.auth-inline { margin: 0; text-align: center; }
.auth-link { background: none; border: none; cursor: pointer; font-size: 13px; text-decoration: underline; padding: 0; }
.auth-back { font-size: 13px; }
.auth-back a { color: var(--text-muted); }

/* ---------- Painel admin ---------- */
.admin-page > :not(.admin-header) { max-width: var(--page-max); margin-left: auto; margin-right: auto; }
.admin-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.admin-header h1 { margin: 0; font-size: 22px; }
.admin-header .btn-logout { text-decoration: none; color: var(--text-color); }
.admin-flash { margin-bottom: 16px; }
.admin-stats { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.admin-stat {
    flex: 1;
    min-width: 120px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
}
.admin-stat span { font-size: 24px; font-weight: bold; color: var(--text-color); }
.admin-stat i { font-style: normal; align-self: flex-start; }
.admin-search { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.admin-search input {
    flex: 1;
    max-width: 420px;
    background: var(--card-bg);
    border: 1px solid var(--border-strong);
    color: var(--text-color);
    padding: 9px 12px;
    border-radius: 8px;
}
.admin-clear { color: var(--text-muted); font-size: 13px; }
.admin-table-wrap { overflow-x: auto; background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th, .admin-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.admin-table th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); background: var(--table-head); }
.admin-table tr:last-child td { border-bottom: none; }
.admin-muted { color: var(--text-muted); font-size: 13px; }
.admin-tag { display: inline-block; font-size: 11px; padding: 2px 7px; border-radius: 999px; background: var(--border); margin: 2px 2px 0 0; }
.admin-tag--warn { background: rgba(245, 158, 11, 0.2); color: var(--warn-text); }
.admin-plan-form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 0; }
.admin-plan-form select, .admin-plan-form input[type="date"] {
    background: var(--bg-color);
    color: var(--text-color);
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 13px;
    color-scheme: dark;
}
.admin-plan-form .btn-share { margin: 0; }
.admin-pager { display: flex; justify-content: center; gap: 16px; align-items: center; margin: 16px 0; font-size: 14px; }
.admin-pager a { color: var(--link); }
.admin-note { margin-top: 12px; }

/* ---------- Avisos de login/plano dentro das abas e do menu ---------- */
.login-prompt {
    text-align: center;
    color: var(--text-muted);
    padding: 24px 12px;
}
.login-prompt p { margin: 0 0 12px; font-size: 14px; }
.login-prompt__link { color: var(--link); font-weight: 600; }
.grid > .login-prompt, .grid > .empty-msg { grid-column: 1 / -1; }
.highlight-menu .login-prompt { padding: 2px 0; }
.highlight-menu .login-prompt p { font-size: 12px; margin-bottom: 8px; }
.highlight-menu .btn-login { width: 100%; padding: 6px; font-size: 13px; }

.plan-note {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0 0 12px;
}
.plan-note strong { color: var(--text-color); }
.btn-add:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---------- Rodapé e páginas legais ---------- */
.site-footer {
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    padding: 24px 12px 8px;
    margin-top: 32px;
    border-top: 1px solid var(--border);
}
.site-footer a { color: var(--text-muted); text-decoration: none; margin: 0 4px; }
.site-footer a:hover { color: var(--text-color); text-decoration: underline; }
.site-footer p { margin: 8px 0 0; font-size: 12px; }
.auth-page .site-footer { border-top: none; margin-top: 8px; padding-top: 8px; }
.auth-legal { font-size: 12px; color: var(--text-muted); margin: 10px 0 0; }
.auth-legal a, .login-modal__small a { color: var(--link); }

.legal-page { padding: 0; }
.legal-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--header-bg);
    backdrop-filter: blur(6px);
    border-bottom: 1px solid var(--border);
    padding: 10px 20px;
}
.legal-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text-color); text-decoration: none; font-weight: bold; }
.legal-brand img { border-radius: 10px; }
.legal-content {
    max-width: 760px;
    margin: 0 auto;
    padding: 28px 20px 8px;
    line-height: 1.75;
    font-size: 16px;
    color: var(--text-soft);
}
.legal-content h1 { color: var(--text-color); font-size: 30px; margin: 0 0 4px; }
.legal-content h2 { color: var(--text-color); font-size: 20px; margin: 32px 0 8px; scroll-margin-top: 70px; }
.legal-content p { text-align: left; font-size: 16px; margin: 0 0 12px; }
.legal-content ul { padding-left: 22px; margin: 0 0 12px; }
.legal-content li { margin-bottom: 6px; }
.legal-content a { color: var(--link); }
.legal-content a.btn { color: #fff; }
.legal-content a.btn-logout { color: var(--text-color); }
.legal-content code { background: var(--card-bg); padding: 1px 6px; border-radius: 4px; font-size: 14px; }
.legal-updated { color: var(--text-muted); font-size: 14px !important; margin-bottom: 20px !important; }
.legal-toc { background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px; padding: 12px 18px; margin: 20px 0; }
.legal-toc ol { margin: 0; padding-left: 20px; columns: 2; column-gap: 24px; font-size: 14px; }
.legal-table-wrap { overflow-x: auto; margin: 0 0 12px; }
.legal-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.legal-table th, .legal-table td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; }
.legal-table th { background: var(--card-bg); color: var(--text-color); }
@media (max-width: 600px) { .legal-toc ol { columns: 1; } .legal-content h1 { font-size: 24px; } }

.legal-highlight {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-left: 4px solid var(--success);
    border-radius: 10px;
    padding: 14px 18px;
    margin: 0 0 16px;
}
.legal-highlight p:last-child { margin-bottom: 0 !important; }

/* ---------- Assinaturas: badges, planos e painel da conta ---------- */
.sub-badge { display: inline-block; font-size: 11px; font-weight: bold; padding: 2px 8px; border-radius: 999px; margin-left: 6px; vertical-align: middle; }
.sub-badge--authorized { background: rgba(16, 185, 129, 0.18); color: var(--success-text); }
.sub-badge--pending    { background: rgba(245, 158, 11, 0.18); color: var(--warn-text); }
.sub-badge--paused     { background: rgba(148, 163, 184, 0.2); color: var(--text-soft); }
.sub-badge--cancelled  { background: rgba(239, 68, 68, 0.15); color: var(--danger-text); }

.legal-page--wide .legal-content { max-width: var(--page-max); }
.plans-intro { font-size: 16px; max-width: 760px; }
.plans-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; margin: 24px 0 32px; }
.plan-card {
    position: relative;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 22px 18px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: transform 0.2s, border-color 0.2s;
}
.plan-card:hover { transform: translateY(-3px); }
.plan-card--featured { border-color: #7c3aed; box-shadow: 0 10px 30px -12px rgba(124, 58, 237, 0.5); }
.plan-card--current { border-color: var(--success); }
.plan-card__ribbon { position: absolute; top: -10px; right: 14px; background: #7c3aed; color: #fff; font-size: 11px; font-weight: bold; padding: 3px 10px; border-radius: 999px; }
.plan-card h2 { margin: 0 !important; font-size: 18px; }
.plan-card__price { font-size: 28px !important; font-weight: bold; color: var(--text-color); margin: 4px 0 !important; }
.plan-card__price small { font-size: 14px; font-weight: normal; color: var(--text-muted); }
.plan-card__features { padding-left: 0 !important; list-style: none; flex: 1; }
.plan-card__features li { padding-left: 22px; position: relative; font-size: 14px; }
.plan-card__features li::before { content: "✓"; position: absolute; left: 0; color: var(--success); font-weight: bold; }
.plan-card__action .btn { display: block; width: 100%; text-align: center; text-decoration: none; padding: 10px; }
.plan-card__current { display: block; text-align: center; color: var(--text-muted); font-size: 14px; padding: 10px 0; }
.plan-form { display: flex; flex-direction: column; gap: 8px; }
.plan-form label { font-size: 12px; color: var(--text-muted); display: flex; flex-direction: column; gap: 4px; }
.plan-form input { background: var(--bg-color); border: 1px solid var(--border-strong); color: var(--text-color); padding: 8px 10px; border-radius: 6px; font-size: 14px; }
.plans-faq details { background: var(--card-bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; margin-bottom: 8px; }
.plans-faq summary { cursor: pointer; color: var(--text-color); font-weight: 600; }
.plans-faq details p { margin: 8px 0 0 !important; font-size: 15px !important; }

.account-panel { background: var(--bg-color); border: 1px solid var(--border); border-radius: 12px; padding: 18px; margin-bottom: 24px; }
.account-panel h2 { margin: 0 0 4px; font-size: 20px; }
.account-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.account-muted { color: var(--text-muted); font-size: 14px; text-align: left; margin: 0; }
.account-sub p { text-align: left; font-size: 14px; }
.account-sub__row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.account-label { display: block; font-size: 12px; color: var(--text-muted); }
.account-price { font-size: 22px; font-weight: bold; }
.account-price small { font-size: 13px; font-weight: normal; color: var(--text-muted); }
.account-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 14px 0; }
.account-stat { background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px; padding: 12px; font-size: 13px; color: var(--text-muted); display: flex; flex-direction: column; gap: 2px; }
.account-stat span { font-size: 24px; font-weight: bold; color: var(--text-color); }
.account-stat .account-stat__text { font-size: 16px; }
.account-stat small { font-size: 12px; color: var(--text-faint); }
.account-note { background: rgba(245, 158, 11, 0.1); border: 1px solid rgba(245, 158, 11, 0.3); border-radius: 8px; padding: 8px 12px; color: var(--warn-text-soft); }
.account-note--trial { background: rgba(16, 185, 129, 0.1); border-color: rgba(16, 185, 129, 0.35); color: var(--success-text-soft); }
.account-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.account-actions .btn { text-decoration: none; color: var(--text-color); padding: 8px 14px; font-size: 13px; display: inline-block; }
.inline-form { margin: 0; display: inline; }
.btn-danger-outline { background: transparent; border: 1px solid rgba(239, 68, 68, 0.6); color: var(--danger-text) !important; }
.btn-danger-outline:hover { background: rgba(239, 68, 68, 0.12); }
.account-subtitle { font-size: 15px; margin: 18px 0 8px; }
.account-table-wrap { overflow-x: auto; }
.account-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.account-table th, .account-table td { text-align: left; padding: 8px; border-bottom: 1px solid var(--border); }
.account-table th { color: var(--text-muted); font-weight: 600; font-size: 12px; }

/* Planos: período grátis, comparação e "em breve" */
.plan-card__tagline { color: var(--text-muted); font-size: 14px !important; margin: -4px 0 0 !important; }
.plan-card__trial {
    display: inline-block;
    align-self: flex-start;
    background: rgba(16, 185, 129, 0.15);
    color: var(--success-text);
    font-size: 13px !important;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 999px;
    margin: 0 !important;
}
.soon-tag {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 1px 6px;
    border-radius: 999px;
    background: rgba(245, 158, 11, 0.18);
    color: var(--warn-text);
    vertical-align: middle;
    margin-left: 4px;
}
.plans-compare { margin: 8px 0 32px; }
.compare-table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 620px; }
.compare-table th, .compare-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: center; }
.compare-table th:first-child, .compare-table td:first-child { text-align: left; }
.compare-table thead th { background: var(--card-bg); vertical-align: bottom; }
.compare-table .is-featured { background: rgba(124, 58, 237, 0.08); }
.compare-price { font-size: 12px; color: var(--text-muted); margin-top: 4px; font-weight: normal; }
.cmp-yes { color: var(--success); font-weight: bold; font-size: 16px; }
.cmp-no { color: var(--text-faint); }

/* Abas do admin */
.admin-nav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; border-bottom: 1px solid var(--border); padding-bottom: 10px; }
.admin-nav a { color: var(--text-muted); text-decoration: none; padding: 8px 14px; border-radius: 8px; font-size: 14px; font-weight: 600; }
.admin-nav a:hover { background: var(--card-bg); color: var(--text-color); }
.admin-nav a.is-active { background: var(--accent); color: #fff; }
.admin-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.admin-filters select, .admin-filters input { background: var(--card-bg); border: 1px solid var(--border-strong); color: var(--text-color); padding: 8px 10px; border-radius: 8px; color-scheme: dark; }
.admin-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.admin-card h2 { margin: 0 0 8px; font-size: 17px; }
.admin-check { list-style: none; padding: 0; margin: 0; font-size: 14px; }
.admin-check li { padding: 4px 0; }
.admin-code { background: var(--bg-color); border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; font-family: monospace; font-size: 13px; word-break: break-all; display: block; margin: 6px 0; }
.admin-mini-btn { background: transparent; border: 1px solid var(--border-strong); color: var(--text-color); border-radius: 6px; padding: 4px 8px; font-size: 12px; cursor: pointer; text-decoration: none; display: inline-block; }
.admin-mini-btn:hover { border-color: var(--accent); }

/* ==========================================================================
   Tema claro — ativado por <html data-theme="light"> (ver assets/js/theme.js)
   ========================================================================== */
:root[data-theme="light"] {
    --bg-color: #f1f5f9;
    --card-bg: #ffffff;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;
    --text-color: #0f172a;
    --text-muted: #475569;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --link: #1d4ed8;
    --text-soft: #334155;
    --text-faint: #64748b;
    --danger-text: #b91c1c;
    --danger-text-strong: #991b1b;
    --warn-text: #92400e;
    --warn-text-soft: #92400e;
    --success-text: #047857;
    --success-text-soft: #065f46;
    --header-bg: rgba(255, 255, 255, 0.92);
    --table-head: #f8fafc;
    --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 6px 16px rgba(15, 23, 42, 0.06);
    color-scheme: light;
}
:root[data-theme="light"] .card,
:root[data-theme="light"] .bible-container,
:root[data-theme="light"] .site-logo { box-shadow: var(--shadow); }
:root[data-theme="light"] .highlight-menu,
:root[data-theme="light"] .toast,
:root[data-theme="light"] .login-modal__card { box-shadow: 0 12px 32px -8px rgba(15, 23, 42, 0.25); }
:root[data-theme="light"] .login-modal__backdrop { background: rgba(15, 23, 42, 0.45); }
:root[data-theme="light"] .bible-text ::selection { background: rgba(37, 99, 235, 0.22); }
:root[data-theme="light"] .plan-badge--free { background: #e2e8f0; }
:root[data-theme="light"] .admin-tag { background: #e2e8f0; }
:root[data-theme="light"] .audio-thumb { background: #e2e8f0; }
:root[data-theme="light"] .btn-provider--google { border-color: #cbd5e1; }

/* Selos e avatar com fundo colorido mantêm texto branco nos dois temas */
.plan-badge--plano1, .plan-badge--plano2, .user-avatar--initial { color: #fff; }

/* Transição suave ao trocar de tema (sem animar no carregamento) */
.theme-ready body,
.theme-ready .card, .theme-ready .bible-container, .theme-ready .tab-btn,
.theme-ready .account-panel, .theme-ready .admin-table-wrap, .theme-ready .plan-card {
    transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

/* Botão de alternar tema */
.theme-toggle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border-strong);
    background: var(--card-bg);
    color: var(--text-color);
    cursor: pointer;
    font-size: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
    transition: transform 0.2s, border-color 0.2s;
}
a.btn { text-decoration: none; }
.theme-toggle:hover { border-color: var(--accent); transform: rotate(-15deg); }
.theme-toggle--floating { position: fixed; top: 14px; right: 14px; z-index: 20; }
.legal-header { display: flex; justify-content: space-between; align-items: center; }
.admin-header__actions { display: flex; gap: 8px; align-items: center; }

/* Escolha de aparência na engrenagem */
.theme-options { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 24px; }
.theme-option {
    flex: 1;
    min-width: 120px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    background: var(--bg-color);
    cursor: pointer;
    font-size: 14px;
}
.theme-option:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.theme-option input { accent-color: var(--accent); }

/* ---------- Acessibilidade: respeita "reduzir movimento" ---------- */
@media (prefers-reduced-motion: reduce) {
    :root { --float-shift: 0px; }
    .highlight-menu.is-below { --float-shift: 0px; }
    .highlight-menu .color-dot { transform: none; }
    .card:hover { transform: none; }
}

@media (max-width: 600px) {
    body { padding: 12px; }
    .tab-btn { padding: 8px 12px; font-size: 13px; }
    .bible-container { padding: 14px; }
}

/* --- Admin: configurações ---------------------------------------------------- */
.config-field { display: flex; flex-direction: column; gap: 4px; margin: 0 0 14px; max-width: 560px; }
.config-field label { font-weight: 600; font-size: 14px; }
.config-field input[type=text], .config-field input[type=number], .config-field input[type=password],
.config-field select, .config-field textarea, .config-plan input[type=text], .config-plan input[type=number], .config-plan textarea {
    width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--card-bg); color: var(--text); font: inherit; box-sizing: border-box;
}
.config-inline { display: inline-flex; align-items: center; gap: 6px; font-weight: 400 !important; margin-right: 14px; }
.config-checks { display: flex; flex-wrap: wrap; gap: 4px 0; margin: 6px 0; }
.config-plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; margin-bottom: 14px; }
.config-plan { border: 1px solid var(--border); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.config-plan label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; }
.config-plan .config-inline { flex-direction: row; }
