/* =====================================================
   JSON FORMATTER & VALIDATOR STYLES
   Basic Calculator Online - JSON Tools
   ===================================================== */

/* ======================= SECTION ======================= */
.json-formatter-section {
    padding: 2rem 0 3rem;
    min-height: 60vh;
}

/* ======================= TOOLBAR ======================= */
.json-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    background: white;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    box-shadow: var(--shadow-md);
    flex-wrap: wrap;
    gap: 1rem;
}

.toolbar-left,
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: white;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.toolbar-btn:hover {
    border-color: #6366f1;
    color: #6366f1;
    background: rgba(99, 102, 241, 0.05);
}

.toolbar-btn.primary {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    border-color: transparent;
    color: white;
}

.toolbar-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.toolbar-divider {
    width: 1px;
    height: 24px;
    background: var(--border-color);
    margin: 0 0.5rem;
}

.indent-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.indent-selector label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-muted);
}

.indent-selector select {
    padding: 0.5rem 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: white;
    cursor: pointer;
}

.toolbar-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
}

.toolbar-toggle input {
    width: 18px;
    height: 18px;
    accent-color: #6366f1;
}

/* ======================= STATUS BAR ======================= */
.json-status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.625rem 1.25rem;
    background: #f8fafc;
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 600;
}

.status-indicator i {
    font-size: 0.5rem;
}

