/* ============================================
   FORM BUILDER - Modern Redesign
   Glassmorphism · Micro-interactions · Soft UI
   ============================================ */

/* =============================================
   TOPBAR ACTIONS
   ============================================= */

.topbar-actions {
  display: flex;
  gap: 8px;
  margin-left: 16px;
}

.btn-topbar-cancel {
  padding: 8px 18px;
  background: var(--surface-alt);
  color: var(--text-light);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-weight: 550;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.82em;
  white-space: nowrap;
}

.btn-topbar-cancel:hover {
  background: var(--hover-bg);
  color: var(--text-color);
  border-color: var(--text-muted);
}

.btn-topbar-save {
  padding: 8px 18px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82em;
  white-space: nowrap;
}

.btn-topbar-save:hover {
  filter: brightness(1.06);
  box-shadow: 0 2px 10px rgba(74, 144, 226, 0.25);
}

.btn-topbar-save:active {
  transform: scale(0.98);
}

.btn-topbar-save:disabled,
.btn-panel-save:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: none;
  box-shadow: none;
}

.btn-panel-save:hover {
  filter: brightness(1.06);
}

.btn-topbar-save.loading,
.btn-panel-save.loading {
  pointer-events: none;
}

.save-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* =============================================
   LAYOUT
   ============================================= */

.form-builder-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 24px;
  margin-top: 0;
  padding: 24px 20px;
  max-width: 1360px;
  margin-left: auto;
  margin-right: auto;
}

/* =============================================
   EDITOR PANEL
   ============================================= */

.form-editor-panel {
  min-height: 500px;
}

.form-editor-panel .card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: 0 1px 3px var(--shadow);
  overflow: hidden;
}

/* =============================================
   SECTIONS
   ============================================= */

.form-section {
  padding: 24px;
  border-bottom: 1px solid var(--border-light);
  position: relative;
}

.form-section::before {
  display: none;
}

.form-section:last-child {
  border-bottom: none;
}

.section-title {
  font-size: 0.95em;
  font-weight: 650;
  color: var(--text-color);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 0;
  border-bottom: none;
  border-image: none;
  position: relative;
}

.section-title::after {
  display: none;
}

.section-title .ev-icon {
  color: var(--primary);
  opacity: 0.7;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

/* =============================================
   FORM CONTROLS (inputs, labels)
   ============================================= */

.form-group {
  margin-bottom: 18px;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-group label {
  display: block;
  font-size: 0.82em;
  font-weight: 550;
  color: var(--text-color);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 0.88em;
  background: var(--surface-alt);
  color: var(--text-color);
  transition: all 0.2s ease;
  font-family: inherit;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.08);
  background: var(--card-bg);
}

.form-control::placeholder {
  color: var(--text-muted);
}

/* =============================================
   LOGO UPLOAD
   ============================================= */

.logo-upload-area {
  border: 2px dashed var(--border-color);
  border-radius: 10px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--surface-alt);
  position: relative;
}

.logo-upload-area:hover {
  border-color: var(--primary);
  background: rgba(74, 144, 226, 0.03);
}

.logo-upload-area.has-file {
  border-style: solid;
  padding: 12px;
}

.logo-upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
}

.logo-upload-placeholder svg {
  opacity: 0.4;
}

.logo-upload-placeholder span {
  font-size: 0.85em;
  font-weight: 550;
  color: var(--text-light);
}

.logo-upload-placeholder small {
  font-size: 0.72em;
  color: var(--text-muted);
}

.logo-preview-wrap {
  position: relative;
  display: inline-block;
}

.logo-preview-wrap img {
  max-width: 160px;
  max-height: 80px;
  object-fit: contain;
  border-radius: 6px;
}

.logo-remove-btn {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 24px;
  height: 24px;
  background: var(--danger);
  color: white;
  border: 2px solid var(--card-bg);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.logo-remove-btn:hover {
  transform: scale(1.1);
}

.form-text {
  display: block;
  margin-top: 6px;
  font-size: 0.75em;
  color: var(--text-muted);
  font-style: italic;
}

/* =============================================
   DESIGN CONTROLS
   ============================================= */

.design-controls {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

.color-picker-group {
  display: flex;
  gap: 8px;
  align-items: center;
}

.color-picker-group input[type="color"] {
  width: 42px;
  height: 36px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  padding: 2px;
  background: var(--card-bg);
  transition: border-color 0.15s ease;
}

.color-picker-group input[type="color"]:hover {
  border-color: var(--primary);
}

.color-hex-input {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.82em;
  background: var(--surface-alt);
  color: var(--text-color);
}

.slider-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.slider {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--border-color);
  outline: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(74, 144, 226, 0.3);
  transition: transform 0.15s ease;
}

.slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: none;
  box-shadow: 0 1px 4px rgba(74, 144, 226, 0.3);
}

