/* JSON Formatter Specific Styles */

.tool-container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
}

.tool-header {
    text-align: center;
    margin-bottom: 30px;
}

.tool-header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.tool-header p {
    color: #6b7280;
    font-size: 1.1rem;
}

/* Editor Card */
.editor-card {
    background: white;
    border-radius: 30px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
}

.dark-mode .editor-card {
    background: #1f2937;
    border-color: #374151;
}

/* Editor Header */
.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    flex-wrap: wrap;
    gap: 10px;
}

.dark-mode .editor-header {
    background: #111827;
    border-bottom-color: #374151;
}

.editor-tabs {
    display: flex;
    gap: 5px;
}

.tab-btn {
    padding: 8px 16px;
    background: transparent;
    border: 2px solid transparent;
    border-radius: 60px;
    color: #6b7280;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    color: #3b82f6;
}

.tab-btn.active {
    background: white;
    border-color: #e5e7eb;
    color: #3b82f6;
}

.dark-mode .tab-btn.active {
    background: #1f2937;
    border-color: #374151;
    color: #f9fafb;
}

.editor-actions {
    display: flex;
    gap: 8px;
}

.action-btn {
    width: 40px;
    height: 40px;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 60px;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.dark-mode .action-btn {
    background: #1f2937;
    border-color: #374151;
    color: #9ca3af;
}

.action-btn:hover {
    border-color: #3b82f6;
    color: #3b82f6;
    transform: translateY(-2px);
}

/* Editor Content */
.editor-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    padding: 20px;
    min-height: 500px;
}

.input-section,
.output-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.section-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: #6b7280;
    padding: 0 5px;
}

.error-message {
    color: #ef4444;
    font-size: 0.85rem;
    font-weight: 500;
}

.status-badge {
    padding: 4px 10px;
    background: #e5e7eb;
    border-radius: 60px;
    font-size: 0.8rem;
    color: #6b7280;
}

.dark-mode .status-badge {
    background: #374151;
    color: #9ca3af;
}

.status-badge.success {
    background: #10b981;
    color: white;
}

.status-badge.error {
    background: #ef4444;
    color: white;
}

/* JSON Input */
.json-input {
    width: 100%;
    height: 400px;
    padding: 20px;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 20px;
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #111827;
    resize: vertical;
    outline: none;
    transition: all 0.2s ease;
}

.dark-mode .json-input {
    background: #111827;
    border-color: #374151;
    color: #f9fafb;
}

.json-input:focus {
    border-color: #3b82f6;
}

.json-input.error {
    border-color: #ef4444;
}

/* JSON Output */
.output-view {
    display: none;
    height: 400px;
    overflow: auto;
}

.output-view.active {
    display: block;
}

.json-output {
    width: 100%;
    height: 100%;
    padding: 20px;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 20px;
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #111827;
    overflow: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    margin: 0;
}

.dark-mode .json-output {
    background: #111827;
    border-color: #374151;
    color: #f9fafb;
}

#minifiedJson {
    resize: none;
    white-space: pre;
    overflow-x: auto;
}

