@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=Poppins:wght@300;400;500;600;700;800&family=Inter:wght@300;400;500;600;700&family=Montserrat:wght@300;400;500;600;700;800&family=Playfair+Display:wght@400;500;600;700&family=Roboto:wght@300;400;500;700&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue:      #1b3d60;
  --blue-dk:   #0f2640;
  --blue-lt:   #eaf1f8;
  --blue-mid:  #2a5885;
  --slate:     #0c0c0f;
  --slate-dk:  #0c0c0f;
  --slate-md:  #52525e;
  --slate-lt:  #9898a8;
  --border:    rgba(0,0,0,.08);
  --border-strong: rgba(0,0,0,.13);
  --bg:        #f9f8f6;
  --white:     #FFFFFF;
  --green:     #166534;
  --green-bg:  #dcfce7;
  --red:       #b31c1c;
  --red-bg:    #fceaea;
  --amber:     #D97706;
  --amber-bg:  #FFFBEB;
  --radius:    14px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow:    0 4px 16px rgba(0,0,0,.07), 0 1px 4px rgba(0,0,0,.04);
  --shadow-lg: 0 16px 48px rgba(0,0,0,.09), 0 4px 12px rgba(0,0,0,.05);
  --font:      'Plus Jakarta Sans', sans-serif;
}

body {
  background: var(--bg);
  color: var(--slate);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}

input, textarea, select {
  width: 100%;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--slate);
  font-family: var(--font);
  font-size: 14px;
  padding: 11px 14px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--slate-lt); }
input:focus, textarea:focus, select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(27,61,96,.12);
}
textarea { resize: vertical; min-height: 80px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border: none; border-radius: var(--radius);
  font-family: var(--font); font-size: 14px; font-weight: 600;
  cursor: pointer; text-align: center; text-decoration: none;
  transition: all .15s;
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--blue); color: #fff; box-shadow: 0 2px 8px rgba(27,61,96,.25); }
.btn-primary:hover { background: var(--blue-dk); }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--slate-md); }
.btn-outline:hover { border-color: var(--blue); color: var(--blue); }
.btn-green { background: var(--green); color: #fff; }
.btn-green:hover { background: #15803D; }
.btn-red { background: var(--red); color: #fff; }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-xs { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; padding: 3px 10px; border-radius: 99px;
}
.badge-blue   { color: var(--blue);    background: var(--blue-lt);  }
.badge-green  { color: var(--green);   background: var(--green-bg); }
.badge-red    { color: var(--red);     background: var(--red-bg);   }
.badge-amber  { color: var(--amber);   background: var(--amber-bg); }
.badge-slate  { color: var(--slate-lt); background: #F1F5F9;        }

.label { display: block; font-size: 13px; font-weight: 600; color: var(--slate-md); margin-bottom: 6px; }

.card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
}
.card-body { padding: 24px; }

.nav {
  background: rgba(249,248,246,.92); border-bottom: 1px solid var(--border);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  padding: 0 48px; height: 64px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 100; box-shadow: var(--shadow-sm);
}
.nav-logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.nav-logo-icon {
  width: 34px; height: 34px; background: var(--blue); border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
}
.nav-logo-text { font-size: 15px; font-weight: 800; letter-spacing: -.02em; color: var(--slate); }
.nav-logo-text span { color: var(--blue); font-style: italic; }

.alert {
  padding: 12px 16px; border-radius: var(--radius); font-size: 14px;
  display: flex; align-items: center; gap: 10px; margin-bottom: 16px;
}
.alert-red   { background: var(--red-bg);   color: var(--red);   border: 1px solid #FECACA; }
.alert-green { background: var(--green-bg); color: var(--green); border: 1px solid #BBF7D0; }

/* ── EDITOR ─────────────────────────────────────────────────────────── */
.editor-layout {
  display: grid;
  grid-template-columns: 300px 1fr 300px;
  height: calc(100vh - 64px);
  overflow: hidden;
}
.editor-panel {
  overflow-y: auto;
  border-right: 1px solid var(--border);
  padding: 20px;
}
.editor-panel-right {
  overflow-y: auto;
  border-left: 1px solid var(--border);
  padding: 20px;
}
.editor-preview {
  overflow-y: auto;
  background: #e2e8f0;
  display: flex;
  justify-content: center;
  padding: 32px 16px;
}
.editor-topbar {
  background: var(--white); border-bottom: 1px solid var(--border);
  padding: 0 20px; height: 64px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
}

.widget-palette {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 20px;
}
.widget-item {
  background: var(--white); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 12px 8px;
  text-align: center; cursor: pointer; font-size: 12px; font-weight: 600;
  color: var(--slate-md); transition: all .15s;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.widget-item:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-lt); }
.widget-item-icon { font-size: 20px; }

.section-title-sm {
  font-size: 11px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--slate-lt); margin-bottom: 12px;
}

/* ── CARD PREVIEW ─────────────────────────────────────────────────── */
.card-preview {
  width: 390px;
  min-height: 700px;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,.15);
  position: relative;
}

.card-capa {
  width: 100%; height: 160px; object-fit: cover;
  background: linear-gradient(135deg, var(--blue), #60a5fa);
}

.card-perfil-area {
  padding: 0 20px 16px;
  margin-top: -40px;
  position: relative;
}
.card-avatar {
  width: 80px; height: 80px; border-radius: 50%;
  border: 4px solid white; object-fit: cover;
  background: var(--blue); display: flex;
  align-items: center; justify-content: center;
  font-size: 28px; font-weight: 800; color: white;
}
.card-nome { font-size: 20px; font-weight: 800; margin-top: 10px; }
.card-bio { font-size: 13px; opacity: .7; margin-top: 4px; line-height: 1.5; }

.card-widget {
  margin: 0 16px 12px; border-radius: 14px;
  overflow: hidden; position: relative;
}
.card-widget-header {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; opacity: .5; margin-bottom: 10px;
}

/* Widget drag handle (editor only) */
.widget-drag-handle {
  position: absolute; top: 8px; right: 8px;
  background: rgba(255,255,255,.7); border-radius: 6px;
  padding: 4px 6px; cursor: grab; opacity: 0;
  display: flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600; color: var(--slate-lt);
  z-index: 10; transition: opacity .15s;
}
.card-widget:hover .widget-drag-handle { opacity: 1; }
.widget-drag-handle:active { cursor: grabbing; }

.widget-actions {
  position: absolute; top: 8px; left: 8px;
  display: flex; gap: 4px; opacity: 0; transition: opacity .15s; z-index: 10;
}
.card-widget:hover .widget-actions { opacity: 1; }

/* Divisória styles */
.divisoria-linha { height: 1px; background: currentColor; }
.divisoria-pontilhado { height: 0; border-top: 2px dashed currentColor; }
.divisoria-onda {
  height: 20px; overflow: hidden;
  background: none;
}
.divisoria-gradiente { height: 3px; background: linear-gradient(90deg, transparent, currentColor, transparent); }

/* Social buttons */
.social-botoes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.social-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 12px; border-radius: var(--radius);
  font-size: 13px; font-weight: 600; text-decoration: none;
  transition: all .15s; color: white; text-align: center;
}
.social-btn:hover { transform: translateY(-1px); filter: brightness(1.1); }

/* Link buttons */
.link-botoes { display: flex; flex-direction: column; gap: 8px; }
.link-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: var(--radius);
  font-size: 14px; font-weight: 600; text-decoration: none;
  transition: all .15s; color: white;
}
.link-btn:hover { transform: translateX(2px); filter: brightness(1.1); }

