/* ============================================================
   JSON FORMATTER - Complete Stylesheet
   Scoped under .jf-app to avoid host page CSS conflicts
   ============================================================ */

.jf-app {
    /* Theme variables */
    --jf-bg-primary: #0f1117;
    --jf-bg-secondary: #161822;
    --jf-bg-tertiary: #1c1e2e;
    --jf-bg-card: #1e2032;
    --jf-bg-hover: #252840;
    --jf-bg-input: #12141f;
    --jf-border: #2a2d42;
    --jf-border-light: #353856;
    --jf-text-primary: #e8e9f0;
    --jf-text-secondary: #a0a3b8;
    --jf-text-muted: #6b6e85;
    --jf-accent: #6366f1;
    --jf-accent-light: #818cf8;
    --jf-accent-glow: rgba(99, 102, 241, 0.3);
    --jf-success: #22c55e;
    --jf-success-bg: rgba(34, 197, 94, 0.12);
    --jf-success-border: rgba(34, 197, 94, 0.3);
    --jf-danger: #ef4444;
    --jf-danger-bg: rgba(239, 68, 68, 0.12);
    --jf-danger-border: rgba(239, 68, 68, 0.3);
    --jf-warning: #f59e0b;
    --jf-warning-bg: rgba(245, 158, 11, 0.12);
    --jf-warning-border: rgba(245, 158, 11, 0.3);
    --jf-info: #06b6d4;
    --jf-info-bg: rgba(6, 182, 212, 0.12);
    --jf-info-border: rgba(6, 182, 212, 0.3);
    --jf-radius: 10px;
    --jf-radius-sm: 6px;
    --jf-radius-lg: 14px;
    --jf-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    --jf-transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --jf-font-mono: 'Consolas', 'Monaco', 'Courier New', monospace;

    /* Type colors */
    --jf-type-string: #a5d6ff;
    --jf-type-number: #ffb86c;
    --jf-type-boolean: #c792ea;
    --jf-type-null: #6b7280;
    --jf-type-key: #7ee787;

    /* Self-contained full-screen layout */
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    min-width: 100vw;
    min-height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    overflow: hidden;

    /* Reset inherited styles */
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--jf-text-primary);
    background: var(--jf-bg-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-align: left;
    direction: ltr;
    z-index: 1;
}

.jf-app *,
.jf-app *::before,
.jf-app *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.jf-app button {
    font-family: inherit;
    cursor: pointer;
}

.jf-app input,
.jf-app select,
.jf-app textarea {
    font-family: inherit;
}

.jf-app a {
    color: var(--jf-accent-light);
    text-decoration: none;
}

.jf-app code {
    font-family: var(--jf-font-mono);
    background: var(--jf-bg-input);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 12px;
    color: var(--jf-accent-light);
    border: 1px solid var(--jf-border);
}

/* ---------- App Layout ---------- */
.jf-app {
    display: flex;
    flex-direction: column;
}

/* ---------- Header ---------- */
.jf-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: var(--jf-bg-secondary);
    border-bottom: 1px solid var(--jf-border);
    flex-shrink: 0;
    z-index: 10;
    height: 56px;
    min-height: 56px;
    max-height: 56px;
}

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

.jf-logo-icon {
    color: var(--jf-accent-light);
    flex-shrink: 0;
}

.jf-header-left h1 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.3px;
    color: var(--jf-accent-light);
    line-height: 1.2;
}

.jf-header-right {
    display: flex;
    gap: 8px;
    align-items: center;
}

.jf-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 100px;
    background: var(--jf-accent-glow);
    color: var(--jf-accent-light);
    letter-spacing: 0.3px;
    text-transform: uppercase;
    line-height: 1.4;
    white-space: nowrap;
}

.jf-badge.jf-badge-outline {
    background: transparent;
    border: 1px solid var(--jf-border-light);
    color: var(--jf-text-secondary);
}

/* ---------- Toolbar ---------- */
.jf-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 20px;
    background: var(--jf-bg-tertiary);
    border-bottom: 1px solid var(--jf-border);
    flex-shrink: 0;
    gap: 12px;
    flex-wrap: wrap;
    min-height: 48px;
}