.status-indicator.ready i { color: #94a3b8; }
.status-indicator.valid i { color: #10b981; }
.status-indicator.invalid i { color: #ef4444; }

.status-info {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ======================= PANELS ======================= */
.json-panel {
    background: white;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 450px;
}

.input-panel {
    border-radius: 0 0 0 var(--radius-xl);
    border-right: none;
}

.output-panel {
    border-radius: 0 0 var(--radius-xl) 0;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border-bottom: 1px solid #334155;
}

.panel-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #e2e8f0;
}

.panel-actions {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.panel-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.1);
    color: #94a3b8;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.panel-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.view-toggle {
    display: flex;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: 0.125rem;
}

.view-btn {
    width: 32px;
    height: 28px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: #94a3b8;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.view-btn.active {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.view-btn:hover:not(.active) {
    color: #e2e8f0;
}

/* Panel Body */
.panel-body {
    flex: 1;
    display: flex;
    position: relative;
    overflow: hidden;
    background: #1e293b;
    min-height: 0;
}

.line-numbers {
    padding: 1rem 0.75rem;
    background: #0f172a;
    color: #64748b;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    text-align: right;
    user-select: none;
    border-right: 1px solid #334155;
    min-width: 45px;
    overflow-y: auto;
    overflow-x: hidden;
    white-space: pre;
    flex-shrink: 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.line-numbers::-webkit-scrollbar {
    display: none;
}

.json-textarea {
    flex: 1;
    padding: 1rem;
    border: none;
    background: #1e293b;
    color: #e2e8f0;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    resize: none;
    outline: none;
    overflow: auto;
    white-space: pre;
    word-wrap: normal;
    overflow-wrap: normal;
}

.json-textarea::placeholder {
    color: #64748b;
    white-space: pre-wrap;
}

.output-view {
    display: none;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

.output-view.active {
    display: flex;
}

.text-view {
    background: #1e293b;
}

.json-output {
    flex: 1;
    padding: 1rem;
    margin: 0;
    background: transparent;
    color: #e2e8f0;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    white-space: pre;
    overflow: auto;
}

.json-output .placeholder-text {
    color: #64748b;
}

/* Syntax Highlighting */
.json-key { color: #7dd3fc; }
.json-string { color: #86efac; }
.json-number { color: #fde68a; }
.json-boolean { color: #c4b5fd; }
.json-null { color: #f87171; }
.json-bracket { color: #94a3b8; }

/* Tree View */
.tree-view {
    background: #1e293b;
    padding: 1rem;
}

.json-tree {
    flex: 1;
    color: #e2e8f0;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.8125rem;
    line-height: 1.8;
}

.tree-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #64748b;
    text-align: center;
}

.tree-placeholder i {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.5;
}

.tree-item {
    padding-left: 1.25rem;
    position: relative;
}

.tree-item::before {
    content: '';
    position: absolute;
    left: 0.25rem;
    top: 0;
    bottom: 0;
    width: 1px;
    background: #334155;
}

.tree-key {
    color: #7dd3fc;
    cursor: pointer;
}

.tree-key:hover {
    text-decoration: underline;
}

.tree-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    margin-right: 0.25rem;
    color: #94a3b8;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.tree-toggle.collapsed {
    transform: rotate(-90deg);
}

.tree-value { color: #86efac; }
.tree-value.number { color: #fde68a; }
.tree-value.boolean { color: #c4b5fd; }
.tree-value.null { color: #f87171; font-style: italic; }

.tree-type {
    color: #64748b;
    font-size: 0.75rem;
    margin-left: 0.5rem;
}

.tree-children {
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.tree-children.collapsed {
    max-height: 0 !important;
}

/* ======================= ERROR BAR ======================= */
.json-error-bar {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border: 1px solid #fca5a5;
    border-top: none;
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
    padding: 1rem 1.25rem;
}

.error-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.error-content > i {
    font-size: 1.25rem;
    color: #ef4444;
}

.error-details {
    flex: 1;
}

.error-details strong {
    display: block;
    font-size: 0.875rem;
    color: #991b1b;
    margin-bottom: 0.125rem;
}

.error-details span {
    font-size: 0.8125rem;
    color: #b91c1c;
}

.error-locate-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: 2px solid #ef4444;
    border-radius: var(--radius-lg);
    background: white;
    color: #ef4444;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.error-locate-btn:hover {
    background: #ef4444;
    color: white;
}

/* ======================= PATH FINDER ======================= */
.json-path-card {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    margin-top: 1.5rem;
    overflow: hidden;
}

.path-header {
    padding: 1rem 1.25rem;
    background: var(--bg-body);
    border-bottom: 1px solid var(--border-color);
}

.path-header h5 {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
}

.path-body {
    padding: 1.25rem;
}

.path-input-group {
    display: flex;
    gap: 0.75rem;
}

.path-input {
    flex: 1;
    padding: 0.875rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    font-size: 0.9375rem;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.path-input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.path-search-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: white;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.path-search-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.path-result {
    margin-top: 1rem;
    padding: 1rem;
    background: #1e293b;
    border-radius: var(--radius-lg);
}

.path-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.path-result-header span {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: #64748b;
}

.path-copy-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.1);
    color: #94a3b8;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.path-copy-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.path-result-value {
    margin: 0;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.875rem;
    color: #86efac;
    white-space: pre-wrap;
    word-break: break-all;
}

/* ======================= STATS CARD ======================= */
.json-stats-card {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    margin-top: 1.5rem;
    overflow: hidden;
}

.stats-header {
    padding: 1rem 1.25rem;
    background: var(--bg-body);
    border-bottom: 1px solid var(--border-color);
}

.stats-header h5 {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
}

.stats-body {
    padding: 1.25rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 1rem;
    background: var(--bg-body);
    border-radius: var(--radius-lg);
}

.stat-item .stat-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.stat-item .stat-icon.blue { background: rgba(59, 130, 246, 0.1); color: #3b82f6; }
.stat-item .stat-icon.green { background: rgba(16, 185, 129, 0.1); color: #10b981; }
.stat-item .stat-icon.purple { background: rgba(139, 92, 246, 0.1); color: #8b5cf6; }
.stat-item .stat-icon.orange { background: rgba(249, 115, 22, 0.1); color: #f97316; }
.stat-item .stat-icon.cyan { background: rgba(6, 182, 212, 0.1); color: #06b6d4; }
.stat-item .stat-icon.pink { background: rgba(236, 72, 153, 0.1); color: #ec4899; }
.stat-item .stat-icon.gray { background: rgba(107, 114, 128, 0.1); color: #6b7280; }
.stat-item .stat-icon.indigo { background: rgba(99, 102, 241, 0.1); color: #6366f1; }

.stat-item .stat-info {
    flex: 1;
}

.stat-item .stat-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-item .stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ======================= FEATURES SECTION ======================= */
.json-features-section {
    padding: 4rem 0;
    background: var(--bg-body);
}

.json-section-badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: rgba(99, 102, 241, 0.1);
    color: #6366f1;
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.section-title {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.section-desc {
    font-size: 1.0625rem;
    color: var(--text-muted);
    margin: 0;
}

.json-feature-card {
    background: white;
    border-radius: var(--radius-xl);
    padding: 1.75rem;
    text-align: center;
    box-shadow: var(--shadow-md);
    height: 100%;
    transition: all var(--transition-normal);
}

.json-feature-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
}

.json-feature-card .feature-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 1rem;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.json-feature-card .feature-icon.blue { background: rgba(59, 130, 246, 0.1); color: #3b82f6; }
.json-feature-card .feature-icon.green { background: rgba(16, 185, 129, 0.1); color: #10b981; }
.json-feature-card .feature-icon.purple { background: rgba(139, 92, 246, 0.1); color: #8b5cf6; }
.json-feature-card .feature-icon.orange { background: rgba(249, 115, 22, 0.1); color: #f97316; }

.json-feature-card h5 {
    font-size: 1.0625rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.json-feature-card p {
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin: 0;
}

/* ======================= INFO SECTION ======================= */
.json-info-section {
    padding: 3rem 0 5rem;
}

.json-info-card {
    background: white;
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    height: 100%;
}

.json-info-card h4 {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1.25rem;
}

.shortcuts-grid {
    display: grid;
    gap: 0.75rem;
}

.shortcut-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0;
    border-bottom: 1px solid var(--border-color);
}

.shortcut-item:last-child {
    border-bottom: none;
}

.shortcut-item kbd {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: #1e293b;
    color: white;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-family: inherit;
    font-weight: 600;
}

.shortcut-item span {
    flex: 1;
    text-align: right;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.tips-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tips-list li {
    padding: 0.625rem 0 0.625rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9375rem;
    color: var(--text-secondary);
    position: relative;
}

.tips-list li::before {
    content: '💡';
    position: absolute;
    left: 0;
    font-size: 0.875rem;
}

.tips-list li:last-child {
    border-bottom: none;
}

/* ======================= RESPONSIVE ======================= */
@media (max-width: 991.98px) {
    .json-formatter-section {
        padding: 1.5rem 0 2rem;
    }

    .json-panel {
        height: 350px;
    }

    .input-panel {
        border-radius: 0;
        border-right: 1px solid var(--border-color);
        border-bottom: none;
    }

    .output-panel {
        border-radius: 0 0 var(--radius-xl) var(--radius-xl);
    }

    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 767.98px) {
    .toolbar-left,
    .toolbar-right {
        width: 100%;
        justify-content: center;
    }

    .toolbar-divider {
        display: none;
    }

    .toolbar-btn span {
        display: none;
    }

    .toolbar-btn {
        padding: 0.625rem;
    }

    .json-panel {
        height: 300px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .json-features-section {
        padding: 3rem 0;
    }

    .section-title {
        font-size: 1.5rem;
    }

    .path-input-group {
        flex-direction: column;
    }
}

@media (max-width: 575.98px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stat-item {
        padding: 0.75rem;
    }

    .stat-item .stat-value {
        font-size: 1rem;
    }
}

/* ======================= SCROLLBARS ======================= */
.json-textarea::-webkit-scrollbar,
.json-output::-webkit-scrollbar,
.json-tree::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.json-textarea::-webkit-scrollbar-track,
.json-output::-webkit-scrollbar-track,
.json-tree::-webkit-scrollbar-track {
    background: #0f172a;
}

.json-textarea::-webkit-scrollbar-thumb,
.json-output::-webkit-scrollbar-thumb,
.json-tree::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 4px;
}

.json-textarea::-webkit-scrollbar-thumb:hover,
.json-output::-webkit-scrollbar-thumb:hover,
.json-tree::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* ======================= TOAST ======================= */
.json-toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 0.875rem 1.5rem;
    background: #1f2937;
    color: white;
    border-radius: var(--radius-lg);
    font-size: 0.9375rem;
    font-weight: 500;
    box-shadow: var(--shadow-xl);
    z-index: 9999;
    opacity: 0;
    transition: all 0.3s ease;
}

.json-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.json-toast.success { background: #10b981; }
.json-toast.error { background: #ef4444; }