/* src/tools/json-converter/tool.css */

.json-conv-root {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  font-family: inherit;
  color: #f0f2f8;
}

/* Tabs Bar */
.format-tabs-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border-bottom: 1px solid #2a2d3a;
  padding-bottom: 0.25rem;
}

.format-tabs {
  display: flex;
  gap: 0.25rem;
}

.fmt-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: #9ca3af;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  border-radius: 0.375rem 0.375rem 0 0;
}

.fmt-tab-btn:hover {
  color: #f0f2f8;
  background: rgba(255, 255, 255, 0.03);
}

.fmt-tab-btn.active {
  color: #4f8ef7;
  border-bottom-color: #4f8ef7;
  background: rgba(79, 142, 247, 0.06);
}

.tab-icon {
  font-size: 1rem;
}

.quick-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.action-btn {
  font-size: 0.75rem;
  padding: 0.35rem 0.65rem;
  border-radius: 0.375rem;
  background: #1a1d27;
  border: 1px solid #2a2d3a;
  color: #9ca3af;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.action-btn:hover {
  color: #f0f2f8;
  border-color: #3b4054;
  background: #202433;
}

/* Options Bar */
.options-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: #13161f;
  border: 1px solid #2a2d3a;
  border-radius: 0.5rem;
  padding: 0.625rem 0.875rem;
  font-size: 0.8125rem;
}

.options-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.opt-inline-group {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}

.opt-label {
  font-size: 0.75rem;
  color: #9ca3af;
}

.opt-select, .opt-input {
  background: #0f1117;
  border: 1px solid #2a2d3a;
  border-radius: 0.375rem;
  color: #f0f2f8;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s ease;
}

.opt-select:focus, .opt-input:focus {
  border-color: #4f8ef7;
}

.opt-check-label {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  cursor: pointer;
  color: #d1d5db;
  font-size: 0.75rem;
  user-select: none;
}

.opt-checkbox {
  border-radius: 0.25rem;
  border: 1px solid #2a2d3a;
  background: #0f1117;
  accent-color: #4f8ef7;
  cursor: pointer;
}

/* Status Alert */
.status-alert {
  font-size: 0.75rem;
  border-radius: 0.5rem;
  padding: 0.625rem 0.875rem;
  background: rgba(127, 29, 29, 0.3);
  border: 1px solid #991b1b;
  color: #fca5a5;
  font-family: 'JetBrains Mono', monospace;
  line-height: 1.4;
}

/* IO Grid */
.io-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 768px) {
  .io-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.io-panel {
  display: flex;
  flex-direction: column;
  background: #13161f;
  border: 1px solid #2a2d3a;
  border-radius: 0.75rem;
  overflow: hidden;
}

.io-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: #1a1d27;
  border-bottom: 1px solid #2a2d3a;
  font-size: 0.8125rem;
}

.panel-title {
  font-weight: 600;
  color: #f0f2f8;
}

.badge-tag {
  font-size: 0.6875rem;
  font-family: 'JetBrains Mono', monospace;
  padding: 0.125rem 0.375rem;
  background: #1e3a6e;
  color: #93c5fd;
  border-radius: 0.25rem;
}

.panel-btn {
  font-size: 0.75rem;
  padding: 0.25rem 0.6rem;
  border-radius: 0.375rem;
  background: #1a1d27;
  border: 1px solid #2a2d3a;
  color: #9ca3af;
  cursor: pointer;
  transition: all 0.15s ease;
}

.panel-btn:hover {
  color: #f0f2f8;
  border-color: #3b4054;
}

.panel-btn.primary {
  background: rgba(79, 142, 247, 0.2);
  border-color: rgba(79, 142, 247, 0.4);
  color: #93c5fd;
  font-weight: 500;
}

.panel-btn.primary:hover {
  background: rgba(79, 142, 247, 0.3);
  color: #ffffff;
}

.panel-btn.copied {
  background: rgba(34, 197, 94, 0.2);
  border-color: rgba(34, 197, 94, 0.4);
  color: #86efac;
}

.textarea-wrapper {
  position: relative;
  flex: 1;
  display: flex;
}

.io-textarea {
  width: 100%;
  min-height: 280px;
  background: #0f1117;
  border: none;
  padding: 0.75rem;
  color: #f0f2f8;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8125rem;
  line-height: 1.5;
  resize: vertical;
  outline: none;
  white-space: pre;
}

