/* =========================================================
   Componentes compartilhados (login, configurações, ajuda)
   Requer style.css (variáveis e animações base)
   ========================================================= */

/* Transição suave entre páginas (Chrome/Edge 126+) */
@view-transition { navigation: auto; }

@keyframes spin  { to { transform: rotate(360deg); } }
@keyframes shake {
  10%, 90% { transform: translateX(-1px); } 20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-5px); } 40%, 60% { transform: translateX(5px); }
}
.shake { animation: shake .45s var(--ease-in-out); }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 18px; border-radius: 999px; white-space: nowrap;
  font-size: 14px; font-weight: 500; border: 1px solid transparent;
  transition: background-color .2s, color .2s, border-color .2s, opacity .2s, transform .15s var(--ease-out);
}
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-lg { height: 48px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-primary { background: #0d0d0d; color: #fff; }
.btn-primary:hover:not(:disabled) { background: #2b2b2b; }
.dark .btn-primary { background: #fff; color: #0d0d0d; }
.dark .btn-primary:hover:not(:disabled) { background: #e5e5e5; }
.btn-secondary { border-color: rgb(0 0 0 / .12); }
.btn-secondary:hover:not(:disabled) { background: rgb(0 0 0 / .04); }
.dark .btn-secondary { border-color: rgb(255 255 255 / .14); }
.dark .btn-secondary:hover:not(:disabled) { background: rgb(255 255 255 / .06); }
.btn-danger { background: rgb(220 38 38); color: #fff; }
.btn-danger:hover:not(:disabled) { background: rgb(185 28 28); }
.btn-danger-outline { color: rgb(220 38 38); border-color: rgb(220 38 38 / .3); }
.btn-danger-outline:hover:not(:disabled) { background: rgb(220 38 38 / .06); }
.dark .btn-danger-outline { color: rgb(248 113 113); border-color: rgb(248 113 113 / .3); }
.dark .btn-danger-outline:hover:not(:disabled) { background: rgb(248 113 113 / .08); }
.btn .spinner { display: none; }
.btn.loading .spinner { display: inline-block; }
.btn.loading .btn-label { opacity: .7; }
.spinner {
  width: 16px; height: 16px; border-radius: 999px;
  border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite;
}

/* ---------- Campos ---------- */
.field-label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 500; color: rgb(64 64 64); }
.dark .field-label { color: rgb(212 212 212); }
.input {
  width: 100%; height: 46px; padding: 0 14px; border-radius: 12px; font-size: 15px;
  background: #fff; border: 1px solid rgb(0 0 0 / .12); color: inherit;
  transition: border-color .2s, box-shadow .25s, background-color .2s;
}
.input::placeholder { color: rgb(163 163 163); }
.input:focus { outline: none; border-color: rgb(139 92 246 / .7); box-shadow: 0 0 0 4px rgb(139 92 246 / .12); }
.input.invalid { border-color: rgb(239 68 68); box-shadow: 0 0 0 4px rgb(239 68 68 / .1); }
textarea.input { height: auto; min-height: 104px; padding: 11px 14px; line-height: 1.6; resize: vertical; }
select.input {
  appearance: none; padding-right: 38px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a3a3a3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 16px;
}
.input-sm { height: 38px; font-size: 14px; border-radius: 10px; }
.dark .input { background: rgb(255 255 255 / .04); border-color: rgb(255 255 255 / .12); }
.dark .input:focus { border-color: rgb(167 139 250 / .7); box-shadow: 0 0 0 4px rgb(139 92 246 / .18); }
.dark select.input option { background: #2f2f2f; }
.input-group { position: relative; }
.input-group > [data-icon] { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: rgb(163 163 163); pointer-events: none; }
.input-group > .input { padding-left: 42px; }
.input-group > .input-action { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); height: 34px; width: 34px; }
.input-group > .input-action:active { transform: translateY(-50%) scale(.94); }

/* ---------- Switch ---------- */
.switch { position: relative; display: inline-flex; width: 42px; height: 24px; flex-shrink: 0; }
.switch input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.switch .track { position: absolute; inset: 0; border-radius: 999px; background: rgb(212 212 212); transition: background-color .25s; }
.switch .thumb {
  position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 999px; background: #fff;
  box-shadow: 0 1px 3px rgb(0 0 0 / .25); transition: transform .35s var(--ease-out), background-color .25s;
}
.switch input:checked ~ .track { background: #0d0d0d; }
.switch input:checked ~ .thumb { transform: translateX(18px); }
.switch input:focus-visible ~ .track { outline: 2px solid rgb(139 92 246 / .6); outline-offset: 2px; }
.dark .switch .track { background: rgb(255 255 255 / .18); }
.dark .switch input:checked ~ .track { background: #fff; }
.dark .switch input:checked ~ .thumb { background: #171717; }

/* ---------- Segmented control ---------- */
.segmented { position: relative; display: inline-flex; padding: 3px; border-radius: 999px; background: rgb(0 0 0 / .05); }
.segmented button {
  position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 14px;
  border-radius: 999px; font-size: 13px; font-weight: 500; color: rgb(115 115 115); transition: color .25s;
}
.segmented button.active { color: rgb(23 23 23); }
.segmented .indicator {
  position: absolute; top: 3px; bottom: 3px; left: 3px; width: 0; border-radius: 999px; background: #fff;
  box-shadow: 0 1px 3px rgb(0 0 0 / .12); transition: left .4s var(--ease-out), width .4s var(--ease-out);
}
.dark .segmented { background: rgb(255 255 255 / .06); }
.dark .segmented button { color: rgb(163 163 163); }
.dark .segmented button.active { color: #fff; }
.dark .segmented .indicator { background: rgb(255 255 255 / .12); box-shadow: none; }

/* ---------- Cards / linhas de configuração ---------- */
.card { border: 1px solid rgb(0 0 0 / .08); border-radius: 20px; padding: 4px 20px; background: #fff; }
.dark .card { border-color: rgb(255 255 255 / .08); background: rgb(255 255 255 / .02); }
.section-title { margin: 32px 0 10px 4px; font-size: 13px; font-weight: 500; color: rgb(115 115 115); }
.section-title:first-child { margin-top: 0; }
.setting-row {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 16px 0; border-bottom: 1px solid rgb(0 0 0 / .06);
}
.setting-row:last-child { border-bottom: 0; }
.dark .setting-row { border-color: rgb(255 255 255 / .06); }
.setting-row.stack { flex-direction: column; align-items: stretch; gap: 10px; }
.setting-title { font-size: 14.5px; font-weight: 500; }
.setting-desc { margin-top: 2px; font-size: 13px; line-height: 1.5; color: rgb(115 115 115); }
.dark .setting-desc { color: rgb(163 163 163); }
@media (max-width: 560px) { .setting-row.wrap-sm { flex-direction: column; align-items: stretch; gap: 12px; } }

.settings-nav button {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; white-space: nowrap;
  font-size: 14px; color: rgb(82 82 82); transition: background-color .2s, color .2s;
}
.settings-nav button:hover { background: rgb(0 0 0 / .04); color: rgb(23 23 23); }
.settings-nav button.active { background: rgb(0 0 0 / .06); color: rgb(23 23 23); font-weight: 500; }
.dark .settings-nav button { color: rgb(180 180 180); }
.dark .settings-nav button:hover { background: rgb(255 255 255 / .05); color: #fff; }
.dark .settings-nav button.active { background: rgb(255 255 255 / .08); color: #fff; }
.no-scrollbar { scrollbar-width: none; }
.no-scrollbar::-webkit-scrollbar { display: none; }

/* ---------- Fundo das páginas internas ---------- */
body.page-muted { background: #fafafa; }
.dark body.page-muted { background: #212121; }

/* ---------- Header das páginas internas ---------- */
.page-header {
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: saturate(180%) blur(12px); -webkit-backdrop-filter: saturate(180%) blur(12px);
  background: rgb(255 255 255 / .8); border-bottom: 1px solid rgb(0 0 0 / .06);
}
.dark .page-header { background: rgb(33 33 33 / .8); border-color: rgb(255 255 255 / .06); }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px;
  background: rgb(0 0 0 / .45); opacity: 0; transition: opacity .25s;
}
.modal-backdrop.open { opacity: 1; }
.modal {
  width: 100%; max-width: 420px; padding: 24px; border-radius: 22px; background: #fff;
  box-shadow: 0 30px 80px -20px rgb(0 0 0 / .45); opacity: 0; transform: translateY(14px) scale(.97);
  transition: transform .4s var(--ease-out), opacity .25s;
}
.modal-backdrop.open .modal { opacity: 1; transform: none; }
.dark .modal { background: #2f2f2f; }

/* ---------- Expansível (altura suave) ---------- */
.collapsible { display: grid; grid-template-rows: 0fr; opacity: 0; transition: grid-template-rows .4s var(--ease-out), opacity .3s; }
.collapsible.open { grid-template-rows: 1fr; opacity: 1; }
.collapsible > div { overflow: hidden; min-height: 0; }

/* ---------- Ajuda ---------- */
.faq-item { border-bottom: 1px solid rgb(0 0 0 / .07); }
.dark .faq-item { border-color: rgb(255 255 255 / .07); }
.faq-item:last-child { border-bottom: 0; }
.faq-q { display: flex; align-items: center; gap: 12px; width: 100%; padding: 18px 4px; text-align: left; font-size: 15px; font-weight: 500; }
.faq-q .chev { margin-left: auto; color: rgb(163 163 163); transition: transform .4s var(--ease-out); }
.faq-item.open .faq-q .chev { transform: rotate(180deg); }
.faq-a { padding: 0 4px 18px; font-size: 14.5px; line-height: 1.7; color: rgb(82 82 82); }
.dark .faq-a { color: rgb(190 190 190); }
.faq-tag {
  font-size: 11.5px; font-weight: 500; padding: 2px 8px; border-radius: 999px; white-space: nowrap;
  background: rgb(0 0 0 / .05); color: rgb(115 115 115);
}
.dark .faq-tag { background: rgb(255 255 255 / .07); color: rgb(163 163 163); }
mark { background: rgb(250 204 21 / .35); color: inherit; border-radius: 3px; padding: 0 1px; }
.dark mark { background: rgb(250 204 21 / .25); }

.cat-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 999px; white-space: nowrap;
  font-size: 13.5px; font-weight: 500; border: 1px solid rgb(0 0 0 / .1); color: rgb(82 82 82);
  transition: background-color .2s, color .2s, border-color .2s, transform .15s var(--ease-out);
}
.cat-chip:hover { background: rgb(0 0 0 / .04); }
.cat-chip:active { transform: scale(.96); }
.cat-chip.active { background: #0d0d0d; border-color: #0d0d0d; color: #fff; }
.dark .cat-chip { border-color: rgb(255 255 255 / .12); color: rgb(190 190 190); }
.dark .cat-chip:hover { background: rgb(255 255 255 / .06); }
.dark .cat-chip.active { background: #fff; border-color: #fff; color: #0d0d0d; }

.help-search { transition: box-shadow .3s, border-color .3s; }
.help-search:focus-within { border-color: rgb(139 92 246 / .6); box-shadow: 0 0 0 5px rgb(139 92 246 / .1), 0 10px 40px -12px rgb(0 0 0 / .18); }

/* ---------- Login ---------- */
.auth-glow { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.auth-glow::before, .auth-glow::after {
  content: ''; position: absolute; width: 520px; height: 520px; border-radius: 999px; filter: blur(90px); opacity: .3;
}
.auth-glow::before { top: -200px; left: -140px; background: radial-gradient(circle, rgb(56 189 248), transparent 70%); }
.auth-glow::after { bottom: -220px; right: -160px; background: radial-gradient(circle, rgb(139 92 246), transparent 70%); }
.dark .auth-glow::before, .dark .auth-glow::after { opacity: .16; }
.divider { display: flex; align-items: center; gap: 12px; font-size: 12px; color: rgb(163 163 163); }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: rgb(0 0 0 / .08); }
.dark .divider::before, .dark .divider::after { background: rgb(255 255 255 / .1); }
.fade-swap { transition: opacity .2s, transform .3s var(--ease-out); }
.fade-swap.swapping { opacity: 0; transform: translateY(4px); }

/* Tamanho da interface (zoom geral) */
.zoom-ctl { display: flex; align-items: center; gap: 6px; }
.zoom-btn { display: grid; place-items: center; height: 34px; width: 34px; border-radius: 999px; border: 1px solid rgb(0 0 0 / .1); transition: background-color .2s; }
.zoom-btn:hover { background: rgb(0 0 0 / .04); }
.dark .zoom-btn { border-color: rgb(255 255 255 / .14); }
.dark .zoom-btn:hover { background: rgb(255 255 255 / .06); }
.zoom-ctl input[type=range] {
  appearance: none; width: 150px; height: 4px; border-radius: 999px; cursor: pointer;
  background: linear-gradient(to right, rgb(124 58 237) var(--p, 28%), rgb(0 0 0 / .12) var(--p, 28%));
}
.dark .zoom-ctl input[type=range] { background: linear-gradient(to right, rgb(167 139 250) var(--p, 28%), rgb(255 255 255 / .15) var(--p, 28%)); }
.zoom-ctl input[type=range]::-webkit-slider-thumb { appearance: none; height: 18px; width: 18px; border-radius: 999px; background: #fff; border: 2px solid rgb(124 58 237); box-shadow: 0 1px 4px rgb(0 0 0 / .2); }
.zoom-ctl input[type=range]::-moz-range-thumb { height: 14px; width: 14px; border-radius: 999px; background: #fff; border: 2px solid rgb(124 58 237); }
.zoom-val { min-width: 54px; height: 30px; padding: 0 8px; border-radius: 8px; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.zoom-val:hover { background: rgb(0 0 0 / .05); }
.dark .zoom-val:hover { background: rgb(255 255 255 / .06); }
.zoom-presets { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; padding: 0 0 16px; margin-top: -6px; border-bottom: 1px solid rgb(0 0 0 / .06); }
.dark .zoom-presets { border-color: rgb(255 255 255 / .06); }
.zoom-presets button { height: 28px; padding: 0 11px; border-radius: 999px; border: 1px solid rgb(0 0 0 / .1); font-size: 12.5px; color: rgb(82 82 82); }
.zoom-presets button:hover { background: rgb(0 0 0 / .04); }
.zoom-presets button.active { background: rgb(124 58 237 / .1); border-color: rgb(124 58 237 / .4); color: rgb(109 40 217); font-weight: 500; }
.dark .zoom-presets button { border-color: rgb(255 255 255 / .14); color: rgb(200 200 200); }
.dark .zoom-presets button.active { color: rgb(196 181 253); }
@media (max-width: 560px) { .zoom-ctl input[type=range] { flex: 1; width: auto; } .zoom-presets { justify-content: flex-start; } }