.jf-toolbar-left,
.jf-toolbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.jf-toolbar-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--jf-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.4;
}

.jf-indent-control {
    display: flex;
    align-items: center;
    gap: 6px;
}

.jf-select {
    background: var(--jf-bg-input);
    border: 1px solid var(--jf-border);
    color: var(--jf-text-primary);
    padding: 5px 8px;
    border-radius: var(--jf-radius-sm);
    font-size: 12px;
    outline: none;
    cursor: pointer;
    transition: border-color var(--jf-transition);
    line-height: 1.4;
}

.jf-select-sm {
    padding: 4px 8px;
    font-size: 12px;
}

.jf-select:focus {
    border-color: var(--jf-accent);
}

.jf-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 12px;
    color: var(--jf-text-secondary);
    transition: color var(--jf-transition);
    line-height: 1.3;
    user-select: none;
    white-space: nowrap;
}

.jf-checkbox:hover {
    color: var(--jf-text-primary);
}

.jf-checkbox input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
    accent-color: var(--jf-accent);
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.jf-toolbar-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    background: var(--jf-bg-input);
    border: 1px solid var(--jf-border);
    color: var(--jf-text-secondary);
    border-radius: var(--jf-radius-sm);
    font-size: 12px;
    font-weight: 500;
    transition: all var(--jf-transition);
    line-height: 1.3;
    cursor: pointer;
}

.jf-toolbar-btn:hover {
    background: var(--jf-bg-hover);
    border-color: var(--jf-border-light);
    color: var(--jf-text-primary);
}

.jf-toolbar-btn.jf-btn-primary {
    background: linear-gradient(135deg, var(--jf-accent), #7c3aed);
    border-color: transparent;
    color: #ffffff;
    font-weight: 600;
}

.jf-toolbar-btn.jf-btn-primary:hover {
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
    color: #ffffff;
}

.jf-toolbar-divider {
    width: 1px;
    height: 20px;
    background: var(--jf-border);
    flex-shrink: 0;
}

/* ---------- Main ---------- */
.jf-main {
    flex: 1;
    display: flex;
    overflow: hidden;
    min-height: 0;
    width: 100%;
    height: 100%;
}

/* ---------- Panel Headers ---------- */
.jf-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: var(--jf-bg-tertiary);
    border-bottom: 1px solid var(--jf-border);
    flex-shrink: 0;
    gap: 10px;
    min-height: 44px;
}

.jf-panel-header h2 {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--jf-text-secondary);
    line-height: 1.4;
}

.jf-panel-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.jf-mini-btn {
    background: var(--jf-bg-input);
    border: 1px solid var(--jf-border);
    color: var(--jf-text-secondary);
    padding: 5px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--jf-transition);
    cursor: pointer;
}

.jf-mini-btn:hover {
    background: var(--jf-bg-hover);
    border-color: var(--jf-border-light);
    color: var(--jf-text-primary);
}

/* ---------- Editor Panel ---------- */
.jf-editor-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--jf-bg-primary);
    border-right: 1px solid var(--jf-border);
    min-width: 0;
    overflow: hidden;
}

.jf-stats-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 16px;
    background: var(--jf-bg-secondary);
    border-bottom: 1px solid var(--jf-border);
    font-size: 11px;
    color: var(--jf-text-muted);
    flex-shrink: 0;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 30px;
}

