/* =============================================
   SMARTFORMS — Branding Panel CSS
   ============================================= */

/* ---- Painel de Branding (lado direito do builder) ---- */
#branding-panel {
  padding: .5rem;
}

.bp-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: .75rem;
}

.bp-section-title {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--primary);
  margin-bottom: .85rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.bp-field {
  margin-bottom: .85rem;
}
.bp-field:last-child { margin-bottom: 0; }

.bp-field > label {
  display: block;
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: .35rem;
}

.bp-input {
  width: 100%;
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .45rem .7rem;
  font-size: .88rem;
  color: var(--text);
  outline: none;
  font-family: inherit;
  transition: border-color .2s;
}
.bp-input:focus { border-color: var(--primary); }

/* Upload de imagem */
.bp-logo-upload {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: .75rem;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  background: var(--surface2);
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.bp-logo-upload:hover { border-color: var(--primary); background: var(--primary-bg); }

.bp-upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.bp-upload-placeholder i    { font-size: 1.4rem; color: var(--primary-light); }
.bp-upload-placeholder span { font-size: .82rem; font-weight: 600; color: var(--text-muted); }
.bp-upload-placeholder small { font-size: .72rem; color: var(--text-light); }

.bp-btn-link {
  background: none;
  border: none;
  color: var(--danger);
  font-size: .78rem;
  cursor: pointer;
  padding: 4px 0;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: .35rem;
}
.bp-btn-link:hover { text-decoration: underline; }

/* Radio group */
.bp-radio-group {
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
}
.bp-radio {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: .35rem .7rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all .2s;
  background: var(--surface2);
  user-select: none;
}
.bp-radio input[type="radio"] { display: none; }
.bp-radio:hover { border-color: var(--primary-light); color: var(--primary); }
.bp-radio.active { border-color: var(--primary); background: var(--primary-bg); color: var(--primary); }

/* Tab group */
.bp-tab-group {
  display: flex;
  gap: 3px;
  background: var(--surface2);
  border-radius: var(--radius-sm);
  padding: 3px;
}
.bp-tab {
  flex: 1;
  padding: .35rem .4rem;
  border: none;
  border-radius: 6px;
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  cursor: pointer;
  transition: all .2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  white-space: nowrap;
}
.bp-tab:hover { color: var(--primary); }
.bp-tab.active { background: var(--surface); color: var(--primary); box-shadow: 0 1px 4px rgba(0,0,0,.1); }

/* Grid de cores */
.bp-colors-grid {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.bp-color-item {
  display: flex;
  align-items: center;
  gap: .75rem;
}
.bp-color-preview {
  width: 36px; height: 36px;
  border-radius: 8px;
  border: 2px solid rgba(0,0,0,.08);
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  transition: transform .2s, box-shadow .2s;
}
.bp-color-preview:hover { transform: scale(1.1); box-shadow: 0 4px 12px rgba(0,0,0,.2); }
.bp-color-label { font-size: .82rem; font-weight: 600; color: var(--text); }
.bp-color-hint  { font-size: .72rem; color: var(--text-muted); }

/* Paletas prontas */
.bp-palette-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.bp-palette-chip {
  width: 28px; height: 28px;
  border-radius: 6px;
  cursor: pointer;
  transition: transform .2s, box-shadow .2s;
  border: 2px solid transparent;
}
.bp-palette-chip:hover { transform: scale(1.2); box-shadow: 0 4px 12px rgba(0,0,0,.2); }

/* Grid de padrões */
.bp-pattern-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .5rem;
}
.bp-pattern-chip {
  border-radius: 8px;
  min-height: 44px;
  display: flex;
  align-items: flex-end;
  padding: 4px 6px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all .2s;
  position: relative;
  overflow: hidden;
}
.bp-pattern-chip span {
  font-size: .68rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,.4);
  position: relative;
  z-index: 1;
}
.bp-pattern-chip:hover { border-color: rgba(255,255,255,.5); transform: scale(1.03); }
.bp-pattern-chip.active { border-color: #fff; box-shadow: 0 0 0 2px var(--primary); }

/* Toggle switch */
.bp-toggle-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
}
.bp-toggle { position: relative; display: inline-block; width: 38px; height: 20px; flex-shrink: 0; }
.bp-toggle input { opacity: 0; width: 0; height: 0; }
.bp-toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 10px;
  transition: .3s;
  cursor: pointer;
}
.bp-toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff;
  top: 2px; left: 2px;
  transition: .3s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.bp-toggle input:checked + .bp-toggle-slider { background: var(--primary); }
