/* ═══════════════════════════════════════════════════════
   ImobiLeads — Landing Page Builder — Premium UI v2
   ═══════════════════════════════════════════════════════ */

/* ── Builder Header */
.builder-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #64748b;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  transition: all .15s;
  white-space: nowrap;
}
.back-btn:hover { color: #0f172a; background: #f8fafc; border-color: #c4b5fd }
.title-input {
  font-size: 17px;
  font-weight: 700;
  border: none;
  outline: none;
  width: 320px;
  color: #0f172a;
  background: transparent;
  padding: 2px 0;
  border-bottom: 2px solid transparent;
  transition: border-color .2s;
}
.title-input:focus { border-bottom-color: #7c3aed }
.title-input::placeholder { color: #94a3b8; font-weight: 400 }
#savedIndicator { font-size: 11px; color: #94a3b8; font-weight: 500; margin-top: 2px }
.status-select {
  padding: 7px 32px 7px 12px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background: #f8fafc url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%2394a3b8' d='M5 7L0.5 2.5h9z'/%3E%3C/svg%3E") no-repeat right 10px center;
  color: #475569;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color .15s;
}
.status-select:focus { outline: none; border-color: #7c3aed }
.status-select:hover { border-color: #c4b5fd }

/* ── Tab Navigation */
.builder-tabs {
  position: sticky;
  top: 64px;
  z-index: 40;
  display: flex;
  overflow-x: auto;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  padding: 0 24px;
  scrollbar-width: none;
  box-shadow: 0 1px 0 #e2e8f0;
}
.builder-tabs::-webkit-scrollbar { display: none }
.tab-btn {
  flex-shrink: 0;
  padding: 0 16px;
  height: 48px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: #64748b;
  transition: all .15s;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tab-btn:hover { color: #334155; background: #f8fafc }
.tab-btn.active { color: #7c3aed; border-bottom-color: #7c3aed; font-weight: 600 }
.tab-icon { font-size: 15px; line-height: 1 }

/* ── Two-column layout */
.builder-content { display: flex; align-items: flex-start }

/* ── Editor */
.builder-editor { flex: 1; min-width: 0; padding: 28px 32px 60px }
.tab-panel { display: none }
.tab-panel.active { display: block }

/* ── Right Sidebar */
.builder-panel-sidebar {
  width: 272px;
  flex-shrink: 0;
  position: sticky;
  top: 112px;
  height: calc(100vh - 112px);
  overflow-y: auto;
  border-left: 1px solid #e2e8f0;
  background: #f8fafc;
  padding: 20px 16px;
  scrollbar-width: thin;
  scrollbar-color: #e2e8f0 transparent;
}
.builder-panel-sidebar::-webkit-scrollbar { width: 4px }
.builder-panel-sidebar::-webkit-scrollbar-track { background: transparent }
.builder-panel-sidebar::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 2px }

.sidebar-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.sidebar-card-header {
  padding: 10px 14px;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  gap: 7px;
  background: #fafafa;
}
.sidebar-card-icon { font-size: 13px }
.sidebar-card-title {
  font-size: 10px;
  font-weight: 800;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.sidebar-card-body { padding: 14px }

.sidebar-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 0;
}
.sidebar-info-row + .sidebar-info-row { border-top: 1px solid #f1f5f9 }
.sidebar-info-label { font-size: 11px; font-weight: 600; color: #94a3b8; text-transform: uppercase; letter-spacing: .04em }
.sidebar-info-value { font-size: 12px; font-weight: 600; color: #0f172a; text-align: right; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }

.sidebar-tpl-preview { border-radius: 8px; overflow: hidden; margin-bottom: 10px; border: 1px solid #e2e8f0; height: 72px }
.sidebar-tpl-hero { height: 40px }
.sidebar-tpl-body-inner { padding: 6px 9px; display: flex; flex-direction: column; gap: 4px; background: #fff }
.sidebar-tpl-bar { height: 5px; background: #e2e8f0; border-radius: 3px }
.sidebar-tpl-bar.short { width: 55% }
.sidebar-tpl-name { font-size: 13px; font-weight: 700; color: #0f172a; margin-bottom: 2px }
.sidebar-tpl-desc { font-size: 11px; color: #94a3b8; line-height: 1.5 }

.sidebar-badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600 }
.sidebar-badge.active { background: #d1fae5; color: #065f46 }
.sidebar-badge.draft  { background: #f3f4f6; color: #6b7280 }

.tips-card {
  background: linear-gradient(160deg, #f5f3ff, #ede9fe);
  border: 1px solid #ddd6fe;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
}
.tips-card-title {
  font-size: 10px;
  font-weight: 800;
  color: #6d28d9;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 10px;
}
.tips-item {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  font-size: 12px;
  color: #5b21b6;
  line-height: 1.6;
  padding: 5px 0;
  border-bottom: 1px solid rgba(124,58,237,.1);
}
.tips-item:last-child { border-bottom: none; padding-bottom: 0 }
.tips-item::before { content: '→'; flex-shrink: 0; font-weight: 700; margin-top: 1px }

/* ── Section Header */
.section-header { margin-bottom: 24px }
.section-title { font-size: 22px; font-weight: 800; color: #0f172a; margin-bottom: 4px; letter-spacing: -.4px; line-height: 1.2 }
.section-desc { font-size: 14px; color: #64748b; line-height: 1.6; margin: 0 }

/* ── Panel Cards */
.panel-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 22px 24px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
  transition: box-shadow .2s;
}
.panel-card:hover { box-shadow: 0 2px 10px rgba(0,0,0,.07) }
.panel-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #f1f5f9;
}
.panel-card-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #f3f0ff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  font-weight: 700;
  color: #5b21b6;
}
.panel-card-icon.blue  { background: #eff6ff; color: #1d4ed8 }
.panel-card-icon.green { background: #ecfdf5; color: #059669 }
.panel-card-icon.amber { background: #fffbeb; color: #d97706 }
.panel-card-icon.rose  { background: #fff1f2; color: #e11d48 }
.panel-card-meta { flex: 1 }
.panel-card-title { font-size: 14px; font-weight: 700; color: #0f172a; line-height: 1.3 }
.panel-card-subtitle { font-size: 12px; color: #94a3b8; margin-top: 2px }

/* ── Subsection */
.subsection { margin-top: 24px; padding-top: 20px; border-top: 1px solid #f1f5f9 }
.subsection-title { font-size: 14px; font-weight: 700; color: #334155; margin-bottom: 4px }
.subsection-desc { font-size: 12px; color: #94a3b8; margin-bottom: 14px; line-height: 1.5 }

/* ── Form Grid */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px }
.form-group { display: flex; flex-direction: column; gap: 6px }
.form-group.full { grid-column: span 2 }
.form-group label { font-size: 12px; font-weight: 600; color: #374151; letter-spacing: .01em }
.form-control {
  padding: 9px 12px;
  border-radius: 9px;
  border: 1.5px solid #e2e8f0;
  font-size: 14px;
  font-family: inherit;
  color: #0f172a;
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
  box-sizing: border-box;
}
.form-control:focus { outline: none; border-color: #7c3aed; box-shadow: 0 0 0 3px rgba(124,58,237,.1) }
.form-control:hover:not(:focus) { border-color: #c4b5fd }
textarea.form-control { resize: vertical; min-height: 110px; line-height: 1.65 }
select.form-control {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%2394a3b8' d='M5 7L0.5 2.5h9z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  -webkit-appearance: none;
  appearance: none;
  padding-right: 34px;
}
.field-hint { font-size: 11.5px; color: #94a3b8; line-height: 1.5; margin-top: 1px }

/* ── Toggle */
.toggle-row { display: flex; align-items: center; gap: 10px }
.toggle-input { display: none }
.toggle-label {
  position: relative;
  display: inline-block;
  width: 44px; height: 24px;
  cursor: pointer;
  background: #e2e8f0;
  border-radius: 100px;
  transition: background .2s;
  flex-shrink: 0;
}
.toggle-label::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
}
.toggle-input:checked + .toggle-label { background: #7c3aed }
.toggle-input:checked + .toggle-label::after { transform: translateX(20px) }
.toggle-text { font-size: 13px; color: #475569; font-weight: 500 }

/* ── Radio Group (card style) */
.radio-group { display: flex; flex-direction: column; gap: 8px }
.radio-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1.5px solid #e2e8f0;
  background: #fff;
  transition: border-color .15s, background .15s;
  color: #374151;
}
.radio-opt:hover { border-color: #a78bfa; background: #faf8ff }
.radio-opt:has(input:checked) { border-color: #7c3aed; background: #faf8ff }
.radio-opt input { accent-color: #7c3aed; width: 16px; height: 16px; flex-shrink: 0 }

/* ── Checkbox Group (card style) */
.checkbox-group { display: flex; flex-direction: column; gap: 8px }
.check-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1.5px solid #e2e8f0;
  background: #fff;
  transition: border-color .15s, background .15s;
  color: #374151;
}
.check-opt:hover { border-color: #a78bfa; background: #faf8ff }
.check-opt:has(input:checked) { border-color: #7c3aed; background: #faf8ff }
.check-opt input { accent-color: #7c3aed; width: 16px; height: 16px; flex-shrink: 0 }

/* ── Editor Rows */
.features-editor, .gallery-editor, .benefits-editor, .highlights-editor {
  display: flex; flex-direction: column; gap: 8px
}
.editor-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f8fafc;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1.5px solid #e2e8f0;
  transition: border-color .15s;
}
.editor-row:hover { border-color: #c4b5fd }
.benefit-row { align-items: flex-start }
.editor-row .form-control { background: transparent; border-color: transparent; padding: 6px 8px }
.editor-row .form-control:focus { background: #fff; border-color: #7c3aed; box-shadow: 0 0 0 2px rgba(124,58,237,.08) }
.remove-btn {
  flex-shrink: 0;
  width: 28px; height: 28px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color .15s, background .15s;
}
.remove-btn:hover { color: #ef4444; background: #fee2e2 }
.btn-link {
  background: none; border: none;
  color: #7c3aed; font-size: 12px; font-weight: 600;
  cursor: pointer; padding: 6px 0;
  display: inline-flex; align-items: center; gap: 4px;
  transition: color .15s;
}
.btn-link:hover { color: #6d28d9 }
.add-row { display: flex; align-items: center; gap: 14px; margin-top: 8px }

/* ── Template Grid */
.template-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px }
.template-card {
  border: 2px solid #e2e8f0;
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  transition: all .22s ease;
  background: #fff;
  position: relative;
}
.template-card input[type=radio] { display: none }
.template-card:hover {
  border-color: #a78bfa;
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(124,58,237,.14);
}
.template-card.selected {
  border-color: #7c3aed;
  box-shadow: 0 0 0 4px rgba(124,58,237,.15);
}
.template-card.selected::after {
  content: '✓';
  position: absolute;
  top: 10px; right: 10px;
  width: 24px; height: 24px;
  background: #7c3aed;
  color: #fff;
  border-radius: 50%;
  text-align: center;
  line-height: 24px;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 2px 6px rgba(124,58,237,.4);
}

/* Template previews */
.tpl-preview { height: 155px; overflow: hidden; position: relative; transition: filter .3s }
.tpl-prev-hero { height: 82px; position: relative }
.tpl-prev-hero::before {
  content: ''; position: absolute;
  bottom: 16px; left: 14px;
  width: 55%; height: 7px;
  background: rgba(255,255,255,.55); border-radius: 4px;
}
.tpl-prev-hero::after {
  content: ''; position: absolute;
  bottom: 6px; left: 14px;
  width: 36%; height: 5px;
  background: rgba(255,255,255,.3); border-radius: 3px;
}
.tpl-prev-body { padding: 10px 12px; display: flex; flex-direction: column; gap: 5px; background: #fff }
.tpl-prev-bar { height: 6px; background: #e2e8f0; border-radius: 3px }
.tpl-prev-bar.short { width: 55% }
.tpl-prev-cards { display: flex; gap: 5px; margin-top: 3px }
.tpl-prev-cards::before, .tpl-prev-cards::after { content: ''; flex: 1; height: 22px; background: #f1f5f9; border-radius: 4px }

/* Specific Previews */
.tpl-modern-preview  .tpl-prev-hero { background: linear-gradient(135deg, #7c3aed, #4c1d95) }
.tpl-bold-preview    .tpl-prev-hero { background: linear-gradient(135deg, #d97706, #92400e) }
.tpl-bold-preview    .tpl-prev-body { background: #1c1917 }
.tpl-bold-preview    .tpl-prev-bar  { background: #44403c }
.tpl-bold-preview    .tpl-prev-cards::before, .tpl-bold-preview .tpl-prev-cards::after { background: #292524 }

.tpl-luxury-preview  .tpl-prev-hero { background: linear-gradient(180deg, #0c0a09 20%, #1c1917) }
.tpl-luxury-preview  .tpl-prev-body { background: #1c1917 }
.tpl-luxury-preview  .tpl-prev-bar  { background: #92710b }
.tpl-luxury-preview  .tpl-prev-hero::before { background: rgba(184,134,11,.65) }
.tpl-luxury-preview  .tpl-prev-hero::after  { background: rgba(184,134,11,.35) }

.tpl-classic-preview .tpl-prev-hero { background: linear-gradient(135deg, #1d4ed8, #1e3a8a) }
.tpl-classic-preview .tpl-prev-bar  { background: #bfdbfe }
.tpl-classic-preview .tpl-prev-cards::before, .tpl-classic-preview .tpl-prev-cards::after { background: #eff6ff }

/* Animated / Special Previews */
.tpl-motion-preview { background: #0f172a }
.tpl-prev-hero-anim {
  height: 82px; background: linear-gradient(135deg, #10b981, #059669);
  position: relative; overflow: hidden;
}
.tpl-prev-hero-anim::after {
  content: ''; position: absolute; width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.2), transparent);
  transform: translateX(-100%); animation: tpl-shimmer 2s infinite;
}
@keyframes tpl-shimmer { 100% { transform: translateX(100%) } }

.tpl-neon-preview { background: #000; border-bottom: 2px solid #0ff }
.tpl-prev-hero-neon { height: 82px; border-bottom: 1px solid #f0f; box-shadow: 0 0 10px rgba(255,0,255,.2) }
.neon-b { background: #0ff !important; box-shadow: 0 0 5px #0ff }
.neon-p { background: #f0f !important; box-shadow: 0 0 5px #f0f }

.tpl-parallax-preview { background: #111; perspective: 1000px }
.tpl-prev-hero-parallax {
  height: 82px; background: url('https://images.unsplash.com/photo-1600585154340-be6161a56a0c?q=80&w=300') center;
  background-size: cover; transform: translateZ(-10px) scale(1.1);
}
.tpl-prev-body-parallax { padding: 10px 12px; display: flex; flex-direction: column; gap: 5px; transform: translateZ(5px) }

/* Overlay & Buttons */
.tpl-overlay {
  position: absolute; top: 0; left: 0; width: 100%; height: 155px;
  background: rgba(15, 23, 42, 0.75);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: all .3s ease;
  backdrop-filter: blur(2px); z-index: 10;
}
.template-card:hover .tpl-overlay { opacity: 1 }
.template-card:hover .tpl-preview { filter: blur(1px) }

.btn-apply-example {
  background: #fff; color: #0f172a;
  border: none; padding: 10px 16px; border-radius: 100px;
  font-size: 11px; font-weight: 700; cursor: pointer;
  transform: translateY(10px); transition: all .4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 10px 20px rgba(0,0,0,.3);
  white-space: nowrap;
}
.template-card:hover .btn-apply-example { transform: translateY(0) }
.btn-apply-example:hover { background: #7c3aed; color: #fff; transform: scale(1.05) }

/* Badges */
.badge-new, .badge-premium {
  font-size: 9px; padding: 2px 6px; border-radius: 4px;
  text-transform: uppercase; font-weight: 800; margin-left: 6px; vertical-align: middle;
}
.badge-new { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0 }
.badge-premium { background: #fef3c7; color: #92400e; border: 1px solid #fde68a }
.tpl-name { padding: 12px 16px 3px; font-size: 14px; font-weight: 700; color: #0f172a }
.tpl-desc { padding: 0 16px 14px; font-size: 12px; color: #64748b; line-height: 1.5 }

/* ── Color Picker */
.color-pick-row { display: flex; gap: 8px; align-items: center }
.color-input {
  width: 44px; height: 44px;
  border-radius: 10px;
  border: 2px solid #e2e8f0;
  cursor: pointer; padding: 2px; flex-shrink: 0;
  transition: border-color .15s;
}
.color-input:hover { border-color: #7c3aed }
.color-presets { display: flex; flex-wrap: wrap; gap: 8px }
.preset-btn {
  width: 40px; height: 40px;
  border-radius: 10px;
  border: 2.5px solid transparent;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.preset-btn:hover {
  transform: scale(1.15);
  box-shadow: 0 4px 14px rgba(0,0,0,.22);
  border-color: rgba(255,255,255,.6);
}

/* ── Responsive */
@media (max-width: 1100px) { .builder-panel-sidebar { width: 240px } }
@media (max-width: 960px)  { .builder-panel-sidebar { display: none } }
@media (max-width: 768px) {
  .builder-editor { padding: 20px 16px 40px }
  .form-grid { grid-template-columns: 1fr }
  .form-group.full { grid-column: span 1 }
  .builder-header { flex-wrap: wrap; height: auto; padding: 12px 16px }
  .title-input { width: 180px }
  .template-grid { grid-template-columns: 1fr 1fr }
  .builder-tabs { padding: 0 12px }
  .tab-btn { padding: 0 10px; font-size: 12px }
}
