/* JSON Formatter — app-specific styles.
   Inherits design tokens from ../styles.css. This file adds the split-editor
   layout and dark VS Code-style panels. */

/* Full-bleed: fill the viewport between the nav chrome and footer. */
body.shell main {
  padding: 0;
  overflow: hidden;
}

/* ── Two-column workspace ─────────────────────────────────────── */
.app-workspace {
  display: flex;
  height: 100%;
  overflow: hidden;
}
.app-workspace.dragover::after {
  content: 'Drop .json file here';
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center;
  font-size: 22px; font-weight: 700; color: #9cdcfe;
  background: rgba(16, 18, 28, 0.82);
  pointer-events: none;
}

/* ── Panel ────────────────────────────────────────────────────── */
.panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  background: #1e1e1e;
}
.panel + .panel {
  border-left: 2px solid #181818;
}

/* ── Panel header row ─────────────────────────────────────────── */
.panel-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  background: #2d2d2d;
  border-bottom: 1px solid #3c3c3c;
  flex-shrink: 0;
  flex-wrap: wrap;
  min-height: 44px;
}
.panel-label {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #858585;
  flex-shrink: 0;
  padding-right: 4px;
}
.panel-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
/* Push validation badge to the right */
.val-badge { margin-left: auto; }

/* ── Toolbar buttons ──────────────────────────────────────────── */
.tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 5px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: #cccccc;
  background: #3c3c3c;
  border: 1px solid #555;
  cursor: pointer;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
  white-space: nowrap;
}
.tool-btn svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}
.tool-btn:hover { background: #4c4c4c; color: #fff; border-color: #666; }
.tool-btn:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--accent); }
.tool-btn:active { transform: translateY(1px); }
.tool-btn-ghost {
  background: transparent;
  border-color: transparent;
  color: #666;
}
.tool-btn-ghost:hover { background: #3c3c3c; color: #ccc; border-color: #555; }

/* ── Validation badge (inside panel header) ───────────────────── */
.val-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  color: #555;
  flex-shrink: 0;
}
.val-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #444;
  transition: background 0.2s;
}
.val-badge.valid   { color: #4ec9b0; }
.val-badge.valid   .val-dot { background: #4ec9b0; box-shadow: 0 0 0 3px rgba(78,201,176,.2); }
.val-badge.invalid { color: #f87171; }
.val-badge.invalid .val-dot { background: #f87171; box-shadow: 0 0 0 3px rgba(248,113,113,.2); }

/* ── Format tools strip (below input header) ──────────────────── */
.fmt-tools {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 5px 10px;
  background: #252526;
  border-bottom: 1px solid #333;
  flex-shrink: 0;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: #444 transparent;
}
.fmt-tools::-webkit-scrollbar { height: 4px; }
.fmt-tools::-webkit-scrollbar-thumb { background: #444; border-radius: 2px; }
.fmt-tool-btn {
  padding: 3px 8px;
  border-radius: 4px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  color: #9cdcfe;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
}
.fmt-tool-btn:hover  { background: #3c3c3c; border-color: #555; color: #fff; }
.fmt-tool-btn:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--accent); }
.fmt-tool-btn:active { transform: translateY(1px); }
.fmt-tool-sep {
  width: 1px;
  height: 14px;
  background: #444;
  margin: 0 2px;
  flex-shrink: 0;
}

/* ── Validation error bar ─────────────────────────────────────── */
.val-bar {
  display: none;
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 600;
  color: #f87171;
  background: rgba(248,113,113,.08);
  border-top: 1px solid rgba(248,113,113,.2);
  flex-shrink: 0;
  min-height: 0;
}
.val-bar.show { display: block; }

/* ── Output format pills ──────────────────────────────────────── */
.format-pills {
  display: flex;
  gap: 4px;
  padding: 7px 10px;
  background: #252526;
  border-bottom: 1px solid #333;
  flex-shrink: 0;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: #444 transparent;
}
.format-pills::-webkit-scrollbar { height: 4px; }
.format-pills::-webkit-scrollbar-thumb { background: #444; border-radius: 2px; }
.fmt-pill {
  padding: 4px 10px;
  border-radius: 4px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: #9cdcfe;
  background: transparent;
  border: 1px solid #444;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
}
.fmt-pill:hover         { background: #3c3c3c; color: #fff; border-color: #666; }
.fmt-pill:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--accent); }
.fmt-pill.active        { background: var(--accent); color: #fff; border-color: transparent; }

/* ── Editor area ──────────────────────────────────────────────── */
.editor-wrap {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
}

.editor-fallback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  resize: none;
  border: none;
  padding: 14px 16px;
  font-family: 'Cascadia Code', 'Fira Code', 'Consolas', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.55;
  tab-size: 2;
  background: #1e1e1e;
  color: #d4d4d4;
  outline: none;
  overflow: auto;
}
.editor-fallback::placeholder { color: #555; }
.editor-fallback[readonly]    { color: #9cdcfe; }

/* ── Toast notification ───────────────────────────────────────── */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 14px);
  background: #2d2d2d;
  border: 1px solid #555;
  color: #d4d4d4;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 200;
  white-space: nowrap;
  max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ── Mobile — stack panels vertically ────────────────────────── */
@media (max-width: 720px) {
  body.shell          { height: auto; overflow: auto; }
  body.shell main     { overflow: visible; }
  .app-workspace      { flex-direction: column; height: auto; }
  .panel              { min-height: 52vh; }
  .panel + .panel     { border-left: none; border-top: 2px solid #181818; }
  .editor-wrap        { min-height: 240px; }
  .editor-fallback    { position: relative; height: 240px; min-height: 240px; }
}