.bp-toggle input:checked + .bp-toggle-slider::before { left: 20px; }

/* Botão reset */
.bp-btn-reset {
  width: 100%;
  padding: .5rem;
  background: none;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all .2s;
}
.bp-btn-reset:hover { border-color: var(--danger); color: var(--danger); }

/* =============================================
   PREVIEW DO FORMULÁRIO COM BRANDING
   ============================================= */

/* Wrapper da preview no builder */
.builder-preview-wrap {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.builder-preview-bar {
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  padding: .5rem 1rem;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-muted);
}
.builder-preview-bar i { color: var(--primary); }
.builder-preview-scroll {
  overflow-y: auto;
  flex: 1;
  padding: 1.5rem 1rem;
}

/* Formulário público com branding dinâmico */
.sf-public-form {
  max-width: var(--sf-width, 680px);
  margin: 0 auto;
  font-family: var(--sf-font, 'Segoe UI', sans-serif);
  font-size: var(--sf-font-size, 15px);
}

.sf-form-header {
  background: var(--sf-header-bg, linear-gradient(135deg,#6C5CE7,#a29bfe));
  border-radius: var(--sf-radius, 12px) var(--sf-radius, 12px) 0 0;
  padding: 2rem 2rem 1.75rem;
  position: relative;
  overflow: hidden;
}

.sf-form-logo-wrap {
  margin-bottom: 1rem;
}
.sf-form-logo-wrap img {
  max-height: 56px;
  max-width: 220px;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,.2));
}

