/* ── meta.css — Akino Systems ── */

/* ══════════════════════════════════════
   INTEGRATION CARDS — segue padrão .card
══════════════════════════════════════ */
.intg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.intg-card {
  background: var(--s1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color .15s;
}
.intg-card:hover { border-color: var(--border2); }

/* Header do card */
.intg-card-hd {
  padding: 14px 16px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}

.intg-logo {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  background: var(--s2);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.intg-info { flex: 1; min-width: 0; }
.intg-name {
  font-size: 13px; font-weight: 500;
  color: var(--text); letter-spacing: -.1px;
}
.intg-desc {
  font-size: 11.5px; color: var(--muted); margin-top: 2px;
}

/* Status badge — estilo dos badges do sistema */
.intg-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 10.5px; font-weight: 500;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.intg-badge--connected {
  background: rgba(16,185,129,.08);
  color: var(--green);
  border-color: rgba(16,185,129,.2);
}
.intg-badge--disconnected {
  background: var(--s2);
  color: var(--muted);
}
.intg-badge-dot {
  width: 5px; height: 5px;
  border-radius: 50%; flex-shrink: 0;
  background: currentColor;
}

/* Body do card */
.intg-card-body { padding: 12px 16px 14px; display: flex; flex-direction: column; gap: 10px; }

/* Info de conta conectada */
.intg-account-info {
  background: var(--s2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  overflow: hidden;
}
.intg-account-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 10px;
  font-size: 12px;
  border-bottom: 1px solid var(--border);
}
.intg-account-row:last-child { border-bottom: none; }
.intg-account-row span { color: var(--muted); }
.intg-account-row strong { color: var(--text); font-weight: 500; font-size: 12px; }
.intg-account-row code {
  font-family: monospace; font-size: 11px;
  color: var(--muted); background: var(--s3);
  padding: 1px 6px; border-radius: 4px;
  border: 1px solid var(--border);
}

/* Botões — herdam do sistema */
.intg-actions { display: flex; gap: 7px; }

.btn-meta-connect {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 14px;
  background: #1877F2;
  color: #fff;
  border: 1px solid #1877F2;
  border-radius: var(--radius-sm);
  font-family: inherit; font-size: 12.5px; font-weight: 500;
  cursor: pointer; white-space: nowrap; line-height: 1.4;
  transition: opacity .12s, transform .1s;
  flex: 1; justify-content: center;
}
.btn-meta-connect:hover { opacity: .88; transform: translateY(-1px); }
.btn-meta-connect:active { transform: translateY(0); opacity: 1; }

.btn-meta-disconnect {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px;
  background: none;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit; font-size: 12px; font-weight: 400;
  cursor: pointer; white-space: nowrap; line-height: 1.4;
  transition: all .12s;
}
.btn-meta-disconnect:hover {
  color: var(--red, #ef4444);
  border-color: var(--red, #ef4444);
  background: var(--red-bg, rgba(239,68,68,.06));
}

/* "Em breve" button */
.btn-soon {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; padding: 7px 14px;
  background: none; color: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit; font-size: 12px; font-weight: 400;
  cursor: default; flex: 1;
  opacity: .7;
}

/* ══════════════════════════════════════
   META OAUTH MODAL
   Segue o padrão dos modais existentes
══════════════════════════════════════ */
.meta-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.3);
  z-index: 900;
  display: none; align-items: center; justify-content: center;
}
body.dark .meta-modal-overlay { background: rgba(0,0,0,.55); }
.meta-modal-overlay.open { display: flex; }

.meta-modal-box {
  background: var(--s1);
  border: 1px solid var(--border2);
  border-radius: 14px;
  padding: 28px 24px 22px;
  width: 340px;
  max-width: calc(100vw - 32px);
  display: flex; flex-direction: column;
  align-items: center; gap: 14px;
  box-shadow: 0 16px 48px rgba(0,0,0,.12);
  animation: fadeUp .2s cubic-bezier(.16,1,.3,1) both;
}
body.dark .meta-modal-box { box-shadow: 0 16px 48px rgba(0,0,0,.45); }

/* Ícones do modal */
.meta-modal-icon-wrap {
  width: 48px; height: 48px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.meta-modal-icon-wrap--success {
  background: rgba(16,185,129,.1);
  color: var(--green, #10b981);
}
.meta-modal-icon-wrap--error {
  background: rgba(239,68,68,.08);
  color: var(--red, #ef4444);
}
.meta-modal-icon-wrap--loading {
  background: var(--s2);
}

/* Spinner fiel ao padrão do sistema */
.meta-spinner {
  width: 26px; height: 26px;
  border: 2.5px solid var(--border2);
  border-top-color: #1877F2;
  border-radius: 50%;
  animation: metaSpin .7s linear infinite;
}
@keyframes metaSpin { to { transform: rotate(360deg); } }

#meta-modal-title {
  font-size: 14.5px; font-weight: 600;
  color: var(--text); letter-spacing: -.2px;
  text-align: center; margin: 0;
}

.meta-modal-sub {
  font-size: 12.5px; color: var(--muted);
  text-align: center; line-height: 1.5;
  margin: 0;
}

/* Info box no modal de sucesso */
.meta-modal-info {
  width: 100%;
  background: var(--s2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.meta-modal-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px;
  font-size: 12px;
  border-bottom: 1px solid var(--border);
}
.meta-modal-row:last-child { border-bottom: none; }
.meta-modal-row span { color: var(--muted); }
.meta-modal-row strong { color: var(--text); font-weight: 500; }
.meta-modal-row code {
  font-family: monospace; font-size: 11px;
  background: var(--s3); color: var(--muted);
  padding: 1px 6px; border-radius: 4px;
  border: 1px solid var(--border);
}

/* Botão primário do modal — igual .btn-primary */
.meta-modal-confirm {
  display: inline-flex; align-items: center; justify-content: center;
  width: 100%; padding: 9px 14px;
  background: var(--ink); color: var(--bg);
  border: 1px solid var(--ink);
  border-radius: var(--radius-sm);
  font-family: inherit; font-size: 13px; font-weight: 500;
  cursor: pointer; transition: opacity .12s;
}
.meta-modal-confirm:hover { opacity: .85; }

/* ══════════════════════════════════════
   MARKETING DASHBOARD — KPI CARDS
══════════════════════════════════════ */
.dash-grid-5 {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}
@media (max-width: 1100px) {
  .dash-grid-5 { grid-template-columns: repeat(3, 1fr); }
}

.mkt-kpi-card .card-body {
  padding: 14px 16px 16px;
}
.mkt-kpi-label {
  font-size: 11.5px; color: var(--muted);
  font-weight: 400; margin-bottom: 6px;
  letter-spacing: .1px;
}
.mkt-kpi-value {
  font-size: 22px; font-weight: 600;
  color: var(--text); letter-spacing: -.5px;
  line-height: 1.1; margin-bottom: 4px;
}
.mkt-kpi-sub {
  font-size: 11px; color: var(--muted);
}

/* ══════════════════════════════════════
   CAMPANHAS TABLE
══════════════════════════════════════ */
.mkt-table {
  width: 100%; border-collapse: collapse;
  font-size: 12.5px;
}
.mkt-table th {
  padding: 10px 16px;
  text-align: left;
  font-size: 11px; font-weight: 500;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.mkt-table td {
  padding: 11px 16px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.mkt-table tr:last-child td { border-bottom: none; }
.mkt-table tr:hover td { background: var(--s2); }

.mkt-status-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 20px;
  font-size: 10.5px; font-weight: 500;
  border: 1px solid var(--border);
}
.mkt-status-badge--active {
  background: rgba(16,185,129,.08);
  color: var(--green, #10b981);
  border-color: rgba(16,185,129,.2);
}
.mkt-status-badge--paused {
  background: var(--s2); color: var(--muted);
}

/* Top ads list */
.mkt-ad-row {
  display: flex; align-items: center;
  gap: 12px; padding: 11px 16px;
  border-bottom: 1px solid var(--border);
}
.mkt-ad-row:last-child { border-bottom: none; }
.mkt-ad-rank {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--s2); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; color: var(--muted);
  flex-shrink: 0;
}
.mkt-ad-rank--1 { background: rgba(251,191,36,.15); border-color: rgba(251,191,36,.3); color: #d97706; }
.mkt-ad-rank--2 { background: rgba(148,163,184,.12); border-color: rgba(148,163,184,.3); color: #64748b; }
.mkt-ad-rank--3 { background: rgba(180,83,9,.1); border-color: rgba(180,83,9,.25); color: #b45309; }
.mkt-ad-name { flex: 1; font-size: 12.5px; color: var(--text); font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mkt-ad-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }
.mkt-ad-stats { display: flex; gap: 16px; flex-shrink: 0; }
.mkt-ad-stat { text-align: right; }
.mkt-ad-stat-val { font-size: 12.5px; font-weight: 600; color: var(--text); }
.mkt-ad-stat-lbl { font-size: 10.5px; color: var(--muted); }

/* ─── Drag & Drop KPI cards ─────────────────────────────────────── */
.mkt-kpi-card[draggable] { cursor: grab; transition: box-shadow .15s, opacity .15s, transform .15s; }
.mkt-kpi-card[draggable]:active { cursor: grabbing; }
.mkt-kpi-card.dragging { opacity: .45; transform: scale(.97); box-shadow: 0 8px 24px rgba(0,0,0,.12); }
.mkt-kpi-card.drag-over { box-shadow: 0 0 0 2px var(--accent, #6366f1); }

/* ─── Modal Personalizar ────────────────────────────────────────── */
.mkt-cust-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 8px;
  border-radius: var(--radius-sm);
  background: var(--s1);
  border: 1px solid var(--border);
  cursor: default;
  user-select: none;
  transition: background .12s;
}
.mkt-cust-row.dragging { opacity: .4; }
.mkt-cust-row.drag-over { border-color: var(--accent, #6366f1); background: var(--s2); }
.mkt-cust-drag { color: var(--muted); cursor: grab; padding: 2px; flex-shrink: 0; }
.mkt-cust-drag:active { cursor: grabbing; }
.mkt-cust-info { flex: 1; min-width: 0; }
.mkt-cust-label { font-size: 13px; font-weight: 500; color: var(--text); }
.mkt-cust-sub   { font-size: 11.5px; color: var(--muted); }

/* Toggle switch */
.mkt-cust-toggle { position: relative; width: 34px; height: 19px; flex-shrink: 0; cursor: pointer; }
.mkt-cust-toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.mkt-cust-slider {
  position: absolute; inset: 0;
  background: var(--border2, #ddd);
  border-radius: 999px;
  transition: background .2s;
}
.mkt-cust-slider::before {
  content: '';
  position: absolute;
  width: 13px; height: 13px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.mkt-cust-toggle input:checked + .mkt-cust-slider { background: var(--accent, #6366f1); }
.mkt-cust-toggle input:checked + .mkt-cust-slider::before { transform: translateX(15px); }



/* ─── Barra de controles UTMfy-style ────────────────────────────── */
.mkt-controls-bar {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.mkt-ctrl-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.mkt-ctrl-label {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: .04em;
  text-transform: uppercase;
}
.mkt-ctrl-select-wrap {
  position: relative;
}
.mkt-ctrl-select {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 11px;
  background: var(--s1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .15s, background .15s;
  min-width: 148px;
}
.mkt-ctrl-select:hover { border-color: var(--border2); background: var(--s2); }
.mkt-ctrl-select.active { border-color: var(--border2); }
.mkt-platform-icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

/* Separador vertical entre controles e personalizar */
.mkt-controls-divider {
  width: 1px;
  height: 34px;
  background: var(--border);
  margin: 0 2px;
  align-self: flex-end;
}

/* Dropdown dos controles */
.mkt-ctrl-dd {
  display: none;
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  min-width: 190px;
  background: var(--s1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0,0,0,.13);
  z-index: 120;
  overflow: hidden;
}
.mkt-ctrl-dd.open { display: block; animation: fadeUp .15s cubic-bezier(.16,1,.3,1) both; }
.mkt-ctrl-dd-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 13px;
  font-size: 12.5px;
  color: var(--text);
  cursor: pointer;
  transition: background .1s;
}
.mkt-ctrl-dd-item:hover { background: var(--s2); }
.mkt-ctrl-dd-item.active { color: var(--accent, #6366f1); font-weight: 500; }
.mkt-ctrl-dd-item.disabled { opacity: .45; cursor: default; pointer-events: none; }
.mkt-soon-tag {
  margin-left: auto;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--s2);
  color: var(--muted);
  font-weight: 500;
  letter-spacing: .02em;
}
