/**
 * Form-Editor Styles
 */

/* ========== Reset & Base ========== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: #333;
  background: #f5f5f5;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ========== Header ========== */
.editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  z-index: 100;
}

.editor-header h1 {
  font-size: 18px;
  font-weight: 600;
}

.header-center {
  display: flex;
  gap: 10px;
  align-items: center;
}

.header-center select {
  padding: 8px 12px;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  min-width: 200px;
}

.header-right {
  display: flex;
  gap: 10px;
}

/* ========== Buttons ========== */
.btn {
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: #4CAF50;
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: #45a049;
}

.btn-secondary {
  background: white;
  color: #333;
  border: 1px solid #ddd;
}

.btn-secondary:hover:not(:disabled) {
  background: #f0f0f0;
}

.btn-danger {
  background: #f44336;
  color: white;
}

.btn-danger:hover:not(:disabled) {
  background: #d32f2f;
}

.btn-small {
  padding: 4px 10px;
  font-size: 12px;
}

/* ========== Main Layout ========== */
.editor-main {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ========== Palette Panel ========== */
.palette-panel {
  width: 200px;
  background: white;
  border-right: 1px solid #ddd;
  overflow-y: auto;
  padding: 15px;
}

.palette-panel h2 {
  font-size: 14px;
  color: #666;
  margin-bottom: 15px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.palette-section {
  margin-bottom: 20px;
}

.palette-section h3 {
  font-size: 11px;
  color: #999;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.palette-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: #f8f9fa;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  margin-bottom: 6px;
  cursor: grab;
  transition: all 0.2s;
  font-size: 13px;
}

.palette-item:hover {
  background: #e3f2fd;
  border-color: #2196F3;
}

.palette-item:active {
  cursor: grabbing;
}

.palette-item.dragging {
  opacity: 0.5;
}

.palette-item-section {
  background: #fff3e0;
  border-color: #ff9800;
}

.palette-item-section:hover {
  background: #ffe0b2;
}

.palette-icon {
  width: 24px;
  text-align: center;
  font-size: 14px;
}

/* ========== Canvas Panel ========== */
.canvas-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #e8e8e8;
  overflow: hidden;
}

.canvas-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: white;
  border-bottom: 1px solid #ddd;
}

.canvas-header h2 {
  font-size: 16px;
  color: #333;
}

.canvas-info {
  font-size: 12px;
  color: #888;
}

.canvas {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
}

.canvas-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 200px;
  color: #999;
  pointer-events: none;
}

.canvas-empty p {
  pointer-events: none;
}
  font-style: italic;
}

/* ========== Section in Canvas ========== */
.editor-section {
  background: white;
  border-radius: 8px;
  margin-bottom: 15px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  border: 2px solid transparent;
  transition: border-color 0.2s;
}

.editor-section.selected {
  border-color: #2196F3;
}

.editor-section.drag-over {
  border-color: #4CAF50;
  border-style: dashed;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 15px;
  background: #f5f5f5;
  border-radius: 6px 6px 0 0;
  cursor: move;
}

.section-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: #333;
}

.section-header .drag-handle {
  color: #999;
  cursor: grab;
}

.section-content {
  padding: 15px;
  min-height: 50px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.section-content.drag-over {
  background: #e8f5e9;
}

/* ========== Field in Canvas ========== */
.editor-field {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #fafafa;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  grid-column: span 1;
}

.editor-field.col-span-2 {
  grid-column: span 2;
}

.editor-field.col-span-3 {
  grid-column: span 3;
}

.editor-field.new-row {
  grid-column-start: 1;
}

.editor-field:hover {
  background: #f0f0f0;
}

.editor-field.selected {
  background: #e3f2fd;
  border-color: #2196F3;
}

.editor-field.dragging {
  opacity: 0.5;
}

.editor-field .drag-handle {
  cursor: grab;
  color: #bbb;
  padding: 0 5px;
}

.editor-field .field-icon {
  width: 24px;
  text-align: center;
  color: #666;
}

.editor-field .field-info {
  flex: 1;
}

.editor-field .field-label {
  font-weight: 500;
  color: #333;
}

.editor-field .field-name {
  font-size: 11px;
  color: #888;
  font-family: monospace;
}

.editor-field .field-mandatory {
  color: #f44336;
  font-weight: bold;
}

.editor-field .field-type {
  font-size: 11px;
  color: #888;
  background: #eee;
  padding: 2px 6px;
  border-radius: 3px;
}

.editor-field .field-columns {
  font-size: 10px;
  color: #fff;
  background: #2196F3;
  padding: 2px 5px;
  border-radius: 3px;
  font-weight: 600;
}

/* ========== Drop Zone Indicator ========== */
.drop-indicator {
  height: 4px;
  background: #4CAF50;
  border-radius: 2px;
  margin: 4px 0;
  grid-column: 1 / -1;
  animation: pulse 0.5s ease-in-out infinite alternate;
}

@keyframes pulse {
  from { opacity: 0.6; }
  to { opacity: 1; }
}

/* ========== Properties Panel ========== */
.properties-panel {
  width: 280px;
  background: white;
  border-left: 1px solid #ddd;
  overflow-y: auto;
  padding: 15px;
}

.properties-panel h2 {
  font-size: 14px;
  color: #666;
  margin-bottom: 15px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.properties-group {
  margin-bottom: 20px;
}

.properties-group h3 {
  font-size: 12px;
  color: #888;
  margin-bottom: 12px;
  padding-bottom: 5px;
  border-bottom: 1px solid #eee;
}

.property-row {
  margin-bottom: 12px;
}

.property-row label {
  display: block;
  font-size: 12px;
  color: #666;
  margin-bottom: 4px;
}

.property-row input[type="text"],
.property-row input[type="number"],
.property-row input[type="color"],
.property-row select,
.property-row textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 13px;
}

.property-row input[type="color"] {
  padding: 4px;
  height: 36px;
}

.property-row input:focus,
.property-row select:focus,
.property-row textarea:focus {
  outline: none;
  border-color: #2196F3;
}

.property-row input[readonly] {
  background: #f5f5f5;
  color: #888;
}

.property-row-inline {
  display: flex;
  align-items: center;
}

.property-row-inline label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 0;
  cursor: pointer;
}