.sf-form-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--sf-text, #fff);
  text-align: var(--sf-title-align, left);
  margin-bottom: .4rem;
  line-height: 1.2;
}
.sf-form-desc {
  font-size: .95rem;
  color: var(--sf-text, #fff);
  opacity: .8;
  text-align: var(--sf-title-align, left);
  line-height: 1.6;
}
.sf-progress-wrap {
  margin-top: 1.25rem;
  background: rgba(255,255,255,.25);
  border-radius: 4px;
  height: 4px;
  overflow: hidden;
}
.sf-progress-bar {
  height: 100%;
  background: #fff;
  border-radius: 4px;
  transition: width .4s ease;
}

.sf-form-body {
  background: var(--sf-card-bg, #fff);
  border-radius: 0 0 var(--sf-radius, 12px) var(--sf-radius, 12px);
  padding: 1.75rem 2rem;
  border: 1px solid rgba(0,0,0,.06);
  border-top: none;
}

.sf-question {
  background: var(--sf-q-bg, #fff);
  border-radius: calc(var(--sf-radius, 12px) * .7);
  padding: 1.1rem 1.25rem;
  margin-bottom: var(--sf-spacing, 1.25rem);
  border: 1px solid rgba(0,0,0,.06);
  transition: box-shadow .2s;
}
.sf-question:last-child { margin-bottom: 0; }
.sf-question:hover { box-shadow: 0 2px 12px rgba(0,0,0,.06); }

.sf-q-label {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text, #2d2d3a);
  margin-bottom: .3rem;
  line-height: 1.4;
}
.sf-q-required { color: #e17055; margin-left: 3px; }
.sf-q-desc {
  font-size: .85rem;
  color: var(--text-muted, #6c6c80);
  margin-bottom: .75rem;
  line-height: 1.5;
}

/* Inputs públicos com branding */
.sf-input, .sf-textarea, .sf-select {
  width: 100%;
  border: 1.5px solid rgba(0,0,0,.1);
  border-radius: calc(var(--sf-radius, 12px) * .6);
  padding: .6rem .9rem;
  font-size: .95rem;
  font-family: var(--sf-font, inherit);
  color: var(--text, #2d2d3a);
  background: #fff;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.sf-input:focus, .sf-textarea:focus, .sf-select:focus {
  border-color: var(--sf-primary, #6C5CE7);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--sf-primary, #6C5CE7) 15%, transparent);
}
.sf-input.error, .sf-textarea.error { border-color: #e17055; }
.sf-textarea { resize: vertical; min-height: 100px; }

/* Radio / Checkbox com cor da marca */
.sf-radio-opt, .sf-check-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: .5rem .75rem;
  border-radius: calc(var(--sf-radius, 12px) * .5);
  cursor: pointer;
  transition: background .15s;
  margin-bottom: 4px;
  border: 1.5px solid transparent;
}
.sf-radio-opt:hover, .sf-check-opt:hover {
  background: color-mix(in srgb, var(--sf-primary, #6C5CE7) 8%, transparent);
  border-color: color-mix(in srgb, var(--sf-primary, #6C5CE7) 20%, transparent);
}
.sf-radio-opt input, .sf-check-opt input { accent-color: var(--sf-primary, #6C5CE7); width:16px; height:16px; }

/* Escala com cor da marca */
.sf-scale-wrap { display: flex; flex-direction: column; gap: 8px; }
.sf-scale-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.sf-scale-btn {
  width: 44px; height: 44px;
  border-radius: calc(var(--sf-radius, 12px) * .5);
  border: 1.5px solid rgba(0,0,0,.1);
  background: #fff;
  font-size: .9rem;
  font-weight: 700;
  color: var(--text-muted, #6c6c80);
  cursor: pointer;
  transition: all .15s;
  font-family: var(--sf-font, inherit);
}
.sf-scale-btn:hover, .sf-scale-btn.sel {
  background: var(--sf-primary, #6C5CE7);
  border-color: var(--sf-primary, #6C5CE7);
  color: #fff;
  transform: scale(1.08);
}
.sf-scale-labels {
  display: flex;
  justify-content: space-between;
  font-size: .78rem;
  color: var(--text-muted, #6c6c80);
}

/* Botão de envio com cor da marca */
.sf-submit-btn {
  background: var(--sf-primary, #6C5CE7);
  color: var(--sf-btn-text, #fff);
  border: none;
  border-radius: var(--sf-radius, 12px);
  padding: .9rem 2.5rem;
  font-size: 1rem;
  font-weight: 700;
  font-family: var(--sf-font, inherit);
  cursor: pointer;
  transition: all .2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,.15);
}
.sf-submit-btn:hover {
  filter: brightness(.92);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
}
.sf-submit-btn:disabled { opacity: .6; cursor: not-allowed; transform: none !important; }

/* Rodapé do formulário */
.sf-form-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1rem;
  font-size: .78rem;
  color: var(--text-muted, #6c6c80);
  border-top: 1px solid rgba(0,0,0,.06);
  margin-top: 1.25rem;
  flex-wrap: wrap;
}

/* Tela de agradecimento com branding */
.sf-thankyou {
  text-align: center;
  padding: 3rem 1rem;
}
.sf-thankyou .check-circle {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: var(--sf-primary, #6C5CE7);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem;
  margin: 0 auto 1.25rem;
  box-shadow: 0 8px 24px rgba(0,0,0,.15);
}
.sf-thankyou h2 { font-size: 1.5rem; font-weight: 800; margin-bottom: .5rem; }
.sf-thankyou p  { color: var(--text-muted, #6c6c80); }

/* Responsivo */
@media (max-width: 600px) {
  .sf-form-body  { padding: 1rem; }
  .sf-form-header { padding: 1.5rem; }
  .sf-submit-btn { width: 100%; justify-content: center; }
}