/* Syntax Highlighting */
.json-output .string { color: #10b981; }
.json-output .number { color: #3b82f6; }
.json-output .boolean { color: #f59e0b; }
.json-output .null { color: #ef4444; }
.json-output .key { color: #8b5cf6; }

/* Tree View */
.json-tree {
    padding: 20px;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 20px;
    height: 400px;
    overflow: auto;
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
}

.dark-mode .json-tree {
    background: #111827;
    border-color: #374151;
}

.tree-item {
    margin-left: 20px;
}

.tree-item.collapsible {
    cursor: pointer;
}

.tree-item .key {
    color: #8b5cf6;
    font-weight: 500;
}

.tree-item .value {
    color: #10b981;
}

.tree-item .number {
    color: #3b82f6;
}

.tree-item .boolean {
    color: #f59e0b;
}

.tree-item .null {
    color: #ef4444;
}

.tree-toggle {
    display: inline-block;
    width: 16px;
    text-align: center;
    color: #6b7280;
    cursor: pointer;
}

.tree-children {
    margin-left: 20px;
    display: block;
}

.tree-children.collapsed {
    display: none;
}

/* Editor Footer */
.editor-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
    flex-wrap: wrap;
    gap: 10px;
}

.dark-mode .editor-footer {
    background: #111827;
    border-top-color: #374151;
}

.indent-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

.indent-control label {
    color: #6b7280;
    font-size: 0.9rem;
}

.indent-control select {
    padding: 6px 12px;
    border: 2px solid #e5e7eb;
    border-radius: 60px;
    background: white;
    color: #111827;
    font-size: 0.9rem;
    cursor: pointer;
    outline: none;
}

.dark-mode .indent-control select {
    background: #1f2937;
    border-color: #374151;
    color: #f9fafb;
}

.stats {
    display: flex;
    gap: 15px;
    color: #6b7280;
    font-size: 0.9rem;
}

.stats span span {
    font-weight: 600;
    color: #3b82f6;
}

/* Info Section */
.info-section {
    background: #f9fafb;
    border-radius: 30px;
    padding: 30px;
    margin: 30px 0;
    border: 1px solid #e5e7eb;
}

.dark-mode .info-section {
    background: #111827;
    border-color: #374151;
}

.info-section h3 {
    font-size: 1.3rem;
    margin: 20px 0 15px;
    color: #111827;
}

.dark-mode .info-section h3 {
    color: #f9fafb;
}

.info-section h3:first-child {
    margin-top: 0;
}

.info-section p {
    color: #6b7280;
    line-height: 1.6;
    margin-bottom: 15px;
}

.dark-mode .info-section p {
    color: #9ca3af;
}

.info-section ul {
    list-style: none;
    padding: 0;
}

.info-section ul li {
    padding: 8px 0;
    color: #6b7280;
    display: flex;
    align-items: center;
    gap: 10px;
}

.dark-mode .info-section ul li {
    color: #9ca3af;
}

.tip-box {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 20px;
    background: #f0f9ff;
    border-radius: 20px;
    margin-top: 20px;
    border: 1px solid #bae6fd;
}

.dark-mode .tip-box {
    background: #1e3a5f;
    border-color: #2563eb;
}

.tip-box i {
    font-size: 1.5rem;
    color: #f59e0b;
    margin-top: 2px;
}

.tip-box div {
    color: #0369a1;
    font-size: 0.95rem;
    line-height: 1.5;
}

.dark-mode .tip-box div {
    color: #bae6fd;
}

.tip-box strong {
    color: #111827;
}

.dark-mode .tip-box strong {
    color: #f9fafb;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .tool-header h1 {
        font-size: 2rem;
    }
    
    .editor-content {
        grid-template-columns: 1fr;
    }
    
    .json-input,
    .output-view {
        height: 300px;
    }
    
    .editor-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .editor-actions {
        justify-content: center;
    }
    
    .editor-footer {
        flex-direction: column;
        align-items: stretch;
    }
    
    .stats {
        justify-content: center;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Updated Tree View Styles */
.tree-toggle {
    display: inline-block;
    width: 20px;
    text-align: center;
    color: #3b82f6;
    cursor: pointer;
    font-size: 12px;
    user-select: none;
    margin-right: 4px;
}

.tree-toggle:hover {
    color: #2563eb;
    transform: scale(1.1);
}

.tree-toggle-placeholder {
    display: inline-block;
    width: 20px;
    margin-right: 4px;
}

.tree-children {
    margin-left: 24px;
    display: block;
}

.tree-children.collapsed {
    display: none;
}

.tree-item {
    margin: 4px 0;
    line-height: 1.6;
    white-space: nowrap;
}

.tree-item .key {
    color: #8b5cf6;
    font-weight: 500;
    margin-right: 4px;
}

.tree-item .string {
    color: #10b981;
}

.tree-item .number {
    color: #3b82f6;
}

.tree-item .boolean {
    color: #f59e0b;
}

.tree-item .null {
    color: #ef4444;
}

.tree-item .value {
    color: #10b981;
}