.io-textarea:focus {
  outline: none;
}

.drag-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 17, 23, 0.85);
  border: 2px dashed #4f8ef7;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #4f8ef7;
  font-weight: 600;
  font-size: 0.9375rem;
  z-index: 10;
  backdrop-filter: blur(2px);
}

/* Excel Download Bar */
.excel-download-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  background: #13161f;
  border: 1px solid #2a2d3a;
  border-radius: 0.5rem;
  padding: 0.625rem 0.875rem;
}

.sub-action-btn {
  font-size: 0.75rem;
  padding: 0.35rem 0.75rem;
  border-radius: 0.375rem;
  background: #1a1d27;
  border: 1px solid #2a2d3a;
  color: #d1d5db;
  cursor: pointer;
  transition: all 0.15s ease;
}

.sub-action-btn:hover {
  background: #202433;
  color: #f0f2f8;
  border-color: #4f8ef7;
}

.sub-action-btn.primary {
  background: #1e3a6e;
  border-color: #2b549e;
  color: #93c5fd;
  font-weight: 600;
}

.sub-action-btn.primary:hover {
  background: #274b8e;
  color: #ffffff;
}

/* Table Preview Section */
.preview-section {
  display: flex;
  flex-direction: column;
  background: #13161f;
  border: 1px solid #2a2d3a;
  border-radius: 0.75rem;
  overflow: hidden;
}

.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 0.875rem;
  background: #1a1d27;
  border-bottom: 1px solid #2a2d3a;
}

.table-scroll-container {
  overflow-x: auto;
  max-height: 350px;
  overflow-y: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
  text-align: left;
}

.data-table th {
  background: #161923;
  color: #9ca3af;
  font-weight: 600;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #2a2d3a;
  border-right: 1px solid #222634;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 2;
}

.data-table th:last-child {
  border-right: none;
}

.data-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #1f222e;
  border-right: 1px solid #1f222e;
  color: #e5e7eb;
  white-space: nowrap;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
}

.data-table td:last-child {
  border-right: none;
}

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Light mode overrides */
html.light .json-conv-root {
  color: #0f1117;
}

html.light .format-tabs-bar {
  border-bottom-color: #e5e7eb;
}

html.light .fmt-tab-btn {
  color: #4b5563;
}

html.light .fmt-tab-btn:hover {
  color: #111827;
  background: rgba(0, 0, 0, 0.03);
}

html.light .fmt-tab-btn.active {
  color: #2563eb;
  border-bottom-color: #2563eb;
  background: rgba(37, 99, 235, 0.06);
}

html.light .action-btn {
  background: #ffffff;
  border-color: #e5e7eb;
  color: #4b5563;
}

html.light .action-btn:hover {
  background: #f9fafb;
  color: #111827;
  border-color: #d1d5db;
}

html.light .options-bar,
html.light .io-panel,
html.light .excel-download-bar,
html.light .preview-section {
  background: #ffffff;
  border-color: #e5e7eb;
}

html.light .io-header,
html.light .preview-header {
  background: #f9fafb;
  border-bottom-color: #e5e7eb;
}

html.light .panel-title {
  color: #111827;
}

html.light .badge-tag {
  background: #dbeafe;
  color: #1e40af;
}

html.light .opt-select,
html.light .opt-input,
html.light .io-textarea {
  background: #f8fafc;
  border-color: #e2e8f0;
  color: #0f1117;
}

html.light .io-textarea {
  border: none;
}

html.light .opt-label,
html.light .opt-check-label {
  color: #4b5563;
}

html.light .panel-btn,
html.light .sub-action-btn {
  background: #ffffff;
  border-color: #e5e7eb;
  color: #4b5563;
}

html.light .panel-btn:hover,
html.light .sub-action-btn:hover {
  background: #f3f4f6;
  color: #111827;
}

html.light .sub-action-btn.primary {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

html.light .data-table th {
  background: #f1f5f9;
  color: #475569;
  border-bottom-color: #e2e8f0;
  border-right-color: #e2e8f0;
}

html.light .data-table td {
  border-bottom-color: #f1f5f9;
  border-right-color: #f1f5f9;
  color: #1e293b;
}

html.light .data-table tr:hover td {
  background: #f8fafc;
}