.slider-group span {
  min-width: 40px;
  font-weight: 600;
  font-size: 0.82em;
  color: var(--primary);
}

/* =============================================
   STICKY ADD QUESTION
   ============================================= */

.sticky-add-question {
  position: sticky;
  bottom: 16px;
  z-index: 400;
  margin-top: 24px;
  padding: 0;
}

.sticky-add-question-wrapper {
  padding: 0;
}

.btn-add-field {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 20px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.88em;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 16px rgba(74, 144, 226, 0.2);
  position: relative;
  overflow: hidden;
}

.btn-add-field::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  transition: left 0.5s ease;
}

.btn-add-field:hover::before {
  left: 100%;
}

.btn-add-field:hover {
  box-shadow: 0 6px 20px rgba(74, 144, 226, 0.3);
  filter: brightness(1.05);
}

.btn-add-field:active {
  transform: scale(0.98);
}

.btn-add-field span {
  font-size: 1.2em;
  font-weight: 300;
}

/* =============================================
   FIELDS CONTAINER
   ============================================= */

.fields-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 16px;
}

.field-item {
  background: var(--surface-alt);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  position: relative;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.field-item:hover {
  border-color: rgba(74, 144, 226, 0.3);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}

.field-item.new-field {
  animation: fieldSlideIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fieldSlideIn {
  from {
    opacity: 0;
    transform: translateY(-12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.field-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}

.field-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: rgba(74, 144, 226, 0.08);
  color: var(--primary);
  border-radius: 6px;
  font-size: 0.78em;
  font-weight: 600;
}

.field-actions {
  display: flex;
  gap: 4px;
}

.btn-icon {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95em;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  font-weight: bold;
  background: transparent;
  color: var(--text-muted);
}

.btn-icon:hover {
  background: var(--hover-bg);
  color: var(--text-color);
}

.btn-move-up,
.btn-move-down {
  background: transparent;
  color: var(--text-muted);
}

.btn-move-up:hover,
.btn-move-down:hover {
  background: var(--surface-alt);
  color: var(--text-color);
}

.btn-delete-field {
  background: transparent;
  color: var(--text-muted);
}

.btn-delete-field:hover {
  background: rgba(239, 68, 68, 0.08);
  color: var(--danger);
}

.field-item-body .form-group {
  margin-bottom: 16px;
}

/* Collapse / Expand */
.field-item.collapsed {
  padding: 10px 14px;
}
.field-item.collapsed .field-item-header {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: 0;
  cursor: pointer;
}
.field-item.collapsed .field-item-body {
  display: none;
}
.btn-collapse-toggle {
  background: none !important;
  border: 0 !important;
  cursor: pointer;
  padding: 4px 6px !important;
  font-size: 12px !important;
  color: #64748b !important;
  width: auto !important;
  height: auto !important;
  margin-right: 4px;
}
.btn-collapse-toggle:hover {
  color: #0f172a !important;
}

/* =============================================
   VALIDATION
   ============================================= */

.input-error {
  border-color: var(--danger) !important;
  background-color: rgba(239, 68, 68, 0.03) !important;
}

.input-error:focus {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.08) !important;
}

.field-error {
  display: block;
  margin-top: 5px;
  font-size: 0.78em;
  color: var(--danger);
  font-weight: 500;
  animation: errorIn 0.2s ease;
}

@keyframes errorIn {
  from { opacity: 0; transform: translateY(-3px); }
  to { opacity: 1; transform: translateY(0); }
}

/* =============================================
   PHONE INPUT
   ============================================= */

.phone-input-container {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.country-selector {
  position: relative;
  min-width: 110px;
}

.country-select-btn {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface-alt);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 0.88em;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  color: var(--text-color);
}

.country-select-btn:hover {
  border-color: var(--primary);
}

.country-select-btn:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.08);
}

.country-flag {
  font-size: 1.2em;
}

