/* ============================================================================
   Developer Portal — CAOSmarada API (reestruturação 2026-06-22)
   Design premium para a aba "API Keys" -> Developer Portal.
   Usa os tokens globais (--accent, --bg-*, --text-*, --glass-border, --radius).
   ============================================================================ */

#page-apikeys { --dp-accent: var(--accent, #0d83ff); }

/* ── Header ────────────────────────────────────────────────────────────────── */
.dp-header-actions { display: flex; gap: 10px; align-items: center; }

.dp-tier-pill {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 11px; font-weight: 700; letter-spacing: .3px;
    padding: 5px 12px; border-radius: 999px;
    background: linear-gradient(135deg, rgba(13,131,255,.18), rgba(99,102,241,.14));
    border: 1px solid rgba(13,131,255,.35); color: var(--text-primary);
    white-space: nowrap;
}
.dp-tier-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 8px #22c55e; }

/* ── Upsell (Free) ──────────────────────────────────────────────────────────── */
.dp-upsell {
    position: relative; overflow: hidden;
    border: 1px solid rgba(13,131,255,.25); border-radius: var(--radius, 16px);
    background:
        radial-gradient(1200px 200px at 100% -40%, rgba(99,102,241,.18), transparent),
        linear-gradient(160deg, rgba(13,131,255,.10), rgba(0,0,0,.18));
    padding: 40px 36px; text-align: center;
}
.dp-upsell h3 { font-size: 22px; margin: 0 0 8px; color: var(--text-primary); }
.dp-upsell p  { color: var(--text-secondary); max-width: 560px; margin: 0 auto 22px; line-height: 1.7; font-size: 13px; }
.dp-upsell .dp-upsell-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; max-width: 720px; margin: 0 auto 26px; }
.dp-upsell .dp-feat { background: rgba(255,255,255,.04); border: 1px solid var(--glass-border); border-radius: 12px; padding: 16px; }
.dp-upsell .dp-feat .ico { color: var(--dp-accent); margin-bottom: 8px; display: inline-flex; }
.dp-upsell .dp-feat b { display: block; font-size: 13px; color: var(--text-primary); margin-bottom: 3px; }
.dp-upsell .dp-feat span { font-size: 11px; color: var(--text-muted); }

/* ── Tabs do portal ─────────────────────────────────────────────────────────── */
.dp-tabs {
    display: flex; gap: 2px; margin-bottom: 22px; flex-wrap: wrap;
    border-bottom: 1px solid var(--glass-border);
}
.portal-tab {
    appearance: none; background: transparent; border: 0;
    border-bottom: 2px solid transparent;
    color: var(--text-muted); font-size: 13px; font-weight: 600;
    padding: 10px 16px; cursor: pointer; transition: color .15s, border-color .15s;
    display: inline-flex; align-items: center; gap: 7px;
}
.portal-tab:hover { color: var(--text-secondary); }
.portal-tab.active { color: var(--dp-accent); border-bottom-color: var(--dp-accent); }