/* Galeria */
.galeria-grid { display: grid; gap: 4px; }
.galeria-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.galeria-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.galeria-grid img {
  width: 100%; aspect-ratio: 1; object-fit: cover;
  border-radius: 8px; cursor: pointer;
}

/* Agenda */
.agenda-cal { font-size: 13px; }
.cal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; font-weight: 700; }
.cal-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 3px; text-align: center; }
.cal-grid .dia-nome { font-size: 10px; font-weight: 700; opacity: .5; padding: 4px 0; }
.cal-grid .dia {
  padding: 6px 0; border-radius: 8px; cursor: default; font-size: 12px; font-weight: 600;
}
.cal-grid .dia.disponivel { cursor: pointer; background: var(--green-bg); color: var(--green); }
.cal-grid .dia.disponivel:hover { background: var(--green); color: white; }
.cal-grid .dia.selecionado { background: var(--blue); color: white; }
.cal-grid .dia.passado { opacity: .3; }
.cal-grid .dia.vazio { }
.slots { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.slot-btn {
  padding: 6px 12px; border-radius: 8px; font-size: 12px; font-weight: 700;
  background: var(--blue-lt); color: var(--blue); cursor: pointer; border: none;
}
.slot-btn:hover { background: var(--blue); color: white; }
.slot-btn.selecionado { background: var(--blue); color: white; }

/* Comentários */
.comentario-item { padding: 12px 0; border-bottom: 1px solid var(--border); }
.comentario-item:last-child { border-bottom: none; }
.comentario-nome { font-size: 13px; font-weight: 700; }
.comentario-texto { font-size: 13px; margin-top: 4px; opacity: .8; }
.comentario-data { font-size: 11px; opacity: .4; margin-top: 4px; }

/* Avaliações */
.estrelas { color: #F59E0B; font-size: 16px; letter-spacing: 2px; }
.avaliacao-media { font-size: 36px; font-weight: 800; }
.avaliacao-item { padding: 12px 0; border-bottom: 1px solid var(--border); }
.avaliacao-item:last-child { border-bottom: none; }

/* Postagens */
.postagem-item { padding: 16px 0; border-bottom: 1px solid var(--border); }
.postagem-item:last-child { border-bottom: none; }
.postagem-texto { font-size: 14px; line-height: 1.6; }
.postagem-fotos { display: grid; grid-template-columns: repeat(3,1fr); gap: 4px; margin-top: 10px; }
.postagem-fotos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; }
.postagem-data { font-size: 11px; opacity: .4; margin-top: 8px; }

/* Horários */
.horario-linha {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px;
}
.horario-linha:last-child { border-bottom: none; }

/* Mapa */
.widget-mapa { height: 200px; border-radius: 12px; overflow: hidden; }

/* Vídeo */
.widget-video { aspect-ratio: 16/9; border-radius: 12px; overflow: hidden; }
.widget-video iframe { width: 100%; height: 100%; border: none; }

/* Contato */
.contato-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
  font-size: 14px; text-decoration: none; color: inherit;
}
.contato-item:last-child { border-bottom: none; }