.jf-stats-left,
.jf-stats-right {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.jf-stat-item {
    display: flex;
    align-items: center;
    gap: 4px;
    line-height: 1.3;
    white-space: nowrap;
}

.jf-stat-item strong {
    color: var(--jf-text-primary);
    font-weight: 600;
}

.jf-stat-status {
    font-size: 11px;
    padding: 2px 10px;
    border-radius: 100px;
    background: var(--jf-bg-tertiary);
    color: var(--jf-text-muted);
    line-height: 1.3;
    white-space: nowrap;
}

.jf-stat-status.jf-status-valid {
    background: var(--jf-success-bg);
    color: var(--jf-success);
}

.jf-stat-status.jf-status-invalid {
    background: var(--jf-danger-bg);
    color: var(--jf-danger);
}

.jf-stat-status.jf-status-empty {
    background: var(--jf-bg-tertiary);
    color: var(--jf-text-muted);
}

.jf-editor-wrapper {
    flex: 1;
    display: flex;
    background: var(--jf-bg-input);
    overflow: hidden;
    min-height: 0;
    position: relative;
}

.jf-line-numbers {
    flex-shrink: 0;
    width: 50px;
    background: var(--jf-bg-secondary);
    border-right: 1px solid var(--jf-border);
    padding: 12px 8px 12px 0;
    text-align: right;
    color: var(--jf-text-muted);
    font-family: var(--jf-font-mono);
    font-size: 13px;
    line-height: 1.55;
    overflow: hidden;
    user-select: none;
    white-space: pre;
}

.jf-editor {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--jf-text-primary);
    padding: 12px 16px;
    font-size: 13px;
    font-family: var(--jf-font-mono);
    line-height: 1.55;
    resize: none;
    outline: none;
    overflow: auto;
    white-space: pre;
    word-wrap: normal;
    tab-size: 4;
    min-width: 0;
}

.jf-editor::placeholder {
    color: var(--jf-text-muted);
    font-style: italic;
    font-family: 'Segoe UI', system-ui, sans-serif;
    white-space: pre-wrap;
}

.jf-editor.jf-drag-over {
    background: rgba(99, 102, 241, 0.05);
    outline: 2px dashed var(--jf-accent);
    outline-offset: -4px;
}

.jf-editor.jf-has-error {
    background: rgba(239, 68, 68, 0.04);
}

/* ---------- Bottom Bar ---------- */
.jf-bottom-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--jf-bg-secondary);
    border-top: 1px solid var(--jf-border);
    flex-shrink: 0;
    flex-wrap: wrap;
    min-height: 44px;
}

.jf-samples-label {
    font-size: 11px;
    color: var(--jf-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    line-height: 1.4;
    margin-right: 4px;
}

.jf-sample-btn {
    padding: 4px 10px;
    background: var(--jf-bg-input);
    border: 1px solid var(--jf-border);
    color: var(--jf-text-secondary);
    border-radius: 100px;
    font-size: 11px;
    font-weight: 500;
    transition: all var(--jf-transition);
    line-height: 1.3;
    cursor: pointer;
}

.jf-sample-btn:hover {
    background: var(--jf-bg-hover);
    border-color: var(--jf-accent);
    color: var(--jf-accent-light);
}

/* ---------- Tree Panel ---------- */
.jf-tree-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--jf-bg-primary);
    min-width: 0;
    overflow: hidden;
}

.jf-tab-group {
    display: flex;
    gap: 2px;
    background: var(--jf-bg-input);
    border: 1px solid var(--jf-border);
    border-radius: var(--jf-radius-sm);
    padding: 2px;
}

.jf-tab {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    background: transparent;
    border: none;
    color: var(--jf-text-secondary);
    font-size: 12px;
    font-weight: 500;
    border-radius: 4px;
    transition: all var(--jf-transition);
    line-height: 1.3;
    cursor: pointer;
}

.jf-tab:hover {
    color: var(--jf-text-primary);
}

.jf-tab.jf-tab-active {
    background: var(--jf-accent);
    color: #ffffff;
}

.jf-tab-content {
    flex: 1;
    display: none;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.jf-tab-content.jf-tab-content-active {
    display: flex;
}

/* Search bar */
.jf-search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--jf-bg-tertiary);
    border-bottom: 1px solid var(--jf-border);
    flex-shrink: 0;
}

.jf-search-bar svg {
    color: var(--jf-text-muted);
    flex-shrink: 0;
}

.jf-search-input {
    flex: 1;
    background: var(--jf-bg-input);
    border: 1px solid var(--jf-border);
    color: var(--jf-text-primary);
    padding: 6px 10px;
    border-radius: var(--jf-radius-sm);
    font-size: 12px;
    outline: none;
    line-height: 1.4;
    transition: border-color var(--jf-transition);
}

.jf-search-input:focus {
    border-color: var(--jf-accent);
}

