@import url('./base.css');

/* Idea Bank — app-specific styles below (somente variáveis do base.css) */

[hidden] { display: none !important; }
.nav-divider { height: 1px; background: var(--border); margin: 10px 4px; }
.hint { font-size: .75rem; color: var(--muted); font-weight: 400; }
textarea.input { resize: vertical; font-family: inherit; line-height: 1.4; width: 100%; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; color: var(--muted); cursor: pointer; }
body:not(.is-admin) .admin-only { display: none !important; }

.view { display: flex; flex-direction: column; gap: 14px; width: 100%; max-width: 820px; margin: 0 auto; min-width: 0; }
.view-wide { max-width: 1240px; }
.form-footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 10px; flex-wrap: wrap; }
.form-group .input { width: 100%; }

/* sidebar user */
.sidebar-nav { flex: 1; }
.sidebar-user { border-top: 1px solid var(--border); padding: 12px 8px 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: .8rem; color: var(--muted); }
#me-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }

/* login */
.login { height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-box { width: 380px; max-width: 100%; padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.login-box form { display: flex; flex-direction: column; gap: 12px; }
.login-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; }
.login-brand img { width: 28px; height: 28px; }

/* ribbon + grid */
.ribbon { display: flex; gap: 8px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.ribbon-sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }
.ribbon button:disabled { opacity: .45; cursor: not-allowed; }
#grid { border: none; }
.title-link { color: var(--text); text-decoration: none; font-weight: 600; }
.title-link:hover { color: var(--accent); }
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filters .input { width: auto; }
.filters input[type=search] { flex: 1; min-width: 180px; }

/* modal */
.modal-form-box.wide { width: 860px; }
.tabs { display: flex; gap: 4px; padding: 0 24px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.tab { background: transparent; border: none; border-bottom: 2px solid transparent; color: var(--muted); padding: 10px 12px; cursor: pointer; font-size: .85rem; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.modal-form-body form { display: flex; flex-direction: column; gap: 12px; }
fieldset.visibility { border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; display: flex; flex-direction: column; gap: 6px; }
fieldset.visibility legend { font-size: .78rem; color: var(--muted); font-weight: 600; padding: 0 4px; }
.reason { background: var(--surface2); border-left: 3px solid var(--yellow); padding: 8px 12px; border-radius: 6px; font-size: .85rem; }
.timeline { padding-left: 18px; display: flex; flex-direction: column; gap: 10px; font-size: .88rem; }

/* financial analysis */
.analysis { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.analysis-head { grid-column: 1 / -1; display: flex; gap: 10px; align-items: center; font-weight: 600; }
.analysis > .hint { grid-column: 1 / -1; }
.kpi { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
.kpi-label { font-size: .72rem; color: var(--muted); }
.kpi-value { font-size: 1.05rem; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; }
.form-section-title { font-size: .8rem; font-weight: 700; color: var(--accent); margin-top: 6px; }

/* setup */
.panel-body h3 { font-size: .9rem; margin: 6px 0 8px; display: flex; gap: 8px; align-items: center; }
.integration { border-bottom: 1px solid var(--border); padding-bottom: 14px; margin-bottom: 14px; display: flex; flex-direction: column; gap: 10px; }
.two-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.plain-list { list-style: none; display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.plain-list li { display: flex; gap: 8px; align-items: center; justify-content: space-between; font-size: .85rem; flex-wrap: wrap;
  background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; }
.inline-form { display: flex; gap: 8px; }
.inline-form .input { flex: 1; min-width: 0; }

/* embed */
body.embed { height: auto; overflow: auto; }
.embed-wrap { max-width: 760px; margin: 0 auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.embed-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.embed-head h1 { font-size: 1.05rem; }
.embed-tabs { padding: 0; }
.cards { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.card-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.card-top b { overflow-wrap: anywhere; }
.card-text { font-size: .88rem; color: var(--muted); overflow-wrap: anywhere; white-space: pre-wrap; }
.card-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.btn-sm.voted { color: var(--accent); border-color: var(--accent); }
.embed-form { padding: 14px; display: flex; flex-direction: column; gap: 12px; }

@media (max-width: 760px) {
  .sidebar { display: none; }
  .two-cols { grid-template-columns: 1fr; }
  .content { padding: 14px; }
}

/* Dashboard (2026-12-01) */
.dash-hero { display: grid; grid-template-columns: minmax(200px, 1fr) 2fr; gap: 14px; }
.dash-total { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; display: flex;
  flex-direction: column; align-items: flex-start; gap: 2px; cursor: pointer; color: var(--text); text-align: left; }
.dash-total:hover, .dash-tile:hover { border-color: var(--accent); }
.dash-total-value { font-size: 2.4rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; }
.dash-total-label { font-size: .85rem; color: var(--muted); }
.dash-recent { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.dash-recent .kpi { display: flex; flex-direction: column; justify-content: center; }
.dash-recent .kpi-value { font-size: 1.6rem; }
.dash-block { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.dash-title { font-size: .8rem; font-weight: 700; color: var(--accent); }
.dash-sub { font-size: .75rem; font-weight: 700; color: var(--muted); margin-top: 4px; }
.dash-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.dash-tile { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; cursor: pointer; color: var(--text);
  text-align: left; display: flex; flex-direction: column; gap: 6px; }
.dash-tile .kpi-value { font-size: 1.4rem; }
.dash-tile .badge { align-self: flex-start; }
.dash-tile.is-zero { opacity: .55; }
.dash-two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.dash-bars, .dash-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.dash-bar { display: grid; grid-template-columns: minmax(90px, 160px) 1fr 40px; gap: 10px; align-items: center; font-size: .85rem;
  background: none; border: none; color: var(--text); padding: 2px 0; text-align: left; width: 100%; }
button.dash-bar { cursor: pointer; }
button.dash-bar:hover .dash-bar-name { color: var(--accent); }
.dash-bar-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-bar-track { background: var(--surface2); border-radius: 4px; height: 8px; overflow: hidden; }
.dash-bar-fill { background: var(--accent); height: 100%; border-radius: 4px; }
.dash-bar-n { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.dash-item { display: flex; justify-content: space-between; gap: 10px; align-items: center; font-size: .85rem; }
.dash-item a { color: var(--text); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.dash-item a:hover { color: var(--accent); }
.dash-item-meta { display: flex; gap: 6px; align-items: center; flex-shrink: 0; color: var(--muted); font-size: .78rem; }
.dash-empty { font-size: .85rem; color: var(--muted); }
@media (max-width: 900px) { .dash-hero, .dash-two { grid-template-columns: 1fr; } }

/* Nota 1–10 (2026-12-01) */
.rating { display: flex; flex-direction: column; gap: 6px; }
.rating-avg { font-size: .85rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.rating-row { display: flex; gap: 4px; flex-wrap: wrap; }
.rating-btn { min-width: 30px; height: 30px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface2); color: var(--text);
  font-size: .8rem; cursor: pointer; font-variant-numeric: tabular-nums; }
.rating-btn:hover:not(:disabled) { border-color: var(--accent); }
.rating-btn.on { background: var(--accent); border-color: var(--accent); color: var(--bg); font-weight: 700; }
.rating-btn:disabled { opacity: .45; cursor: default; }

/* Embed novo + pré-visualização (2026-12-01) */
.embed-bar { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.embed-bar .tabs { padding: 0; border-bottom: none; }
.embed-bar select { width: auto; }
.card-title { overflow-wrap: anywhere; }
.link-btn { background: none; border: none; color: var(--accent); cursor: pointer; padding: 0; font-size: .8rem; align-self: flex-start; }
.vote-btn.voted { border-color: var(--accent); color: var(--accent); }
.embed-preview { border: 1px dashed var(--border); border-radius: var(--radius); background: var(--bg); padding: 8px; }
.embed-preview iframe { width: 100%; border: 0; min-height: 480px; display: block; }
textarea.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .78rem; resize: vertical; }

/* Embed: tema do app hospedeiro (theme=light|dark|auto) — só redefine as variáveis do base.css; ocupa a largura dele */
body.embed .embed-wrap { max-width: none; }
body.embed.theme-light {
  --bg: #ffffff; --surface: #ffffff; --surface2: #f1f5f9; --border: #e2e8f0; --text: #0f172a; --muted: #64748b;
}
@media (prefers-color-scheme: light) {
  body.embed.theme-auto { --bg: #ffffff; --surface: #ffffff; --surface2: #f1f5f9; --border: #e2e8f0; --text: #0f172a; --muted: #64748b; }
}

/* login pelo Identity (SLC-002) */
.identity-btn { display: flex; justify-content: center; text-decoration: none; }
.login-error { color: var(--red); }