/* ── Cards de métrica (overview) ────────────────────────────────────────────── */
.dp-stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 20px; }
.dp-stat {
    background: var(--bg-secondary, #131722); border: 1px solid var(--glass-border);
    border-radius: 14px; padding: 18px;
}
.dp-stat .label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 8px; }
.dp-stat .value { font-size: 26px; font-weight: 800; color: var(--text-primary); line-height: 1; }
.dp-stat .value small { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.dp-stat .sub { font-size: 11px; color: var(--text-muted); margin-top: 6px; }

/* gauge de quota */
.dp-quota-bar { height: 8px; border-radius: 6px; background: rgba(255,255,255,.08); overflow: hidden; margin-top: 10px; }
.dp-quota-bar > i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, #22c55e, #0d83ff); transition: width .4s; }
.dp-quota-bar.warn > i { background: linear-gradient(90deg, #f59e0b, #ef4444); }

/* ── Quickstart ─────────────────────────────────────────────────────────────── */
.dp-steps { display: grid; gap: 12px; counter-reset: dpstep; }
.dp-step { display: flex; gap: 14px; align-items: flex-start; }
.dp-step .n {
    counter-increment: dpstep; flex: 0 0 auto;
    width: 26px; height: 26px; border-radius: 50%;
    display: grid; place-items: center; font-size: 12px; font-weight: 800;
    background: rgba(13,131,255,.15); color: var(--dp-accent); border: 1px solid rgba(13,131,255,.4);
}
.dp-step .n::before { content: counter(dpstep); }
.dp-step .body b { font-size: 13px; color: var(--text-primary); }
.dp-step .body p { font-size: 12px; color: var(--text-muted); margin: 3px 0 0; }

/* ── Endpoint cards (catálogo) ──────────────────────────────────────────────── */
.dp-cat-group { margin-bottom: 26px; }
.dp-cat-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.dp-cat-head h4 { margin: 0; font-size: 14px; color: var(--text-primary); }
.dp-cat-head .scope { font-family: ui-monospace, monospace; font-size: 10px; color: var(--text-muted); background: rgba(255,255,255,.05); padding: 2px 8px; border-radius: 6px; }

.dp-endpoints { display: grid; gap: 10px; }
.dp-ep {
    background: var(--bg-secondary, #131722); border: 1px solid var(--glass-border);
    border-left: 3px solid var(--dp-accent); border-radius: 12px; padding: 14px 16px;
    transition: border-color .15s, transform .1s;
}
.dp-ep:hover { transform: translateX(2px); }
.dp-ep-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dp-method {
    font-family: ui-monospace, monospace; font-size: 10px; font-weight: 800;
    padding: 3px 9px; border-radius: 6px; letter-spacing: .5px;
    background: rgba(34,197,94,.16); color: #22c55e;
}
.dp-ep code.path { font-family: ui-monospace, monospace; font-size: 12.5px; color: var(--text-primary); }
.dp-ep .desc { font-size: 12px; color: var(--text-secondary); margin: 8px 0 0; }
.dp-tier-tag {
    margin-left: auto; font-size: 10px; font-weight: 700; padding: 2px 9px; border-radius: 999px;
    background: rgba(255,255,255,.06); color: var(--text-muted);
}
.dp-tier-tag.premium { background: linear-gradient(135deg, rgba(168,85,247,.2), rgba(99,102,241,.18)); color: #c4b5fd; }
.dp-ep .try { margin-top: 10px; }

/* ── Tabela de chaves ───────────────────────────────────────────────────────── */
.dp-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.dp-table th { text-align: left; padding: 9px 12px; font-size: 11px; color: var(--text-muted); font-weight: 600; border-bottom: 2px solid var(--glass-border); }
.dp-table td { padding: 11px 12px; border-bottom: 1px solid rgba(255,255,255,.05); vertical-align: middle; }
.dp-table tr:hover td { background: rgba(255,255,255,.02); }
.dp-key-name { font-weight: 700; color: var(--text-primary); }
.dp-key-prefix { font-family: ui-monospace, monospace; font-size: 11px; background: rgba(255,255,255,.06); padding: 2px 7px; border-radius: 5px; color: #94a3b8; }
.dp-badge-on { font-size: 10px; background: rgba(34,197,94,.12); color: #22c55e; padding: 2px 8px; border-radius: 10px; font-weight: 700; }
.dp-badge-off { font-size: 10px; background: rgba(239,68,68,.12); color: #ef4444; padding: 2px 8px; border-radius: 10px; font-weight: 700; }

/* token reveal */
.dp-token-reveal { border: 1px solid rgba(34,197,94,.4); background: rgba(34,197,94,.05); border-radius: 14px; padding: 18px; margin-bottom: 16px; }
.dp-token-value { background: rgba(0,0,0,.35); border: 1px solid rgba(34,197,94,.3); border-radius: 8px; padding: 14px; font-family: ui-monospace, monospace; font-size: 13px; word-break: break-all; color: #4ade80; user-select: all; }

/* ── Playground ─────────────────────────────────────────────────────────────── */
.dp-pg-grid { display: grid; grid-template-columns: 380px 1fr; gap: 18px; }
@media (max-width: 900px) { .dp-pg-grid { grid-template-columns: 1fr; } }
.dp-pg-resp {
    background: var(--bg-primary, #0d1117); border: 1px solid var(--glass-border); border-radius: 12px;
    padding: 16px; font-family: ui-monospace, monospace; font-size: 11.5px; color: var(--text-secondary);
    overflow: auto; margin: 0; min-height: 320px; max-height: 540px; line-height: 1.6; white-space: pre-wrap;
}
.dp-status-ok { color: #22c55e; font-weight: 700; }
.dp-status-err { color: #ef4444; font-weight: 700; }

/* ── Code blocks (exemplos) ─────────────────────────────────────────────────── */
.dp-code {
    background: var(--bg-primary, #0d1117); border: 1px solid var(--glass-border); border-radius: 12px;
    padding: 16px; font-family: ui-monospace, monospace; font-size: 12px; color: #e2e8f0;
    overflow-x: auto; margin: 0; line-height: 1.7;
}
.lang-tab {
    appearance: none; background: rgba(255,255,255,.04); border: 1px solid var(--glass-border);
    color: var(--text-muted); font-size: 12px; font-weight: 600; padding: 7px 14px; border-radius: 8px; cursor: pointer;
}
.lang-tab.active { background: rgba(13,131,255,.15); color: var(--dp-accent); border-color: rgba(13,131,255,.4); }

/* ── Mini chart (uso) ───────────────────────────────────────────────────────── */
.dp-chart { display: flex; align-items: flex-end; gap: 4px; height: 120px; padding: 8px 0; }
.dp-chart .bar { flex: 1; min-width: 3px; background: linear-gradient(180deg, var(--dp-accent), rgba(13,131,255,.3)); border-radius: 3px 3px 0 0; transition: height .3s; position: relative; }
.dp-chart .bar:hover { filter: brightness(1.3); }
.dp-chart-empty { color: var(--text-muted); font-size: 12px; text-align: center; padding: 40px; }
.dp-ep-list { display: grid; gap: 8px; }
.dp-ep-row { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.dp-ep-row code { font-family: ui-monospace, monospace; color: var(--text-secondary); flex: 0 0 auto; }
.dp-ep-row .track { flex: 1; height: 6px; background: rgba(255,255,255,.06); border-radius: 4px; overflow: hidden; }
.dp-ep-row .track > i { display: block; height: 100%; background: var(--dp-accent); }
.dp-ep-row .n { color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* ── Tabela de limites ──────────────────────────────────────────────────────── */
.dp-limits { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.dp-limits th, .dp-limits td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--glass-border); }
.dp-limits th { color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }
.dp-limits td.tier { font-weight: 700; color: var(--text-primary); }
.dp-limits tr.me { background: rgba(13,131,255,.06); }
