/* =========================
   BASE (escopo #app)
========================= */
#app * {
  margin: 0;
  padding: 0;
  box-sizing: border-box;

}

#app {
  /* Tokens */
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --secondary: #64748b;
  --background: #f0f4f8;
  --foreground: #0f172a;
  --card-bg: #fff;              /* corrigido */
  --border: #e2e8f0;
  --muted: #f1f5f9;
  --radius: 0.75rem;

  /* Tipografia/Layout */
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: transparent;
  color: var(--foreground);
  line-height: 1.4;             /* + legível */
  height: auto;
  overflow: hidden;              /* só dentro do app */
}

/* Container principal do embed */
#app .container {
  display: flex;
  flex-direction: column;
  padding: 16px;                 /* ↑ mais confortável */
  gap: 16px;
  height: var(--embed-height);
  overflow: hidden;
}

/* =========================
   HEADER
========================= */
#app .header { display: none; }

#app .header h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--foreground);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

#app .header .icon {
  width: 40px;
  height: 40px;
  color: var(--primary);
}

#app .header p {
  color: var(--secondary);
  font-size: 1rem;
}

/* =========================
   STEPS / CARDS
========================= */
#app .step {
  display: none;
  height: 100%;
  overflow: auto;
}

#app .step.active {
  display: flex;
  flex-direction: column;
  gap: 16px;                     /* ↑ espaçamento interno entre cards */
}

#app .card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.08);
  margin: 0;                     /* margin controlado pelo .step */
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
  border: 1px solid var(--border);
}

#app #step-upload .card,
#app #step-config .card,
#app #step-map .card {
  flex: 1;
  min-height: 0;
}

#app .card-header {
  padding: 16px;                 /* ↑ */
  border-bottom: 1px solid var(--border);
}

#app .card-header h2 {
  font-size: 1.25rem;            /* ↑ título */
  font-weight: 600;
  margin-bottom: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Esconde descrição sob o título, se você quiser reativar, remova esta regra */
#app .card-description {
  display: none !important;
}

#app .card-content {
  padding: 16px;                 /* ↑ */
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;                     /* ↑ */
}

#app #step-map .card-content {
  padding: 0;
  overflow: hidden;
}

/* =========================
   UPLOAD
========================= */
#app .dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 28px 18px;            /* ↑ */
  text-align: center;
  transition: all 0.3s;
  background: #fff;
}

#app .dropzone.dragover {
  border-color: var(--primary);
  background: var(--muted);
}

#app .upload-icon {
  width: 56px;                   /* ↑ */
  height: 56px;
  color: #cbd5e1;
  margin: 0 auto 12px;
}

#app .upload-text {
  font-size: 1.05rem;            /* ↑ */
  color: var(--foreground);
  margin-bottom: 8px;
}

#app .upload-or {
  color: var(--secondary);
  font-size: 0.95rem;            /* ↑ */
  margin-bottom: 12px;
}

/* =========================
   BOTÕES
========================= */
#app .btn {
  padding: 10px 16px;            /* ↑ */
  border: none;
  border-radius: var(--radius);
  font-size: 14px;               /* ↑ */
  font-weight: 600;              /* um pouco mais forte */
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;                      /* ↑ */
  line-height: 1.2;
  min-height: 40px;              /* altura mínima */
}

#app .btn-primary {
  background-color: var(--primary);
  color: #fff;
}

#app .btn-primary:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
}

#app .btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

#app .btn-outline {
  background-color: #fff;
  color: var(--foreground);
  border: 1px solid var(--border);
}

#app .btn-outline:hover {
  background-color: var(--muted);
}

/* =========================
   GRIDS / FORM
========================= */
#app .flex-1 { flex: 1; min-height: 0; }

#app .grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;                     /* ↑ */
  flex: 1;
  overflow: hidden;
}

#app .grid-2 > .card {
  margin-bottom: 0;
  min-height: 0;
}

#app .grid-2-small {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;                     /* ↑ */
}

#app .grid-5 {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;                     /* ↑ */
  margin-bottom: 12px;           /* ↑ */
}

#app .form-group {
  margin-bottom: 10px;           /* ↑ */
}

#app .grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;                     /* ↑ */
  margin-bottom: 10px;           /* ↑ */
}

#app .form-group label {
  display: block;
  font-weight: 600;              /* ↑ */
  margin-bottom: 6px;            /* ↑ */
  font-size: 0.95rem;            /* ↑ */
  line-height: 1.25;
  color: #0b1220;
}

#app .input,
#app .select {
  width: 100%;
  padding: 10px 12px;            /* ↑ */
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  font-size: 14px;               /* ↑ */
  transition: all 0.2s;
  background: #fff;
}

#app .input:focus,
#app .select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

#app .button-group {
  display: flex;
  gap: 12px;                     /* ↑ */
  margin-top: 10px;              /* ↑ */
  flex-wrap: wrap;
}

/* =========================
   PREVIEW
========================= */
#app .preview {
  background: #0f172a;
  color: #e2e8f0;
  padding: 12px;                 /* ↑ */
  border-radius: calc(var(--radius) - 2px);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, "Courier New", monospace;
  font-size: 13px;               /* ↑ */
  overflow-x: auto;
  max-height: 160px;             /* ↑ */
  overflow-y: auto;
  border: 1px solid #0b1220;
}

#app .preview-line {
  margin-bottom: 4px;            /* ↑ */
  white-space: pre;
}

#app .preview-line-number {
  color: #94a3b8;
  margin-right: 12px;            /* ↑ */
  user-select: none;
}

/* =========================
   MAPA
========================= */
#app .map {
  width: 100%;
  height: 100%;
  border-radius: 0;
}

#app .header-with-actions {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;                     /* ↑ */
}

/* =========================
   MARCADORES
========================= */
#app .custom-marker {
  background-color: #2563eb;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

#app .marker-label {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background-color: #fff;
  padding: 4px 6px;              /* ↑ */
  border-radius: 6px;            /* ↑ */
  font-size: 12px;               /* ↑ */
  font-weight: 700;              /* ↑ */
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  margin-bottom: 4px;            /* ↑ */
  pointer-events: none;
}

/* =========================
   MEDIA QUERIES
========================= */
@media (max-width: 1024px) {
  #app .grid-2 { grid-template-columns: 1fr; }
  #app .grid-3 { grid-template-columns: 1fr; }
  #app .grid-5 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  #app .header h1 { font-size: 1.6rem; }
  #app .grid-5 { grid-template-columns: 1fr; }

  #app .header-with-actions {
    flex-direction: column;
    gap: 10px;
  }

  #app .button-group {
    width: 100%;
    flex-direction: column;
  }

  #app .map {
    height: 300px; /* só telas pequenas; embed segue var(--embed-height) */
  }
}

/* =========================
   AJUSTES FINAIS (escopados)
========================= */
#app,
#app .container {
  background: transparent !important;
  height: var(--embed-height);
  overflow: hidden;
}

#app .card:last-child { margin-bottom: 0 !important; }

#app .container::after,
#app::after {
  display: none !important;
  content: none !important;
}

/* Espaçamento fino específico da Etapa 2 */
#app #step-config .card-content {
  gap: 10px !important;          /* um pouco maior que antes */
  padding-bottom: 0 !important;
}
