/* =============================================
   SMARTFORMS — CSS Principal
   ============================================= */

/* --- Variáveis --- */
:root {
  --primary:        #6C5CE7;
  --primary-dark:   #5a4bd1;
  --primary-light:  #a29bfe;
  --primary-bg:     #f0eeff;
  --success:        #00b894;
  --warning:        #fdcb6e;
  --danger:         #e17055;
  --info:           #74b9ff;
  --bg:             #f8f7ff;
  --surface:        #ffffff;
  --surface2:       #f1f0f7;
  --border:         #e0dff5;
  --text:           #2d2d3a;
  --text-muted:     #6c6c80;
  --text-light:     #a0a0b8;
  --shadow:         0 2px 12px rgba(108,92,231,.10);
  --shadow-lg:      0 8px 32px rgba(108,92,231,.15);
  --radius:         12px;
  --radius-sm:      8px;
  --radius-lg:      18px;
  --sidebar-w:      240px;
  --topbar-h:       60px;
  --transition:     .2s ease;
}
[data-theme="dark"] {
  --bg:          #13121e;
  --surface:     #1e1d2e;
  --surface2:    #252438;
  --border:      #2e2c45;
  --text:        #e8e7f8;
  --text-muted:  #9090b0;
  --text-light:  #5a5a7a;
  --shadow:      0 2px 12px rgba(0,0,0,.4);
  --shadow-lg:   0 8px 32px rgba(0,0,0,.5);
  --primary-bg:  #1a1830;
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
}
a { color: var(--primary); text-decoration: none; }
button, input, textarea, select { font-family: inherit; }
ul { list-style: none; }
img { max-width: 100%; }

/* =============================================
   TELA DE LOGIN
   ============================================= */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 1rem;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}
.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 2rem;
  justify-content: center;
}
.login-logo .logo-icon {
  width: 44px; height: 44px;
  background: var(--primary);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; color: #fff;
}
.login-logo h1 { font-size: 1.5rem; font-weight: 700; color: var(--text); }
.login-logo h1 span { color: var(--primary); }
.login-subtitle { text-align: center; color: var(--text-muted); font-size: .9rem; margin-bottom: 1.75rem; }

/* =============================================
   LAYOUT PRINCIPAL
   ============================================= */
.app-layout { display: flex; min-height: 100vh; }

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform var(--transition), background var(--transition);
  overflow-y: auto;
}
.sidebar-logo {
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-logo .logo-icon {
  width: 36px; height: 36px;
  background: var(--primary);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 18px; flex-shrink: 0;
}
.sidebar-logo h2 { font-weight: 700; font-size: 1.1rem; color: var(--text); }
.sidebar-logo h2 span { color: var(--primary); }

.sidebar-nav { flex: 1; padding: 1rem .75rem; }
.nav-section {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-light);
  padding: .5rem .75rem;
  margin-top: .5rem;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: .65rem .75rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: .92rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  margin-bottom: 2px;
}
.nav-item i { width: 20px; text-align: center; font-size: 1rem; }
.nav-item:hover  { background: var(--primary-bg); color: var(--primary); }
.nav-item.active { background: var(--primary-bg); color: var(--primary); font-weight: 600; }
.nav-badge {
  margin-left: auto;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 20px;
  font-weight: 700;
}

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: .5rem 0;
  margin-bottom: .5rem;
}
.user-avatar {
  width: 32px; height: 32px;
  background: var(--primary-bg);
  color: var(--primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; flex-shrink: 0;
}
.user-name  { font-size: .88rem; font-weight: 600; }
.user-role  { font-size: 11px; color: var(--text-muted); }

/* --- Main content --- */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* --- Top bar --- */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  height: var(--topbar-h);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  position: sticky;
  top: 0; z-index: 50;
}
.topbar-title { font-weight: 700; font-size: 1.15rem; flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: .5rem; }
.menu-toggle {
  display: none;
  background: none; border: none;
  font-size: 1.3rem; color: var(--text);
  cursor: pointer; padding: 4px 8px;
}

