/* ─── Dashboard Builder ─── */

/* Widget cards no estilo UTMify */
.gs-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px 18px;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: border-color 0.2s;
}

.is-editing .gs-card {
  border: 1.5px dashed rgba(225, 29, 43, 0.5);
  cursor: move;
}

.gs-card-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}

.gs-card-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--white);
  line-height: 1;
  margin-bottom: 6px;
}

.gs-card-value.green-val { color: #22C55E; }

.gs-card-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: auto;
}

/* Ícone de informação no canto superior direito */
.gs-card-info {
  position: absolute;
  top: 12px;
  right: 12px;
  color: var(--text-dim);
  cursor: help;
  opacity: 0;
  transition: opacity 0.2s;
}
.gs-card:hover .gs-card-info { opacity: 1; }

/* ── Botão X de remover (dentro do card, canto superior direito) ── */
.gs-remove-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  background: rgba(225, 29, 43, 0.85);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  z-index: 30;
  font-size: 14px;
  line-height: 22px;
  text-align: center;
  padding: 0;
  display: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
  transition: background 0.15s, transform 0.15s;
  font-weight: bold;
}
.gs-remove-btn:hover {
  background: var(--red);
  transform: scale(1.15);
}
.is-editing .gs-remove-btn { display: block; }

/* ── Grid principal ── */
.grid-stack {
  margin-top: 0;
  min-height: 200px;
}

.grid-stack-item-content {
  border-radius: 10px;
  overflow: hidden; /* conter o card filho */
}

/* Placeholder ao arrastar dentro da grade */
.grid-stack-placeholder > .placeholder-content {
  background: rgba(225, 29, 43, 0.07) !important;
  border: 2px dashed rgba(225, 29, 43, 0.45) !important;
  border-radius: 10px !important;
}

/* Item sendo arrastado dentro da grade */
.grid-stack-item.ui-draggable-dragging .gs-card {
  box-shadow: 0 20px 50px rgba(0,0,0,0.7);
  border-color: rgba(225,29,43,0.6) !important;
  opacity: 0.9;
}

/* ── Preview ao arrastar da sidebar ── */
.drag-preview-ghost {
  background: var(--card);
  border: 2px dashed rgba(225, 29, 43, 0.6);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  pointer-events: none;
}

/* ─── Sidebar de edição (esquerda, após nav) ─── */
.edit-sidebar {
  position: fixed;
  top: 0;
  /* Começa escondida à esquerda, atrás da nav */
  left: -270px;
  width: 260px;
  height: 100vh;
  background: #0d0d0d;
  border-right: 1px solid var(--border);
  z-index: 150;
  transition: left 0.3s cubic-bezier(.4,0,.2,1);
  display: flex;
  flex-direction: column;
  box-shadow: 8px 0 32px rgba(0,0,0,0.45);
  overflow: hidden;
}

/* Quando aberta: posiciona logo após a nav */
.edit-sidebar.open {
  left: var(--sidebar-w);
}

/* Empurra o conteúdo principal para dar espaço ao painel esquerdo */
.is-editing .main-content {
  margin-left: calc(var(--sidebar-w) + 260px);
}

.edit-sidebar-header {
  padding: 16px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.edit-sidebar-title {
  font-weight: 700;
  font-size: 13px;
  color: var(--white);
}

.edit-sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 6px 10px 20px;
}

.edit-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  padding: 14px 4px 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Item clicável na sidebar */
.sidebar-metric-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid transparent;
  margin-bottom: 2px;
  user-select: none;
}

.sidebar-metric-item:hover {
  background: rgba(255,255,255,0.05);
  border-color: var(--border);
  color: var(--white);
}

.sidebar-metric-item.active {
  background: rgba(225, 29, 43, 0.1);
  border-color: rgba(225, 29, 43, 0.35);
  color: var(--red);
}

.sidebar-add-icon {
  font-size: 18px;
  color: var(--text-dim);
  font-weight: 300;
  line-height: 1;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-metric-item:hover .sidebar-add-icon { color: var(--white); }
.sidebar-metric-item.active .sidebar-add-icon { color: var(--red); font-size: 22px; }

/* Badge em breve */
.soon-badge {
  font-size: 9px;
  font-weight: 700;
  background: rgba(255,255,255,0.07);
  color: var(--text-dim);
  padding: 2px 5px;
  border-radius: 3px;
  text-transform: uppercase;
}

/* Responsive */
@media (max-width: 768px) {
  .edit-sidebar { width: 100%; right: -100%; }
}