/* Fundo SVG */
.card-fundo-svg {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none; overflow: hidden; z-index: 0;
}
.card-fundo-svg svg { width: 100%; height: 100%; }
.card-preview > *:not(.card-fundo-svg) { position: relative; z-index: 1; }

/* Seletor de temas SVG */
.svg-temas-grid {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px;
  margin-top: 4px; overflow: hidden;
}
.svg-tema-item {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  cursor: pointer; border-radius: 6px; padding: 4px 2px;
  border: 2px solid transparent; transition: border-color .15s; min-width: 0;
}
.svg-tema-item:hover { border-color: var(--primary); }
.svg-tema-item.ativo { border-color: var(--primary); background: rgba(37,99,235,.06); }
.svg-tema-item span { font-size: 9px; color: var(--text-secondary); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%; }
.svg-tema-preview {
  width: 100%; aspect-ratio: 5/7; border-radius: 5px; overflow: hidden;
  background: #f1f5f9; border: 1px solid var(--border);
}
.svg-preview-nenhum { background: repeating-linear-gradient(45deg,#f1f5f9 0,#f1f5f9 4px,#e2e8f0 4px,#e2e8f0 8px); }
.svg-preview-ondas { background: linear-gradient(180deg,#dbeafe 0%,#eff6ff 100%);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 56'%3E%3Cpath d='M0,14 C7,17 13,10 20,14 C27,17 33,10 40,14 L40,56 L0,56Z' fill='%233b82f6' opacity='.35'/%3E%3Cpath d='M0,24 C8,27 15,20 23,24 C30,27 35,21 40,24 L40,56 L0,56Z' fill='%233b82f6' opacity='.2'/%3E%3C/svg%3E");
  background-size: cover; }
.svg-preview-geometrico { background: #f8fafc;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 56'%3E%3Cpolygon points='20,4 36,18 30,36 10,36 4,18' fill='none' stroke='%233b82f6' stroke-width='1.2' opacity='.5'/%3E%3Ccircle cx='20' cy='36' r='12' fill='none' stroke='%233b82f6' stroke-width='.8' opacity='.3'/%3E%3C/svg%3E");
  background-size: cover; }
.svg-preview-circulos { background: #f0fdf4;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 56'%3E%3Ccircle cx='30' cy='12' r='14' fill='%233b82f6' opacity='.15'/%3E%3Ccircle cx='8' cy='34' r='10' fill='%233b82f6' opacity='.12'/%3E%3Ccircle cx='28' cy='48' r='8' fill='%233b82f6' opacity='.1'/%3E%3C/svg%3E");
  background-size: cover; }
.svg-preview-abstrato { background: #fdf4ff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 56'%3E%3Cpath d='M-4,0 Q10,16 20,8 T44,18 L44,0Z' fill='%233b82f6' opacity='.2'/%3E%3Cellipse cx='30' cy='48' rx='18' ry='12' fill='%233b82f6' opacity='.12'/%3E%3C/svg%3E");
  background-size: cover; }
.config-field-inline { display: flex; align-items: center; justify-content: space-between; }

/* ── SORTABLE ──────────────────────────────────────────────────────── */
.sortable-ghost { opacity: .4; }
.sortable-chosen { box-shadow: 0 8px 24px rgba(37,99,235,.2); }

/* ── RESPONSIVO ─────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .nav { padding: 0 20px; }
  .editor-layout { grid-template-columns: 1fr; }
  .editor-panel, .editor-panel-right { display: none; }
}