.property-row-inline input[type="checkbox"] {
  width: auto;
}

/* ========== Advanced Properties ========== */
.advanced-props {
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px dashed #ddd;
}

.advanced-props summary {
  font-size: 12px;
  color: #666;
  cursor: pointer;
  margin-bottom: 10px;
}

.advanced-props summary:hover {
  color: #333;
}

/* ========== Type-specific Props ========== */
.type-specific-props {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #eee;
}

/* ========== Layout Props ========== */
.layout-props {
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid #ddd;
}

.layout-props h3 {
  font-size: 12px;
  color: #888;
  margin-bottom: 12px;
  padding-bottom: 5px;
  border-bottom: 1px solid #eee;
}

/* ========== Radio Options Editor ========== */
#radioOptionsContainer {
  margin-bottom: 8px;
}

.radio-option-row {
  display: flex;
  gap: 5px;
  margin-bottom: 5px;
}

.radio-option-row input {
  flex: 1;
  padding: 6px 8px;
  border: 1px solid #ddd;
  border-radius: 3px;
  font-size: 12px;
}

.radio-option-row .btn-remove-option {
  padding: 4px 8px;
  background: #ffebee;
  color: #c62828;
  border: none;
  border-radius: 3px;
  cursor: pointer;
}

/* ========== Modal ========== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: white;
  border-radius: 8px;
  padding: 20px;
  min-width: 300px;
  max-width: 500px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.modal-content h3 {
  margin-bottom: 15px;
  color: #333;
}

.modal-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* ========== Scrollbar ========== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f0f0f0;
}

::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #aaa;
}

/* ========== Utility ========== */
.hidden {
  display: none !important;
}

.text-muted {
  color: #888;
}

.mt-10 {
  margin-top: 10px;
}

/* ========== Components Grid (Overview) ========== */
.components-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
  padding: 15px;
  min-height: 100px;
}

.editor-component {
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  overflow: hidden;
}

.editor-component:hover {
  border-color: #667eea;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.editor-component.selected {
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

.editor-component.dragging {
  opacity: 0.5;
}

.editor-component .component-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.editor-component .component-header .drag-handle {
  cursor: grab;
  opacity: 0.7;
}

.editor-component .component-header .component-icon {
  font-size: 16px;
}

.editor-component .component-header .component-type {
  font-size: 12px;
  opacity: 0.9;
}

.editor-component .component-body {
  padding: 12px;
}

.editor-component .component-body strong {
  display: block;
  margin-bottom: 5px;
}

.editor-component .component-detail {
  display: block;
  font-size: 12px;
  color: #666;
}

.component-drop-zone {
  min-height: 60px;
  border: 2px dashed #ccc;
  border-radius: 8px;
  margin: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
}

.component-drop-zone::before {
  content: 'Component hierher ziehen';
}

/* Palette Component Style */
.palette-item-component {
  background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf1 100%);
  border-left: 3px solid #667eea;
}

/* ========== Modal Options ========== */
.modal-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 15px 0;
}

.modal-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.modal-option:hover {
  border-color: #667eea;
  background: #f8f9ff;
}

.modal-option input[type="radio"] {
  margin-top: 3px;
}

.modal-option span {
  flex: 1;
}

.modal-option small {
  color: #666;
}