/**
 * 🎨 ENHANCED TEMPLATE EDITOR STYLES
 * Style dla zaawansowanego edytora szablonów
 */

.enhanced-template-editor {
  max-width: 1200px;
  margin: 0 auto;
}

/* Template Header */
.template-header {
  display: grid;
  grid-template-columns: 1fr 1fr 200px;
  gap: 15px;
  margin-bottom: 20px;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 6px;
  border: 1px solid #dee2e6;
}

/* Elements Section */
.template-elements-section {
  margin-bottom: 20px;
}

.elements-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding: 10px 15px;
  background: #e9ecef;
  border-radius: 6px;
}

.add-element-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Elements List */
.elements-list {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  background: white;
}

.element-item {
  border-bottom: 1px solid #f1f3f4;
  padding: 12px;
  transition: background-color 0.2s;
}

.element-item:hover {
  background-color: #f8f9fa;
}

.element-item:last-child {
  border-bottom: none;
}

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

.element-type-icon {
  font-size: 16px;
  margin-right: 8px;
}

.element-title {
  flex: 1;
  font-weight: 500;
  color: #495057;
}

.element-controls {
  display: flex;
  gap: 5px;
}

.element-btn {
  padding: 4px 8px;
  border: 1px solid #dee2e6;
  border-radius: 3px;
  background: white;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
}

.element-btn:hover {
  background: #e9ecef;
  transform: translateY(-1px);
}

.element-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.element-btn-danger {
  color: #dc3545;
  border-color: #dc3545;
}

.element-btn-danger:hover {
  background: #dc3545;
  color: white;
}

.element-preview {
  padding: 8px 12px;
  background: #f8f9fa;
  border-radius: 4px;
  border-left: 3px solid #007bff;
  font-size: 12px;
  color: #6c757d;
}

/* Preview Section */
.template-preview-section {
  margin-bottom: 20px;
}

.template-preview {
  border: 1px solid #dee2e6;
  border-radius: 6px;
  padding: 20px;
  background: white;
  max-height: 400px;
  overflow-y: auto;
  font-family: Arial, sans-serif;
}

/* Element Previews */
.text-preview {
  margin: 10px 0;
}

.preview-btn {
  display: inline-block;
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  text-decoration: none;
  font-size: 14px;
  cursor: pointer;
}

.preview-btn-primary {
  background: #007bff;
  color: white;
}

.preview-btn-secondary {
  background: #6c757d;
  color: white;
}

.preview-btn-success {
  background: #28a745;
  color: white;
}

.preview-btn-danger {
  background: #dc3545;
  color: white;
}

.social-preview {
  text-align: center;
  padding: 8px;
  background: #f8f9fa;
  border-radius: 4px;
  margin: 10px 0;
}

.header-preview {
  margin: 15px 0 10px 0;
  color: #333;
}

/* Actions Section */
.template-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 6px;
  border: 1px solid #dee2e6;
}

.action-group {
  display: flex;
  gap: 10px;
}

/* Element Editor */
.element-editor {
  max-width: 600px;
  margin: 0 auto;
}

.element-editor .complete-form-group {
  margin-bottom: 15px;
}

.element-editor label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
  color: #495057;
}

.element-editor input,
.element-editor select,
.element-editor textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 14px;
}

.element-editor input:focus,
.element-editor select:focus,
.element-editor textarea:focus {
  outline: none;
  border-color: #80bdff;
  box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Responsive Design */
@media (max-width: 768px) {
  .template-header {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .elements-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .add-element-buttons {
    justify-content: center;
  }

  .template-actions {
    flex-direction: column;
    gap: 15px;
  }

  .action-group {
    justify-content: center;
  }

  .element-controls {
    flex-wrap: wrap;
  }
}

/* Drag and Drop (Future Enhancement) */
.element-item.dragging {
  opacity: 0.5;
  transform: rotate(2deg);
}

.elements-list.drag-over {
  background: #e3f2fd;
  border-color: #2196f3;
}

/* Success/Error States */
.element-item.success {
  border-left-color: #28a745;
  background: rgba(40, 167, 69, 0.1);
}

.element-item.error {
  border-left-color: #dc3545;
  background: rgba(220, 53, 69, 0.1);
}

/* Loading States */
.element-item.loading {
  opacity: 0.7;
}

.element-item.loading::after {
  content: "⏳";
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
}

/* Animation */
@keyframes elementAdded {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.element-item.newly-added {
  animation: elementAdded 0.3s ease-out;
}