/* --- Views --- */
.view { display: none; padding: 1.5rem; }
.view.active { display: block; }

/* =============================================
   BOTÕES
   ============================================= */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: .5rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 600;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-outline { background: transparent; border-color: var(--border); color: var(--text-muted); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-bg); }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { filter: brightness(.92); }
.btn-danger  { background: var(--danger);  color: #fff; border-color: var(--danger); }
.btn-danger:hover  { filter: brightness(.92); }
.btn-ghost   { background: none; border-color: transparent; color: var(--text-muted); padding: .4rem .6rem; }
.btn-ghost:hover { background: var(--surface2); color: var(--text); }
.btn-sm  { padding: .35rem .8rem;  font-size: .82rem; }
.btn-lg  { padding: .75rem 1.5rem; font-size: 1rem; }
.btn-icon { padding: .4rem .6rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn .spinner { width: 14px; height: 14px; border-width: 2px; }

/* =============================================
   FORMULÁRIOS
   ============================================= */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: .87rem; font-weight: 600; color: var(--text-muted); margin-bottom: .35rem; }
.form-control, .form-select-ctrl {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .5rem .75rem;
  font-size: .9rem;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color var(--transition);
}
.form-control:focus, .form-select-ctrl:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-bg); }
.form-control.error { border-color: var(--danger); }
textarea.form-control { resize: vertical; min-height: 80px; }
.field-error { color: var(--danger); font-size: 12px; margin-top: 4px; }
.form-hint   { color: var(--text-muted); font-size: 12px; margin-top: 4px; }

/* Toggle switch */
.toggle-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .88rem;
  color: var(--text-muted);
  cursor: pointer;
}
.toggle-wrap input[type="checkbox"] {
  width: 36px; height: 20px;
  appearance: none;
  background: var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: background var(--transition);
  position: relative;
  flex-shrink: 0;
}
.toggle-wrap input:checked { background: var(--primary); }
.toggle-wrap input::after {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff;
  top: 2px; left: 2px;
  transition: left var(--transition);
}
.toggle-wrap input:checked::after { left: 18px; }

/* =============================================
   CARDS E GRID
   ============================================= */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow);
}
.stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; flex-shrink: 0;
}
.stat-info p { font-size: 12px; color: var(--text-muted); font-weight: 500; margin-bottom: 3px; }
.stat-info h3 { font-size: 1.6rem; font-weight: 700; }

