/**
 * JSON Diff & Text Comparator Stylesheet
 * Aethvion Labs - Text & Code Tools Section
 * Premium dark cybernetic theme with clean layout overlays.
 */

.diff-tool {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 10px;
}

/* Header/Controls Bar */
.workspace-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 15px;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(0, 240, 255, 0.1);
  padding: 10px 15px;
  border-radius: 8px;
}

.workspace-header-bar .control-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.workspace-header-bar label {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.7);
}

.cyber-select {
  background: rgba(10, 15, 30, 0.8);
  border: 1px solid rgba(0, 240, 255, 0.2);
  color: #fff;
  padding: 6px 12px;
  border-radius: 4px;
  outline: none;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.cyber-select:focus,
.cyber-select:hover {
  border-color: #00F0FF;
  box-shadow: 0 0 8px rgba(0, 240, 255, 0.15);
}

.layout-toggle-group {
  display: flex;
  border: 1px solid rgba(0, 240, 255, 0.2);
  border-radius: 6px;
  overflow: hidden;
}

.layout-toggle-group .cyber-btn {
  border: none;
  border-radius: 0;
  border-right: 1px solid rgba(0, 240, 255, 0.2);
}

.layout-toggle-group .cyber-btn:last-child {
  border-right: none;
}

.layout-toggle-group .cyber-btn.active {
  background: rgba(0, 240, 255, 0.2);
  color: #00F0FF;
  text-shadow: 0 0 5px rgba(0, 240, 255, 0.5);
}

/* Inputs Columns Layout */
.diff-inputs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

.input-card {
  display: flex;
  flex-direction: column;
  background: rgba(11, 15, 25, 0.6);
  border: 1px solid rgba(0, 240, 255, 0.15);
  border-radius: 8px;
  overflow: hidden;
}

.input-card .card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(15, 23, 42, 0.8);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 8px 12px;
  font-family: 'Orbitron', monospace;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.6);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.clear-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.6);
  padding: 2px 8px;
  font-size: 0.7rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.clear-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.3);
  color: #fff;
}

.input-card textarea {
  height: 250px;
  background: transparent;
  border: none;
  resize: vertical;
  outline: none;
  color: #e2e8f0;
  font-family: 'Consolas', 'Monaco', 'Courier New', Courier, monospace;
  font-size: 0.9rem;
  line-height: 1.5;
  padding: 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 240, 255, 0.2) rgba(0, 0, 0, 0.2);
}

.input-card textarea::placeholder {
  color: rgba(255, 255, 255, 0.25);
  font-style: italic;
}

/* Action Trigger row */
.action-trigger-row {
  display: flex;
  justify-content: center;
}

.action-trigger-row .cyber-btn.large {
  min-width: 200px;
  padding: 12px 24px;
}

/* Output Area Wrapper */
.diff-output-wrapper {
  display: flex;
  flex-direction: column;
  gap: 15px;
  background: rgba(11, 15, 25, 0.5);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(0, 240, 255, 0.15);
  border-radius: 8px;
  padding: 15px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.diff-output-wrapper.hidden {
  display: none;
}

/* Metrics Summary panel */
.diff-summary-panel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 10px;
}

.summary-title {
  margin: 0;
  font-family: 'Orbitron', sans-serif;
  font-size: 1rem;
  color: #fff;
  letter-spacing: 0.05em;
}

.diff-metrics-indicators {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.metric-badge {
  font-size: 0.8rem;
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid transparent;
  font-weight: 500;
}

.badge-added {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.3);
  color: #4ade80;
}

.badge-deleted {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.3);
  color: #f87171;
}

.badge-matching {
  background: rgba(0, 240, 255, 0.08);
  border-color: rgba(0, 240, 255, 0.2);
  color: #00F0FF;
}

/* Diff Viewport Stage */
.diff-viewport-container {
  display: grid;
  height: 450px;
  gap: 15px;
  overflow: hidden;
}

.diff-viewport-container.split-view {
  grid-template-columns: 1fr 1fr;
}

.diff-viewport-container.unified-view {
  grid-template-columns: 1fr;
}

.diff-viewport-container.unified-view .pane-original,
.diff-viewport-container.unified-view .pane-modified {
  display: none;
}

/* Individual Output Panes */
.diff-output-pane {
  display: flex;
  flex-direction: column;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  overflow: hidden;
}

.diff-output-pane.hidden {
  display: none;
}

.diff-output-pane .pane-title {
  background: rgba(15, 23, 42, 0.6);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding: 6px 12px;
  font-family: 'Orbitron', monospace;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.4);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.diff-pre-container {
  display: flex;
  flex: 1;
  overflow-y: auto;
  font-family: 'Consolas', 'Monaco', 'Courier New', Courier, monospace;
  font-size: 0.85rem;
  line-height: 1.6;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 240, 255, 0.2) rgba(0, 0, 0, 0.2);
}

/* Gutter numbers and Contents container */
.line-numbers {
  width: 45px;
  padding: 10px 0;
  text-align: right;
  background: rgba(0, 0, 0, 0.2);
  color: rgba(255, 255, 255, 0.25);
  border-right: 1px solid rgba(255, 255, 255, 0.03);
  user-select: none;
  font-weight: 500;
}

.line-contents {
  flex: 1;
  padding: 10px 0;
  white-space: pre;
  overflow-x: auto;
}

.line-numbers span,
.line-contents span {
  display: block;
  min-height: 1.6em;
  padding: 0 10px;
}

/* Highlights rules */
.diff-line-equal {
  color: #94a3b8;
}

.diff-line-delete {
  background: rgba(239, 68, 68, 0.16) !important;
  color: #fca5a5;
  border-left: 2px solid #ef4444;
  position: relative;
}

.diff-line-delete::before {
  content: "-";
  position: absolute;
  left: 2px;
  color: #ef4444;
  font-weight: bold;
}

.diff-line-insert {
  background: rgba(34, 197, 94, 0.16) !important;
  color: #86efac;
  border-left: 2px solid #22c55e;
  position: relative;
}

.diff-line-insert::before {
  content: "+";
  position: absolute;
  left: 2px;
  color: #22c55e;
  font-weight: bold;
}

.diff-line-placeholder {
  background: rgba(255, 255, 255, 0.02) !important;
  color: transparent !important;
  user-select: none;
}

/* Unified Mode gutter style overrides */
.pane-unified .line-numbers {
  width: 90px;
  display: flex;
}

.pane-unified .line-numbers .col-num {
  width: 45px;
  display: inline-block;
  padding: 0 8px;
}

.pane-unified .line-numbers .col-num:first-child {
  border-right: 1px solid rgba(255, 255, 255, 0.03);
}

/* Scrollbar rules */
.diff-pre-container::-webkit-scrollbar,
.line-contents::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.diff-pre-container::-webkit-scrollbar-track,
.line-contents::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}

.diff-pre-container::-webkit-scrollbar-thumb,
.line-contents::-webkit-scrollbar-thumb {
  background: rgba(0, 240, 255, 0.2);
  border-radius: 3px;
}

.diff-pre-container::-webkit-scrollbar-thumb:hover,
.line-contents::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 240, 255, 0.4);
}

/* Info layout elements */
@media (max-width: 800px) {
  .diff-inputs-grid {
    grid-template-columns: 1fr;
  }
  
  .diff-viewport-container.split-view {
    grid-template-columns: 1fr;
    height: 600px;
  }
  
  .workspace-header-bar {
    flex-direction: column;
    align-items: stretch;
  }
  
  .layout-toggle-group {
    justify-content: center;
  }
}
