/* JSON Minifier Standard Stylesheet */

:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-card: #ffffff;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --border-hover: #cbd5e1;
  --accent-color: #4f46e5;
  --accent-hover: #4338ca;
  --accent-light: #eeef2a1a;
  --success-color: #10b981;
  --success-bg: #ecfdf5;
  --success-text: #047857;
  --error-color: #ef4444;
  --error-bg: #fef2f2;
  --error-text: #b91c1c;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

html[data-theme="dark"] {
  --bg-primary: #0c111b;
  --bg-secondary: #161e2e;
  --bg-card: #111827;
  --text-primary: #e8edf6;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border-color: #1f2937;
  --border-hover: #374151;
  --accent-color: #6366f1;
  --accent-hover: #4f46e5;
  --accent-light: rgba(99, 102, 241, 0.15);
  --success-color: #10b981;
  --success-bg: rgba(16, 185, 129, 0.12);
  --success-text: #34d399;
  --error-color: #f87171;
  --error-bg: rgba(239, 68, 68, 0.12);
  --error-text: #fca5a5;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
}

html[data-theme="dark"] body {
  background-color: #0c111b !important;
  color: #e8edf6 !important;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  font-size: 14px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* App Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--bg-card);
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-brand strong {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  display: block;
}

.app-brand small {
  font-size: 12px;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.local-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--success-text);
  background-color: var(--success-bg);
  padding: 4px 10px;
  border-radius: 9999px;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.local-pill span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--success-color);
}

.icon-button {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  transition: all 0.15s ease;
}

.icon-button:hover {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.icon-button:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

/* Main Workspace */
.workspace {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
}

/* Toolbar */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.mode-switch {
  display: inline-flex;
  background-color: var(--bg-secondary);
  padding: 3px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.mode-switch button {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.mode-switch button.active {
  background-color: var(--bg-card);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.mode-switch button:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 1px;
}

.action-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Buttons */
.button {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background-color: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.button:hover:not(:disabled) {
  border-color: var(--border-hover);
  background-color: var(--bg-secondary);
}

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

.button:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

.button.primary {
  background-color: var(--accent-color);
  color: #ffffff;
  border-color: var(--accent-color);
}

.button.primary:hover:not(:disabled) {
  background-color: var(--accent-hover);
  border-color: var(--accent-hover);
}

.button.secondary {
  background-color: var(--bg-secondary);
  border-color: var(--border-color);
}

.button.quiet {
  background: transparent;
  border-color: transparent;
  color: var(--text-secondary);
}

.button.quiet:hover:not(:disabled) {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
}

.button.small {
  font-size: 12px;
  padding: 4px 10px;
}

.text-button {
  background: none;
  border: none;
  color: var(--accent-color);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.text-button:hover {
  text-decoration: underline;
}

/* Editor Grid */
.editor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 900px) {
  .editor-grid {
    grid-template-columns: 1fr;
  }
}

.editor-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
}

.card-heading > div:first-child {
  display: flex;
  align-items: center;
  gap: 8px;
}

.step {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-color);
  background-color: var(--accent-light);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.card-heading label {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
}

.output-actions-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

textarea {
  width: 100%;
  padding: 12px;
  border: none;
  background-color: var(--bg-card);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
  min-height: 220px;
  outline: none;
}

textarea:focus {
  background-color: var(--bg-primary);
}

.editor-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  border-top: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
  font-size: 12px;
  color: var(--text-muted);
}

/* Badges */
.badge-neutral {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 9999px;
  background-color: var(--bg-primary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.badge-valid {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 9999px;
  background-color: var(--success-bg);
  color: var(--success-text);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-error {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 9999px;
  background-color: var(--error-bg);
  color: var(--error-text);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Error message box */
.error-message {
  background-color: var(--error-bg);
  color: var(--error-text);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 13px;
  font-family: var(--font-mono);
  white-space: pre-wrap;
}

/* Diagnostics strip */
.metric-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  box-shadow: var(--shadow-sm);
}

.metric-strip article {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.metric-strip span {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.metric-strip strong {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

/* Files Mode Dropzone */
.drop-zone {
  border: 2px dashed var(--border-hover);
  border-radius: var(--radius-lg);
  padding: 36px 20px;
  text-align: center;
  background-color: var(--bg-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--accent-color);
  background-color: var(--accent-light);
}

.drop-zone:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

.drop-zone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.drop-icon {
  font-size: 32px;
  margin-bottom: 4px;
}

.drop-zone-content strong {
  font-size: 16px;
  color: var(--text-primary);
}

.drop-zone-content p {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

/* Files Table */
.files-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
}

.eyebrow {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
  display: block;
}

.section-heading h2 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.table-wrap {
  overflow-x: auto;
}

.files-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

.files-table th {
  background-color: var(--bg-secondary);
  color: var(--text-muted);
  font-weight: 600;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.files-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
}

.files-table tr:last-child td {
  border-bottom: none;
}

.files-table tr:hover {
  background-color: var(--bg-secondary);
}

.files-table .actions-cell {
  display: flex;
  gap: 6px;
}

/* Privacy Footer Strip */
.privacy-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 12px;
  color: var(--text-secondary);
}

.privacy-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background-color: #0f172a;
  color: #ffffff;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  z-index: 1000;

  &:where([hidden]) {
    display: none;
  }
}

html[data-theme="dark"] .toast {
  background-color: #f8fafc;
  color: #0f172a;
}

/* Dialog */
.context-dialog {
  border: none;
  border-radius: var(--radius-lg);
  background: transparent;
  padding: 0;
  max-width: 640px;
  width: 90vw;
  margin: auto;
}

.context-dialog::backdrop {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
}

.dialog-shell {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--shadow-md);
}

.dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.dialog-heading h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Guided Mode Highlight */
.dth-guide-highlight {
  outline: 3px solid var(--accent-color) !important;
  outline-offset: 2px !important;
  box-shadow: 0 0 12px var(--accent-light) !important;
}

/* Focus Visible */
:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}