.jf-search-input::placeholder {
    color: var(--jf-text-muted);
}

/* Tree container */
.jf-tree-container {
    flex: 1;
    overflow: auto;
    padding: 12px 16px;
    font-family: var(--jf-font-mono);
    font-size: 13px;
    line-height: 1.6;
}

.jf-tree-empty {
    text-align: center;
    color: var(--jf-text-muted);
    font-size: 13px;
    padding: 40px 20px;
    line-height: 1.4;
}

.jf-tree-empty p {
    margin: 6px 0;
}

.jf-tree-empty svg {
    margin-bottom: 8px;
}

/* Tree node */
.jf-tree-node {
    display: block;
    padding-left: 0;
}

.jf-tree-row {
    display: flex;
    align-items: flex-start;
    gap: 4px;
    padding: 1px 4px;
    border-radius: 4px;
    cursor: pointer;
    transition: background var(--jf-transition);
    position: relative;
    line-height: 1.6;
}

.jf-tree-row:hover {
    background: var(--jf-bg-hover);
}

.jf-tree-row.jf-highlighted {
    background: rgba(245, 158, 11, 0.2);
    box-shadow: 0 0 0 1px var(--jf-warning);
}

.jf-tree-toggle {
    flex-shrink: 0;
    width: 16px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--jf-text-muted);
    cursor: pointer;
    user-select: none;
    transition: transform var(--jf-transition);
    line-height: 1;
}

.jf-tree-toggle.jf-expanded {
    transform: rotate(90deg);
}

.jf-tree-toggle.jf-empty-toggle {
    visibility: hidden;
}

.jf-tree-icon {
    flex-shrink: 0;
    width: 16px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--jf-text-muted);
    font-size: 11px;
    line-height: 1;
}

.jf-tree-key {
    color: var(--jf-type-key);
    font-weight: 500;
    line-height: 1.6;
}

.jf-tree-colon {
    color: var(--jf-text-muted);
    margin-right: 4px;
    line-height: 1.6;
}

.jf-tree-value {
    flex: 1;
    word-break: break-word;
    white-space: pre-wrap;
    line-height: 1.6;
}

.jf-tree-value.jf-type-string {
    color: var(--jf-type-string);
}

.jf-tree-value.jf-type-number {
    color: var(--jf-type-number);
}

.jf-tree-value.jf-type-boolean {
    color: var(--jf-type-boolean);
}

.jf-tree-value.jf-type-null {
    color: var(--jf-type-null);
    font-style: italic;
}

.jf-tree-bracket {
    color: var(--jf-text-muted);
    font-weight: 500;
    line-height: 1.6;
}

.jf-tree-summary {
    color: var(--jf-text-muted);
    font-style: italic;
    margin-left: 4px;
    line-height: 1.6;
}

.jf-tree-children {
    padding-left: 18px;
    border-left: 1px dashed var(--jf-border);
    margin-left: 7px;
}

.jf-tree-children.jf-collapsed {
    display: none;
}

.jf-tree-actions {
    display: none;
    gap: 2px;
    margin-left: auto;
    padding-left: 8px;
    flex-shrink: 0;
}

.jf-tree-row:hover .jf-tree-actions {
    display: flex;
}

.jf-tree-action-btn {
    background: transparent;
    border: 1px solid var(--jf-border);
    color: var(--jf-text-muted);
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-family: inherit;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    line-height: 1.3;
}

.jf-tree-action-btn:hover {
    color: var(--jf-accent-light);
    border-color: var(--jf-accent);
}

/* JSONPath */
.jf-path-search {
    display: flex;
    gap: 8px;
    padding: 8px 16px;
    background: var(--jf-bg-tertiary);
    border-bottom: 1px solid var(--jf-border);
    flex-shrink: 0;
}

.jf-path-input {
    flex: 1;
    background: var(--jf-bg-input);
    border: 1px solid var(--jf-border);
    color: var(--jf-text-primary);
    padding: 6px 10px;
    border-radius: var(--jf-radius-sm);
    font-size: 12px;
    font-family: var(--jf-font-mono);
    outline: none;
    line-height: 1.4;
    transition: border-color var(--jf-transition);
}

