/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */
/* Visual Mapping Styles */

.visual-mapping-container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.mapping-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid #e5e7eb;
}

.mapping-actions {
  display: flex;
  gap: 0.5rem;
}

.mapping-panels {
  display: flex;
  flex: 1;
  position: relative;
}

.source-panel, .target-panel {
  width: 33.333333%;
  border-right: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
}

.mapping-canvas {
  flex: 1;
  position: relative;
}

.connection-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.connection-svg .mapping-line {
  pointer-events: all;
}

.panel-header {
  padding: 0.75rem;
  border-bottom: 1px solid #e5e7eb;
  background-color: #f9fafb;
}

.panel-content {
  flex: 1;
  overflow: auto;
}

.search-input {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  font-size: 0.875rem;
}

.mapping-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  height: 600px;
  padding: 1rem;
}

.mapping-panel {
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 1rem;
  overflow-y: auto;
  background-color: #ffffff;
}

.mapping-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #e5e7eb;
}

.mapping-panel-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: #1f2937;
}

/* Source Panel Specific Styles */
.mapping-source-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.mapping-search {
  margin-bottom: 1rem;
}

.mapping-search input {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  font-size: 0.875rem;
}

.mapping-search input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.mapping-field-list {
  flex: 1;
  overflow-y: auto;
}

/* Field Item Styles */
.mapping-field {
  display: flex;
  align-items: center;
  padding: 0.5rem;
  margin: 0.25rem 0;
  border-radius: 0.25rem;
  cursor: grab;
  transition: background-color 0.2s;
  font-size: 0.875rem;
  gap: 0.5rem;
}

.mapping-field:hover {
  background-color: #f3f4f6;
}

.mapping-field.dragging {
  opacity: 0.5;
  cursor: grabbing;
}

.mapping-field.selected {
  background-color: #dbeafe;
  border-left: 3px solid #3b82f6;
}

/* Expand/Collapse Button */
.expand-button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  font-size: 0.75rem;
  flex-shrink: 0;
}

.expand-button:hover {
  color: #3b82f6;
}

.expand-spacer {
  width: 16px;
  flex-shrink: 0;
}

/* Field Icon */
.field-icon {
  font-size: 1rem;
  flex-shrink: 0;
}

/* Field Name */
.field-name {
  font-weight: 500;
  color: #1f2937;
  flex-shrink: 0;
}

/* Field Type Badge */
.field-type {
  font-size: 0.75rem;
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  background-color: #e5e7eb;
  color: #6b7280;
  flex-shrink: 0;
}

/* Field Sample Value */
.field-sample {
  font-size: 0.75rem;
  color: #9ca3af;
  font-family: monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

/* Field Children Container */
.field-children {
  margin-left: 0;
}

/* Loading State */
.mapping-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  color: #6b7280;
}

.mapping-loading.hidden {
  display: none;
}

/* Empty State */
.mapping-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  text-align: center;
  color: #6b7280;
}

.mapping-empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

/* Connection Lines (SVG) */
.mapping-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.mapping-line {
  stroke: #3b82f6;
  stroke-width: 2;
  fill: none;
  cursor: pointer;
  pointer-events: stroke;
}

.mapping-line:hover {
  stroke: #2563eb;
  stroke-width: 3;
}

.mapping-line.selected {
  stroke: #1d4ed8;
  stroke-width: 3;
}

/* Target Panel Styles */
.mapping-target-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.add-field-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background-color: #3b82f6;
  color: white;
  border: none;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
}

.add-field-button:hover {
  background-color: #2563eb;
}

/* Preview Panel Styles */
.mapping-preview-panel {
  margin-top: 1rem;
  border-top: 1px solid #e5e7eb;
  padding-top: 1rem;
}

.mapping-preview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.mapping-preview-section {
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  padding: 0.75rem;
}

.mapping-preview-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 0.5rem;
}