.country-code {
  font-weight: 600;
  color: var(--text-color);
  font-size: 0.88em;
}

.dropdown-arrow {
  margin-left: auto;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.country-select-btn.active .dropdown-arrow {
  transform: rotate(180deg);
}

.country-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  max-height: 260px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
}

.country-dropdown.active {
  display: block;
  animation: dropdownSlide 0.15s ease;
}

@keyframes dropdownSlide {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.country-search {
  position: sticky;
  top: 0;
  padding: 8px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border-light);
}

.country-search input {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 0.82em;
  background: var(--surface-alt);
  color: var(--text-color);
}

.country-search input:focus {
  outline: none;
  border-color: var(--primary);
}

.country-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.country-option {
  padding: 9px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.12s ease;
  font-size: 0.85em;
}

.country-option:hover {
  background: var(--hover-bg);
}

.country-option.selected {
  background: rgba(74, 144, 226, 0.06);
  color: var(--primary);
  font-weight: 600;
}

.country-option-name {
  flex: 1;
  font-size: 0.88em;
}

.country-option-code {
  color: var(--text-muted);
  font-size: 0.78em;
}

.phone-number-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 0.92em;
  transition: all 0.2s ease;
  font-family: 'SF Mono', 'Fira Code', monospace;
  background: var(--surface-alt);
  color: var(--text-color);
}

.phone-number-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.08);
}

.phone-number-input.error {
  border-color: var(--danger);
  background: rgba(239, 68, 68, 0.03);
}

.phone-input-error {
  display: none;
  margin-top: 5px;
  font-size: 0.78em;
  color: var(--danger);
  font-weight: 500;
}

.phone-input-error.active {
  display: block;
  animation: errorIn 0.2s ease;
}

/* =============================================
   CHECKBOX INLINE
   ============================================= */

.checkbox-inline {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface-alt);
  border-radius: 8px;
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.88em;
}

.checkbox-inline input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary);
}

.checkbox-inline:hover {
  border-color: var(--primary);
  background: rgba(74, 144, 226, 0.03);
}

/* =============================================
   OPTIONS CONTAINER
   ============================================= */

.options-container {
  margin-top: 16px;
  padding: 16px;
  background: var(--card-bg);
  border-radius: 10px;
  border: 1px dashed var(--border-color);
}

.option-item {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  align-items: center;
}

.option-item input {
  flex: 1;
}

.btn-remove-option {
  width: 34px;
  height: 34px;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.1em;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-remove-option:hover {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--danger);
}

.btn-add-option {
  width: 100%;
  padding: 10px;
  background: transparent;
  border: 1px dashed var(--border-color);
  color: var(--primary);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 550;
  font-size: 0.85em;
  transition: all 0.2s ease;
}

.btn-add-option:hover {
  background: rgba(74, 144, 226, 0.04);
  border-color: var(--primary);
}

/* =============================================
   FORM ACTIONS (bottom bar)
   ============================================= */

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  background: var(--surface-alt);
  border-top: 1px solid var(--border-light);
  border-radius: 0 0 16px 16px;
}

.form-actions .btn {
  padding: 10px 22px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.85em;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
  border: none;
}

.form-actions .btn-secondary {
  background: var(--surface-alt);
  color: var(--text-color);
  border: 1px solid var(--border-color);
}

.form-actions .btn-secondary:hover {
  background: var(--hover-bg);
  border-color: var(--text-muted);
}

.form-actions .btn-primary {
  background: var(--primary);
  color: white;
}

.form-actions .btn-primary:hover:not(:disabled) {
  filter: brightness(1.05);
  box-shadow: 0 2px 10px rgba(74, 144, 226, 0.25);
}

.form-actions .btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.form-actions .btn-primary.loading {
  pointer-events: none;
  opacity: 0.7;
}

.form-actions .save-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}

/* =============================================
   PREVIEW PANEL
   ============================================= */

.form-preview-panel {
  position: relative;
}

.preview-sticky {
  position: sticky;
  top: 80px;
  transition: all 0.3s ease;
}

.preview-sticky.scrolled {
  top: 70px;
}