.jf-path-input:focus {
    border-color: var(--jf-accent);
}

.jf-btn-sm {
    padding: 6px 14px;
    background: var(--jf-accent);
    border: none;
    color: #ffffff;
    border-radius: var(--jf-radius-sm);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--jf-transition);
    line-height: 1.3;
}

.jf-btn-sm:hover {
    background: var(--jf-accent-light);
}

.jf-path-results {
    flex: 1;
    overflow: auto;
    padding: 12px 16px;
    font-family: var(--jf-font-mono);
    font-size: 12px;
    line-height: 1.6;
}

.jf-path-hint {
    color: var(--jf-text-muted);
    font-size: 12px;
    line-height: 1.4;
}

.jf-path-result-item {
    padding: 6px 10px;
    background: var(--jf-bg-card);
    border: 1px solid var(--jf-border);
    border-radius: var(--jf-radius-sm);
    margin-bottom: 4px;
    line-height: 1.4;
    word-break: break-all;
}

.jf-path-result-path {
    color: var(--jf-accent-light);
    font-weight: 600;
    margin-right: 8px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.jf-path-no-results {
    text-align: center;
    color: var(--jf-text-muted);
    font-size: 13px;
    padding: 30px 20px;
}

/* Statistics */
.jf-stats-content {
    flex: 1;
    overflow: auto;
    padding: 16px 20px;
}

.jf-stats-card {
    background: var(--jf-bg-card);
    border: 1px solid var(--jf-border);
    border-radius: var(--jf-radius);
    padding: 16px 20px;
    margin-bottom: 12px;
}

.jf-stats-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--jf-text-muted);
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--jf-border);
    line-height: 1.4;
}

.jf-stats-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    padding: 4px 0;
    color: var(--jf-text-secondary);
    line-height: 1.4;
}

.jf-stats-row strong {
    color: var(--jf-text-primary);
    font-weight: 600;
    font-family: var(--jf-font-mono);
}

.jf-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.jf-stats-cell {
    background: var(--jf-bg-input);
    border: 1px solid var(--jf-border);
    border-radius: var(--jf-radius-sm);
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.jf-stats-cell-label {
    font-size: 10px;
    color: var(--jf-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-weight: 600;
    line-height: 1.3;
}

.jf-stats-cell-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--jf-text-primary);
    line-height: 1.3;
    font-family: var(--jf-font-mono);
}

.jf-stats-cell-sub {
    font-size: 10px;
    color: var(--jf-text-muted);
    line-height: 1.3;
}

.jf-stats-cell.jf-cell-string { border-left: 3px solid var(--jf-type-string); }
.jf-stats-cell.jf-cell-number { border-left: 3px solid var(--jf-type-number); }
.jf-stats-cell.jf-cell-boolean { border-left: 3px solid var(--jf-type-boolean); }
.jf-stats-cell.jf-cell-null { border-left: 3px solid var(--jf-type-null); }
.jf-stats-cell.jf-cell-array { border-left: 3px solid var(--jf-warning); }
.jf-stats-cell.jf-cell-object { border-left: 3px solid var(--jf-accent); }

/* ---------- Modal ---------- */
.jf-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1500;
    padding: 20px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.jf-modal-box {
    background: var(--jf-bg-card);
    border: 1px solid var(--jf-border);
    border-radius: var(--jf-radius-lg);
    width: 100%;
    max-width: 480px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--jf-shadow);
}

.jf-modal-box-lg {
    max-width: 720px;
    height: 80vh;
    max-height: 600px;
}

.jf-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: var(--jf-bg-tertiary);
    border-bottom: 1px solid var(--jf-border);
    flex-shrink: 0;
}

.jf-modal-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--jf-text-primary);
    line-height: 1.3;
}

.jf-modal-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 16px 20px;
    gap: 12px;
    min-height: 0;
}

.jf-convert-formats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
    flex-shrink: 0;
}

.jf-format-option {
    cursor: pointer;
    user-select: none;
}

.jf-format-option input {
    display: none;
}

.jf-format-card {
    background: var(--jf-bg-input);
    border: 2px solid var(--jf-border);
    border-radius: var(--jf-radius);
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    transition: all var(--jf-transition);
}