.mapping-preview-content {
  font-family: monospace;
  font-size: 0.75rem;
  background-color: #f9fafb;
  padding: 0.5rem;
  border-radius: 0.25rem;
  overflow-x: auto;
  max-height: 200px;
  overflow-y: auto;
}

/* Transformation Selector Styles */
.transformation-selector {
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  background-color: #f9fafb;
}

.transformation-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.transformation-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  background-color: #dbeafe;
  color: #1e40af;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: 500;
}

.transformation-chip button {
  background: none;
  border: none;
  color: #1e40af;
  cursor: pointer;
  padding: 0;
  margin-left: 0.25rem;
  font-size: 1rem;
  line-height: 1;
}

.transformation-chip button:hover {
  color: #1e3a8a;
}

/* Target Panel Styles */
.target-field {
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  margin: 0.5rem;
  padding: 0.75rem;
}

.target-field.drag-over {
  border-color: #3b82f6;
  background-color: #dbeafe;
}

.field-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.field-name-input {
  flex: 1;
  padding: 0.25rem 0.5rem;
  border: 1px solid #d1d5db;
  border-radius: 0.25rem;
  font-size: 0.875rem;
}

.field-type-select {
  padding: 0.25rem 0.5rem;
  border: 1px solid #d1d5db;
  border-radius: 0.25rem;
  font-size: 0.875rem;
}

.remove-field-btn {
  width: 1.5rem;
  height: 1.5rem;
  color: #ef4444;
  background: none;
  border: none;
  border-radius: 0.25rem;
  cursor: pointer;
}

.remove-field-btn:hover {
  background-color: #fee2e2;
}

.drop-zone {
  text-align: center;
  padding: 1rem;
  color: #6b7280;
  font-size: 0.875rem;
  border: 2px dashed #d1d5db;
  border-radius: 0.375rem;
}

.add-field-btn {
  width: calc(100% - 1rem);
  margin: 0.5rem;
  padding: 0.5rem;
  border: 2px dashed #d1d5db;
  background: none;
  color: #6b7280;
  border-radius: 0.375rem;
  cursor: pointer;
}

.add-field-btn:hover {
  border-color: #3b82f6;
  color: #3b82f6;
}

/* Preview Panel */
.preview-panel {
  border-top: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  height: 16rem;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  border-bottom: 1px solid #e5e7eb;
  background-color: #f9fafb;
}

.preview-content {
  display: flex;
  flex: 1;
}

.preview-input, .preview-output {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.preview-input {
  border-right: 1px solid #e5e7eb;
}

.json-preview {
  flex: 1;
  padding: 0.75rem;
  font-size: 0.75rem;
  font-family: monospace;
  background-color: #f9fafb;
  overflow: auto;
}

/* Transformation Modal */
.transformation-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal-content {
  background-color: white;
  border-radius: 0.5rem;
  padding: 1.5rem;
  max-width: 28rem;
  width: 100%;
  margin: 1rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
}

.transformation-select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .mapping-container {
    grid-template-columns: 1fr;
    height: auto;
  }

  .mapping-preview-grid {
    grid-template-columns: 1fr;
  }

  .mapping-panels {
    flex-direction: column;
  }

  .source-panel, .target-panel {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid #e5e7eb;
  }
}

/* Scrollbar Styling */
.mapping-panel::-webkit-scrollbar,
.mapping-field-list::-webkit-scrollbar,
.mapping-preview-content::-webkit-scrollbar {
  width: 8px;
}

.mapping-panel::-webkit-scrollbar-track,
.mapping-field-list::-webkit-scrollbar-track,
.mapping-preview-content::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.mapping-panel::-webkit-scrollbar-thumb,
.mapping-field-list::-webkit-scrollbar-thumb,
.mapping-preview-content::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.mapping-panel::-webkit-scrollbar-thumb:hover,
.mapping-field-list::-webkit-scrollbar-thumb:hover,
.mapping-preview-content::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}