.preview-header {
  background: var(--primary);
  color: white;
  padding: 16px 20px;
  border-radius: 14px 14px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.preview-header h3 {
  margin: 0;
  color: white;
  font-size: 0.95em;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.preview-device-toggle {
  display: flex;
  gap: 4px;
  padding: 3px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 8px;
}

.device-btn {
  width: 34px;
  height: 34px;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.device-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.device-btn.active {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

.preview-container {
  background: var(--surface-alt);
  padding: 24px;
  border-radius: 0 0 14px 14px;
  min-height: 400px;
  border: 1px solid var(--border-color);
  border-top: none;
}

.preview-frame {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 28px;
  border: 1px solid var(--border-light);
  transition: all 0.3s ease;
}

.preview-frame.desktop {
  margin: 0 auto;
}

.preview-frame.mobile {
  max-width: 360px;
  margin: 0 auto;
  padding: 20px;
}

.preview-content {
  min-height: 160px;
}

.preview-empty {
  text-align: center;
  padding: 50px 16px;
  color: var(--text-muted);
}

.preview-empty .empty-icon {
  margin-bottom: 12px;
  opacity: 0.3;
}

.preview-empty p {
  font-size: 0.88em;
  line-height: 1.5;
  color: var(--text-muted);
}

.preview-form-header {
  text-align: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-light);
}

.preview-logo {
  display: block;
  width: calc(100% + 32px);
  margin: -16px -16px 16px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #f1f5f9;
  border-radius: 8px 8px 0 0;
}

.preview-title {
  font-size: 1.4em;
  font-weight: 700;
  margin: 0;
  color: var(--text-color);
}

/* =============================================
   PREVIEW QUESTIONS
   ============================================= */

.preview-question {
  margin-bottom: 20px;
  padding: 16px;
  background: var(--surface-alt);
  border-radius: 10px;
  border: 1px solid var(--border-light);
  border-left: 3px solid var(--primary);
  transition: all 0.2s ease;
}

.preview-question:hover {
  border-color: var(--border-color);
  border-left-color: var(--primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.preview-label {
  font-weight: 600;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9em;
  color: var(--text-color);
}

.preview-required {
  color: var(--danger);
}

.preview-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 0.88em;
  background: var(--card-bg);
  color: var(--text-color);
  transition: all 0.2s ease;
}

.preview-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.08);
}

.preview-textarea {
  min-height: 80px;
  resize: vertical;
}

.preview-radio-group,
.preview-checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.preview-option-label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 0.88em;
  color: var(--text-color);
}

.preview-option-label:hover {
  border-color: var(--primary);
  background: rgba(74, 144, 226, 0.02);
}

.preview-option-label input {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--primary);
}

