/* ============================================
   Tool Component Styles - Data Exploration Optimized
   Compact, efficient styling for data tools
   ============================================ */

.tool-component-wrapper {
  width: 100% !important;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  padding: 1rem;
  box-sizing: border-box;
}

.tool-container {
  width: 100% !important;
  max-width: 100%;
  margin: 0;
  background: var(--color-bg);
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.tool-header {
  margin-bottom: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--color-border);
}

.tool-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.25rem;
  color: var(--color-primary);
  margin-bottom: 0.25rem;
  font-weight: var(--font-weight-medium);
}

.tool-icon {
  font-size: 1.125rem;
}

.tool-description {
  color: var(--color-text-muted);
  font-size: 0.875rem;
  line-height: 1.4;
}

.tool-content {
  margin-top: 0.5rem;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  width: 100% !important;
}

.tool-status {
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.75rem;
  font-size: 0.8125rem;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.tool-status.status-info {
  background: rgba(74, 158, 255, 0.08);
  color: var(--color-primary-light);
  border: 1px solid rgba(74, 158, 255, 0.2);
}

.tool-status.status-success {
  background: rgba(16, 185, 129, 0.08);
  color: var(--color-success);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.tool-status.status-warning {
  background: rgba(245, 158, 11, 0.08);
  color: var(--color-warning);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.tool-status.status-error {
  background: rgba(239, 68, 68, 0.08);
  color: var(--color-danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Compact Button Styles */
.btn-tool {
  padding: 0.5rem 0.875rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg-light);
  color: var(--color-text);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  transition: all var(--transition-base);
  font-size: 0.8125rem;
  line-height: 1.4;
}

.btn-tool:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-bg-card);
}

.btn-tool.btn-primary {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

.btn-tool.btn-primary:hover {
  background: var(--color-primary-dark);
}

.btn-tool.btn-secondary {
  background: var(--color-bg-light);
  color: var(--color-text);
}

.btn-tool:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Compact Section Styles */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  gap: 0.75rem;
}

.section-header h3 {
  color: var(--color-text);
  font-size: 0.9375rem;
  font-weight: var(--font-weight-medium);
  margin: 0;
}

.section-actions {
  display: flex;
  gap: 0.375rem;
  flex-shrink: 0;
}

/* Form Elements - Compact */
.tool-label {
  display: block;
  margin-bottom: 0.375rem;
  font-weight: var(--font-weight-medium);
  color: var(--color-text);
  font-size: 0.8125rem;
}

.tool-input,
.tool-textarea,
.tool-select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background-color: var(--color-bg-light);
  color: var(--color-text);
  font-size: 0.875rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  font-family: inherit;
}

.tool-input:focus,
.tool-textarea:focus,
.tool-select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(74, 158, 255, 0.1);
  outline: none;
}

.tool-textarea {
  resize: vertical;
  min-height: 120px;
  font-family: 'Courier New', monospace;
  line-height: 1.5;
}

/* CSV to JSON Tool - Optimized Layout */
.tojson-tool-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  flex: 1;
  min-height: 400px;
  align-items: stretch;
}

.tojson-input-section,
.tojson-output-section {
  display: flex;
  flex-direction: column;
  background: var(--color-bg-light);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  gap: 0.5rem;
  min-height: 0;
  flex: 1;
}

.csv-input,
.json-output {
  flex: 1;
  width: 100%;
  min-height: 200px;
  padding: 0.625rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-family: 'Courier New', monospace;
  font-size: 0.8125rem;
  resize: vertical;
  line-height: 1.5;
  box-sizing: border-box;
}

.csv-input:focus,
.json-output:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(74, 158, 255, 0.1);
}

.json-output {
  background: var(--color-bg-light);
  cursor: default;
}

/* File Upload Areas - Compact */
.upload-area {
  padding: 1.5rem;
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-md);
  text-align: center;
  background: var(--color-bg-light);
  transition: all var(--transition-base);
  cursor: pointer;
}

.upload-area:hover,
.upload-area.drag-over {
  border-color: var(--color-primary);
  background: rgba(74, 158, 255, 0.05);
}

.upload-area p {
  color: var(--color-text-muted);
  font-size: 0.875rem;
  margin-bottom: 0.75rem;
}

.file-list {
  margin-top: 0.75rem;
  font-size: 0.8125rem;
}

.file-list ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.file-list li {
  padding: 0.375rem 0.5rem;
  background: var(--color-bg-light);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  margin-bottom: 0.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

/* Actions Section - Compact */
.actions-section {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

.config-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.config-row {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

/* Output Sections */
.output-section {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: var(--color-bg-light);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.result-info {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  line-height: 1.6;
}

.result-info p {
  margin-bottom: 0.25rem;
}

.result-info strong {
  color: var(--color-text);
}

/* Chart Container */
.chart-container {
  margin-top: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* Responsive */
@media (max-width: 1024px) {
  .tojson-tool-container {
    grid-template-columns: 1fr;
    height: auto;
    min-height: auto;
  }

  .csv-input,
  .json-output {
    min-height: 250px;
  }
}

@media (max-width: 768px) {
  .tool-component-wrapper {
    padding: 0.5rem;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .section-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .btn-tool {
    flex: 1;
    min-width: 100px;
  }

  .tojson-tool-container {
    gap: 0.5rem;
  }

  .tojson-input-section,
  .tojson-output-section {
    padding: 0.5rem;
  }
}

/* ============================================
   MODAL STYLES
   ============================================ */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  backdrop-filter: blur(4px);
}

.modal-content {
  background: #1a1a2e;
  border: 1px solid #3d3d5c;
  border-radius: 12px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #2d2d44;
  background: linear-gradient(135deg, #0f0f1a 0%, #1a1a2e 100%);
  border-radius: 12px 12px 0 0;
}

.modal-header h3 {
  margin: 0;
  color: #00d4ff;
  font-size: 1.25rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: #888;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.2s ease;
}

.modal-close:hover {
  color: #ff6b6b;
}

.modal-body {
  padding: 1.5rem;
  color: #e0e0e0;
  line-height: 1.6;
}

.modal-body h4 {
  color: #00d4ff;
  margin: 1.25rem 0 0.75rem 0;
  font-size: 1rem;
  font-weight: 600;
}

.modal-body h4:first-child {
  margin-top: 0;
}

.modal-body p {
  margin: 0 0 1rem 0;
  color: #c0c0c0;
}

.modal-body ul {
  margin: 0 0 1rem 0;
  padding-left: 1.5rem;
}

.modal-body li {
  margin-bottom: 0.5rem;
  color: #c0c0c0;
}

.modal-body li strong {
  color: #e0e0e0;
}

.modal-body code {
  background: #0f0f1a;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-family: 'Fira Code', 'Consolas', monospace;
  font-size: 0.85em;
  color: #ffd93d;
}

/* Help button style */
.btn-help {
  background: rgba(0, 212, 255, 0.1);
  border: 1px solid #3d3d5c;
  color: #00d4ff;
}

.btn-help:hover {
  background: rgba(0, 212, 255, 0.2);
  border-color: #00d4ff;
}