.jf-format-card strong {
    color: var(--jf-text-primary);
    font-size: 13px;
    line-height: 1.3;
}

.jf-format-card span {
    color: var(--jf-text-muted);
    font-size: 11px;
    line-height: 1.3;
}

.jf-format-option input:checked + .jf-format-card {
    border-color: var(--jf-accent);
    background: var(--jf-accent-glow);
}

.jf-format-option input:checked + .jf-format-card strong {
    color: var(--jf-accent-light);
}

.jf-convert-output {
    flex: 1;
    background: var(--jf-bg-input);
    border: 1px solid var(--jf-border);
    color: var(--jf-text-primary);
    padding: 12px;
    border-radius: var(--jf-radius);
    font-size: 12px;
    font-family: var(--jf-font-mono);
    line-height: 1.5;
    resize: none;
    outline: none;
    overflow: auto;
    white-space: pre;
    min-height: 0;
}

.jf-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 20px;
    background: var(--jf-bg-tertiary);
    border-top: 1px solid var(--jf-border);
    flex-shrink: 0;
}

/* ---------- Error Panel ---------- */
.jf-error-panel {
    position: absolute;
    bottom: 20px;
    left: 20px;
    max-width: 480px;
    background: var(--jf-bg-card);
    border: 1px solid var(--jf-danger-border);
    border-left: 3px solid var(--jf-danger);
    border-radius: var(--jf-radius);
    box-shadow: var(--jf-shadow);
    z-index: 1000;
    max-height: 50vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.jf-error-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--jf-danger-bg);
    color: var(--jf-danger);
    font-size: 13px;
    flex-shrink: 0;
}

.jf-error-header strong {
    flex: 1;
    font-weight: 600;
    line-height: 1.3;
}

.jf-error-body {
    padding: 12px 14px;
    color: var(--jf-text-secondary);
    font-size: 12px;
    line-height: 1.5;
    overflow: auto;
    font-family: var(--jf-font-mono);
}

.jf-error-body strong {
    color: var(--jf-text-primary);
    font-family: 'Segoe UI', system-ui, sans-serif;
}

.jf-error-loc {
    display: inline-block;
    background: var(--jf-bg-input);
    color: var(--jf-danger);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    margin: 4px 0;
    border: 1px solid var(--jf-border);
}

/* ---------- Toast ---------- */
.jf-toast-container {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 2000;
    pointer-events: none;
}

.jf-toast {
    background: var(--jf-bg-card);
    border: 1px solid var(--jf-border);
    border-radius: var(--jf-radius);
    padding: 12px 20px;
    font-size: 13px;
    color: var(--jf-text-primary);
    box-shadow: var(--jf-shadow);
    animation: jf-toast-in 0.3s ease, jf-toast-out 0.3s ease 2.7s forwards;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 380px;
    line-height: 1.4;
    pointer-events: auto;
}

.jf-toast.jf-success {
    border-color: rgba(34, 197, 94, 0.4);
}

.jf-toast.jf-error {
    border-color: rgba(239, 68, 68, 0.4);
}

.jf-toast.jf-warning {
    border-color: rgba(245, 158, 11, 0.4);
}

.jf-toast.jf-info {
    border-color: rgba(99, 102, 241, 0.4);
}

.jf-toast-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

@keyframes jf-toast-in {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes jf-toast-out {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(20px); }
}

/* ---------- Scrollbar ---------- */
.jf-app ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.jf-app ::-webkit-scrollbar-track {
    background: transparent;
}

.jf-app ::-webkit-scrollbar-thumb {
    background: var(--jf-border-light);
    border-radius: 100px;
}

.jf-app ::-webkit-scrollbar-thumb:hover {
    background: var(--jf-text-muted);
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .jf-main {
        flex-direction: column;
    }

    .jf-editor-panel,
    .jf-tree-panel {
        max-height: 50%;
    }

    .jf-editor-panel {
        border-right: none;
        border-bottom: 1px solid var(--jf-border);
    }

    .jf-stats-grid {
        grid-template-columns: 1fr;
    }
}