/* ===== PREVIEW SEARCHABLE DROPDOWN (radio/checkbox isSearchableList) ===== */
.pv-sl-wrapper { position: relative; }
.pv-sl-trigger {
  width: 100%; display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; background: #fff; border: 2px solid #e5e7eb;
  font-size: 13px; font-family: inherit; color: #1e293b;
  cursor: pointer; text-align: left; transition: border-color 0.15s;
}
.pv-sl-trigger:hover { border-color: #cbd5e1; }
.pv-sl-wrapper.pv-sl-open .pv-sl-trigger { border-color: var(--primary, #3b82f6); }
.pv-sl-trigger-text {
  flex: 1; color: #334155; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pv-sl-trigger svg { color: #64748b; flex-shrink: 0; transition: transform 0.15s; }
.pv-sl-wrapper.pv-sl-open .pv-sl-trigger svg { transform: rotate(180deg); }
.pv-sl-panel {
  display: none; position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: #fff; border: 1px solid #e5e7eb; border-radius: 8px;
  box-shadow: 0 8px 20px rgba(15,23,42,0.12); z-index: 50; overflow: hidden;
}
.pv-sl-wrapper.pv-sl-open .pv-sl-panel { display: block; }
.pv-sl-search-row {
  display: flex; align-items: center; gap: 6px; padding: 8px 10px;
  border-bottom: 1px solid #f1f5f9; background: #f8fafc;
}
.pv-sl-search-input {
  flex: 1; border: 0; background: transparent; outline: none;
  font-size: 12.5px; font-family: inherit; color: #1e293b;
}
.pv-sl-list { max-height: 220px; overflow-y: auto; padding: 4px; }
.pv-sl-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; cursor: pointer; border-radius: 5px;
  font-size: 12.5px; color: #334155;
}
.pv-sl-item:hover { background: #f1f5f9; }
.pv-sl-item.pv-sl-selected { background: #eff6ff; color: #1e40af; font-weight: 500; }
.pv-sl-radio, .pv-sl-check {
  width: 14px; height: 14px; border: 2px solid #cbd5e1;
  flex-shrink: 0; position: relative;
}
.pv-sl-radio { border-radius: 50%; }
.pv-sl-check { border-radius: 3px; }
.pv-sl-item.pv-sl-selected .pv-sl-radio { border-color: var(--primary, #3b82f6); background: var(--primary, #3b82f6); box-shadow: inset 0 0 0 2px #fff; }
.pv-sl-item.pv-sl-selected .pv-sl-check { border-color: var(--primary, #3b82f6); background: var(--primary, #3b82f6); }
.pv-sl-item.pv-sl-selected .pv-sl-check::after {
  content: ''; position: absolute; left: 3px; top: -1px;
  width: 4px; height: 8px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.pv-sl-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.preview-stars {
  display: flex;
  gap: 6px;
  font-size: 1.6em;
}

.preview-star {
  cursor: pointer;
  color: var(--border-color);
  transition: all 0.15s ease;
}

.preview-star:hover,
.preview-star.active {
  color: var(--warning);
  transform: scale(1.1);
}

/* =============================================
   FIELD TYPE MODAL
   ============================================= */

.field-types-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.field-type-card {
  padding: 16px 12px;
  background: var(--surface-alt);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.field-type-card:hover {
  border-color: var(--primary);
  background: rgba(74, 144, 226, 0.04);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.field-type-card:active {
  transform: translateY(0);
}

.field-type-icon {
  font-size: 1.8em;
  margin-bottom: 8px;
  color: var(--primary);
  opacity: 0.8;
}

.field-type-name {
  font-weight: 650;
  color: var(--text-color);
  margin-bottom: 3px;
  font-size: 0.82em;
}

.field-type-desc {
  font-size: 0.7em;
  color: var(--text-muted);
  line-height: 1.3;
}

/* =============================================
   EDIT FORM LAYOUT
   ============================================= */

.edit-form-layout {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 20px;
}

.edit-info-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: rgba(245, 158, 11, 0.06);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: 8px;
  font-size: 0.82em;
  color: var(--warning, #f59e0b);
  font-weight: 500;
  margin-bottom: 16px;
}

/* =============================================
   RESPONSIVE - 1400px
   ============================================= */

@media (max-width: 1400px) {
  .form-builder-layout {
    grid-template-columns: 1fr 340px;
  }
}

/* =============================================
   RESPONSIVE - 1200px
   ============================================= */

@media (max-width: 1200px) {
  .form-builder-layout {
    grid-template-columns: 1fr;
  }

  .preview-sticky {
    position: static;
  }

  .preview-container {
    padding: 16px;
  }
}

/* =============================================
   RESPONSIVE - 768px (Mobile)
   ============================================= */

@media (max-width: 768px) {
  .topbar-actions {
    margin-left: 8px;
    gap: 6px;
  }

  .btn-topbar-cancel,
  .btn-topbar-save {
    padding: 7px 12px;
    font-size: 0.78em;
  }

  .form-builder-layout {
    padding: 14px 10px;
    gap: 16px;
  }

  .form-section {
    padding: 18px 14px;
  }

  .section-title {
    font-size: 0.88em;
    margin-bottom: 16px;
  }

  .form-group label {
    font-size: 0.78em;
  }

  .form-control {
    font-size: 0.85em;
    padding: 9px 12px;
  }

  .design-controls {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .field-item {
    padding: 14px 12px;
    border-radius: 10px;
  }

  .field-item:hover {
    transform: none;
    box-shadow: none;
  }

  .field-item-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 10px;
  }

  .field-type-badge {
    font-size: 0.72em;
    padding: 4px 10px;
  }

  .btn-icon {
    width: 30px;
    height: 30px;
    font-size: 0.88em;
  }

  .options-container {
    padding: 12px;
    margin-top: 12px;
  }

  .btn-remove-option {
    width: 30px;
    height: 30px;
    font-size: 0.95em;
  }

  .btn-add-option {
    padding: 9px;
    font-size: 0.82em;
  }

  .sticky-add-question {
    bottom: 8px;
    margin-top: 18px;
  }

  .btn-add-field {
    padding: 11px 16px;
    font-size: 0.82em;
    border-radius: 8px;
  }

  .form-actions {
    padding: 14px;
    gap: 8px;
    flex-direction: column;
  }

  .form-actions .btn {
    width: 100%;
    justify-content: center;
    font-size: 0.82em;
    padding: 10px 18px;
  }

  .phone-input-container {
    flex-direction: column;
    gap: 8px;
  }

  .country-selector {
    min-width: unset;
  }

  .field-types-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .field-type-card {
    padding: 12px 8px;
  }

  .field-type-card:hover {
    transform: none;
  }

  .field-type-icon {
    font-size: 1.5em;
    margin-bottom: 6px;
  }

  .field-type-name {
    font-size: 0.75em;
  }

  .field-type-desc {
    font-size: 0.65em;
  }

  /* Preview */
  .preview-header {
    padding: 12px 14px;
    border-radius: 10px 10px 0 0;
  }

  .preview-header h3 {
    font-size: 0.85em;
  }

  .device-btn {
    width: 30px;
    height: 30px;
  }

  .preview-container {
    padding: 12px;
    border-radius: 0 0 10px 10px;
    min-height: 250px;
  }

  .preview-frame {
    padding: 16px;
    border-radius: 10px;
  }

  .preview-title {
    font-size: 1.1em;
  }

  .preview-question {
    padding: 12px;
    margin-bottom: 14px;
    border-radius: 8px;
  }

  .preview-label {
    font-size: 0.82em;
  }

  .preview-input {
    padding: 8px 10px;
    font-size: 0.82em;
  }

  .preview-option-label {
    padding: 8px 10px;
    font-size: 0.82em;
  }

  .preview-stars {
    font-size: 1.4em;
  }

  .preview-empty {
    padding: 30px 12px;
  }

  .preview-empty p {
    font-size: 0.82em;
  }

  .logo-upload-container {
    flex-direction: column;
    gap: 8px;
  }

  .checkbox-inline {
    padding: 9px 12px;
    font-size: 0.82em;
  }

  .color-picker-group input[type="color"] {
    width: 36px;
    height: 32px;
  }

  .color-hex-input {
    padding: 7px 8px;
    font-size: 0.78em;
  }

  .slider-group span {
    font-size: 0.78em;
  }
}

/* =============================================
   RESPONSIVE - 480px (Small Mobile)
   ============================================= */

@media (max-width: 480px) {
  .topbar-actions {
    flex-direction: column;
    gap: 4px;
  }

  .btn-topbar-cancel,
  .btn-topbar-save {
    width: 100%;
    justify-content: center;
    padding: 6px 10px;
    font-size: 0.75em;
  }

  .form-builder-layout {
    padding: 10px 8px;
  }

  .form-section {
    padding: 14px 10px;
  }

  .section-title {
    font-size: 0.82em;
  }

  .field-item {
    padding: 12px 10px;
  }

  .field-type-badge {
    font-size: 0.68em;
  }

  .btn-icon {
    width: 28px;
    height: 28px;
  }

  .btn-add-field {
    padding: 10px 12px;
    font-size: 0.78em;
  }

  .form-actions .btn {
    padding: 9px 14px;
    font-size: 0.78em;
  }

  .field-types-grid {
    gap: 6px;
  }

  .field-type-card {
    padding: 10px 6px;
  }

  .field-type-icon {
    font-size: 1.3em;
  }

  .field-type-name {
    font-size: 0.7em;
  }

  .field-type-desc {
    font-size: 0.6em;
  }

  .preview-container {
    padding: 8px;
  }

  .preview-frame {
    padding: 12px;
  }

  .preview-title {
    font-size: 1em;
  }

  .preview-question {
    padding: 10px 8px;
  }

  .preview-input, .preview-textarea { font-size: 16px; padding: 10px; }
  .btn-topbar-cancel, .btn-topbar-save { min-height: 38px; }
}

@media (max-width: 360px) {
  .form-builder-layout { padding: 8px 6px; }
  .form-section { padding: 12px 8px; }
  .field-item { padding: 10px 8px; }
  .field-type-card { padding: 8px 4px; }
  .field-type-icon { font-size: 1.1em; }
  .field-type-name { font-size: 0.65em; }
  .preview-frame { padding: 10px; }
  .preview-title { font-size: 0.9em; }
  .topbar-title { font-size: 0.95em; }
}