.forms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
}
.form-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--primary-light); }
.form-card-thumb {
  height: 88px;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.2rem; color: rgba(255,255,255,.85);
}
.form-card-body  { padding: 1rem; flex: 1; }
.form-card-title { font-weight: 700; font-size: 1rem; margin-bottom: .25rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.form-card-desc  { font-size: 13px; color: var(--text-muted); margin-bottom: .75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.form-card-meta  { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.form-card-footer {
  padding: .6rem 1rem;
  border-top: 1px solid var(--border);
  display: flex; gap: 2px;
  justify-content: flex-end;
}

/* Status badges */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px; font-weight: 600;
}
.badge-published { background: #d4f5e9; color: #00875a; }
.badge-draft     { background: #fff3d4; color: #b07d00; }
.badge-closed    { background: #fde8e8; color: #c53030; }
[data-theme="dark"] .badge-published { background: #0a3525; color: #4ade80; }
[data-theme="dark"] .badge-draft     { background: #3a2a00; color: #fbbf24; }
[data-theme="dark"] .badge-closed    { background: #3a0a0a; color: #f87171; }

/* =============================================
   BUSCA E FILTROS
   ============================================= */
.search-bar { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.search-wrap { position: relative; flex: 1; min-width: 180px; }
.search-wrap i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: .9rem; }
.search-input {
  width: 100%;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .5rem .75rem .5rem 2.1rem;
  font-size: .9rem;
  color: var(--text);
  outline: none;
  transition: border-color var(--transition);
}
.search-input:focus { border-color: var(--primary); }
.filter-sel {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .5rem .75rem;
  font-size: .9rem; color: var(--text);
  outline: none; cursor: pointer;
}

/* =============================================
   SECTION HEADER
   ============================================= */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.25rem; flex-wrap: wrap; gap: .75rem;
}
.section-title { font-size: 1.05rem; font-weight: 700; }

/* =============================================
   BUILDER
   ============================================= */
.builder-layout {
  display: grid;
  grid-template-columns: 220px 1fr 270px;
  gap: 1rem;
  height: calc(100vh - var(--topbar-h) - 3rem);
}
.builder-panel-left,
.builder-panel-right {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-y: auto;
}
.builder-canvas {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-y: auto;
  padding: 1.5rem;
}
.panel-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  padding: 1rem 1rem .5rem;
  border-bottom: 1px solid var(--border);
}
.field-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: .5rem .75rem;
  margin: 2px .5rem;
  border-radius: var(--radius-sm);
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: .85rem;
  cursor: pointer;
  width: calc(100% - 1rem);
  text-align: left;
  transition: all var(--transition);
}
.field-btn i { width: 16px; color: var(--primary); text-align: center; }
.field-btn:hover { background: var(--primary-bg); color: var(--primary); }

/* Canvas — título/desc */
.canvas-title-input, .canvas-desc-input {
  width: 100%;
  border: none;
  border-bottom: 2px solid var(--primary-light);
  background: transparent;
  color: var(--text);
  outline: none;
  padding: .4rem 0;
  font-family: inherit;
  transition: border-color var(--transition);
  display: block;
}
.canvas-title-input { font-size: 1.5rem; font-weight: 700; margin-bottom: .5rem; }
.canvas-title-input:focus, .canvas-desc-input:focus { border-color: var(--primary); }
.canvas-desc-input { font-size: .95rem; }

/* Questão */
.q-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  transition: all var(--transition);
  position: relative;
}
.q-card.selected { border-color: var(--primary); }
.q-card.drag-over { border-color: var(--primary); background: var(--primary-bg); }
.q-card.dragging  { opacity: .4; border-style: dashed; }
.q-card:hover .q-actions { opacity: 1; }
.drag-handle {
  position: absolute;
  left: 6px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  cursor: grab;
  padding: 4px;
}
.q-header { display: flex; align-items: flex-start; gap: 8px; margin-bottom: .6rem; }
.q-num {
  width: 24px; height: 24px;
  background: var(--primary-bg);
  color: var(--primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  flex-shrink: 0; margin-top: 3px;
}
.q-title-ta {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 1rem; font-weight: 600;
  color: var(--text);
  outline: none;
  resize: none;
  min-height: 28px;
  line-height: 1.5;
  font-family: inherit;
}
.q-required-star { color: var(--danger); font-size: 1rem; }
.q-actions { display: flex; gap: 2px; opacity: 0; transition: opacity var(--transition); }
.q-actions button {
  background: none; border: none;
  color: var(--text-muted);
  padding: 4px 6px; border-radius: 6px;
  font-size: 13px; cursor: pointer;
  transition: all var(--transition);
}
.q-actions button:hover { background: var(--surface2); color: var(--primary); }
.q-desc-ta {
  width: 100%;
  border: none;
  background: transparent;
  font-size: .82rem;
  color: var(--text-muted);
  outline: none;
  font-family: inherit;
  font-style: italic;
  margin-bottom: .6rem;
}
.q-body { padding-left: 32px; }
.q-footer {
  display: flex; align-items: center; gap: 1rem;
  padding-left: 32px;
  padding-top: .75rem;
  margin-top: .75rem;
  border-top: 1px solid var(--border);
}

/* Opções no builder */
.opt-list { display: flex; flex-direction: column; gap: 6px; }
.opt-row  { display: flex; align-items: center; gap: 8px; }
.opt-row input[type="text"] {
  flex: 1;
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  font-size: .9rem; color: var(--text);
  outline: none; padding: 4px 0;
}
.opt-row .rm-opt { background: none; border: none; color: var(--text-light); cursor: pointer; padding: 2px 5px; border-radius: 4px; font-size: 13px; }
.opt-row .rm-opt:hover { color: var(--danger); }
.add-opt-btn { background: none; border: none; color: var(--primary); font-size: .85rem; cursor: pointer; padding: 4px 0; font-weight: 500; font-family: inherit; }
.add-opt-btn:hover { text-decoration: underline; }

.scale-preview { display: flex; gap: 8px; flex-wrap: wrap; }
.scale-preview-btn {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: .9rem; font-weight: 600;
  color: var(--text-muted);
}
.scale-labels-row { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.empty-canvas {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 300px; gap: 1rem; color: var(--text-muted);
}
.empty-canvas i { font-size: 3rem; color: var(--primary-light); }

/* =============================================
   GRID PARA TABELA
   ============================================= */
.grid-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.grid-table th, .grid-table td { border: 1px solid var(--border); padding: 8px; text-align: center; }
.grid-table th { background: var(--surface2); font-weight: 600; }

/* =============================================
   RESPOSTAS / GRÁFICOS
   ============================================= */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}
.chart-card h4 { font-size: .88rem; font-weight: 600; color: var(--text-muted); margin-bottom: 1rem; }

/* Tabela de respostas */
.tbl-wrap { overflow-x: auto; }
table.resp-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
table.resp-table thead th {
  background: var(--surface2);
  padding: .7rem 1rem;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  white-space: nowrap;
}
table.resp-table tbody td { padding: .7rem 1rem; border-bottom: 1px solid var(--border); }
table.resp-table tbody tr:hover { background: var(--primary-bg); }

/* =============================================
   FORMULÁRIO PÚBLICO
   ============================================= */
.public-screen {
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1rem;
}
.public-wrap { width: 100%; max-width: 640px; }
.public-header {
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 2rem;
  color: #fff;
}
.public-header h1 { font-size: 1.4rem; font-weight: 700; margin-bottom: .25rem; }
.public-header p   { opacity: .85; font-size: .92rem; }
.progress-track { background: rgba(255,255,255,.3); height: 4px; border-radius: 2px; margin-top: 1rem; overflow: hidden; }
.progress-fill  { height: 100%; background: #fff; border-radius: 2px; transition: width .4s ease; }
.public-body {
  background: var(--surface);
  padding: 1.5rem 2rem;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
}
.pub-q { margin-bottom: 1.5rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--border); }
.pub-q:last-child { border-bottom: none; }
.pub-q-label { font-weight: 600; font-size: 1rem; margin-bottom: .25rem; }
.pub-q-desc  { font-size: .85rem; color: var(--text-muted); margin-bottom: .6rem; }
.pub-q-required { color: var(--danger); }

/* Inputs públicos */
.pub-input, .pub-textarea, .pub-select {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .6rem .9rem;
  font-size: .95rem;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color var(--transition);
  font-family: inherit;
}
.pub-input:focus, .pub-textarea:focus, .pub-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-bg); }
.pub-textarea { resize: vertical; min-height: 100px; }
.pub-input.error, .pub-textarea.error, .pub-select.error { border-color: var(--danger); }

.radio-opt, .check-opt {
  display: flex; align-items: center; gap: 10px;
  padding: .5rem .75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
  margin-bottom: 4px;
}
.radio-opt:hover, .check-opt:hover { background: var(--primary-bg); }
.radio-opt input, .check-opt input { accent-color: var(--primary); width: 16px; height: 16px; }

.scale-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.scale-btn {
  width: 44px; height: 44px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: .9rem; font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}
.scale-btn:hover, .scale-btn.sel { border-color: var(--primary); background: var(--primary); color: #fff; }
.scale-labels { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.submit-section { text-align: center; margin-top: 1.5rem; }

.thankyou {
  text-align: center;
  padding: 3rem 1rem;
  display: none;
}
.thankyou i  { font-size: 3rem; color: var(--success); margin-bottom: 1rem; display: block; }
.thankyou h2 { font-size: 1.4rem; font-weight: 700; margin-bottom: .5rem; }
.thankyou p  { color: var(--text-muted); }

/* =============================================
   MODAIS
   ============================================= */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
  animation: slideIn .2s ease;
}
@keyframes slideIn { from { transform: translateY(-20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.modal-head h3 { font-size: 1.1rem; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 1.2rem; color: var(--text-muted); cursor: pointer; padding: 4px; border-radius: 6px; line-height: 1; }
.modal-close:hover { background: var(--surface2); }
.modal-foot { display: flex; gap: .5rem; justify-content: flex-end; margin-top: 1.25rem; }

/* Compartilhar */
.share-input-wrap { display: flex; gap: 8px; align-items: center; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .5rem; margin-bottom: 1rem; }
.share-input-wrap input { flex: 1; border: none; background: transparent; color: var(--text); font-size: .88rem; outline: none; }

/* =============================================
   TOAST
   ============================================= */
.toast-wrap {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 1000;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .75rem 1.25rem;
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 10px;
  font-size: .9rem; font-weight: 500;
  min-width: 240px;
  animation: toastIn .25s ease;
  border-left: 4px solid var(--primary);
}
.toast.success { border-left-color: var(--success); }
.toast.error   { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
@keyframes toastIn { from { transform: translateX(60px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* =============================================
   LOADING
   ============================================= */
.spinner {
  display: inline-block;
  width: 20px; height: 20px;
  border: 2px solid rgba(108,92,231,.3);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1rem;
  color: #fff;
  font-weight: 600;
}
.loading-overlay.show { display: flex; }

/* =============================================
   EMPTY STATE
   ============================================= */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.empty-state i { font-size: 3rem; color: var(--primary-light); margin-bottom: 1rem; display: block; }
.empty-state h3 { font-size: 1.1rem; margin-bottom: .5rem; }

/* =============================================
   TEMPLATES
   ============================================= */
.tmpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px,1fr)); gap: 1rem; }
.tmpl-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
}
.tmpl-card:hover { border-color: var(--primary); background: var(--primary-bg); transform: translateY(-2px); }
.tmpl-card i  { font-size: 2rem; color: var(--primary); margin-bottom: .75rem; display: block; }
.tmpl-card h4 { font-size: .95rem; font-weight: 600; margin-bottom: .25rem; }
.tmpl-card p  { font-size: 12px; color: var(--text-muted); }

/* =============================================
   SETTINGS
   ============================================= */
.settings-section { margin-bottom: 2rem; }
.settings-section h3 { font-size: 1rem; font-weight: 700; margin-bottom: 1rem; padding-bottom: .5rem; border-bottom: 1px solid var(--border); }

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .builder-layout { grid-template-columns: 1fr; height: auto; }
  .builder-panel-left, .builder-panel-right { max-height: 280px; }
  .menu-toggle { display: block; }
}
@media (max-width: 600px) {
  .view { padding: 1rem; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .public-body { padding: 1rem; }
}
@media (max-width: 400px) {
  .stats-grid { grid-template-columns: 1fr; }
}

/* --- Sidebar overlay mobile --- */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 99;
}
.sidebar-overlay.open { display: block; }

/* --- Theme toggle --- */
.theme-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 13px;
  font-size: 13px;
  color: var(--text-muted);
  display: flex; align-items: center; gap: 6px;
  cursor: pointer;
  transition: all var(--transition);
}
.theme-btn:hover { border-color: var(--primary); color: var(--primary); }
