/* JSON Formatter & Validator Light Theme */
:root {
    --primary-color: var(--primary-color);
    --primary-hover: var(--primary-hover);
    --primary-light: #dbeafe;
    
    --success-color: #16a34a;
    --success-light: #dcfce7;
    
    --warning-color: #ea580c;
    --warning-light: #fed7aa;
    
    --error-color: var(--danger-color);
    --error-light: #fecaca;
    
    --text-primary: var(--text-primary);
    --text-secondary: var(--text-muted);
    --text-tertiary: var(--text-muted);
    
    --bg-primary: var(--bg-primary);
    --bg-secondary: var(--bg-secondary);
    --bg-tertiary: var(--bg-secondary);
    
    --border-color: var(--border-color);
    --border-hover: var(--border-color);
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
}
/* Dark mode overrides */
[data-theme="dark"] {
    --tool-bg: #0f172a;
    --tool-border: #334155;
    --tool-border-hover: #475569;
    --tool-text: #f8fafc;
    --tool-text-secondary: #94a3b8;
    --tool-input-bg: #1e293b;
    --tool-input-border: #334155;
    --tool-button-bg: #1e293b;
    --tool-button-hover: #334155;
    --tool-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3);
    --tool-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
    --surface-color: #1e293b;
    --surface-hover: #334155;
    --background-color: #0f172a;
    --text-color: #f8fafc;
    --status-info: rgba(96, 165, 250, 0.2);
    --status-success: rgba(34, 197, 94, 0.2);
    --status-error: rgba(248, 113, 113, 0.2);
    --bg-color: #0f172a;
}

/* Dark mode element overrides */
[data-theme="dark"] .tool-card {
    background: var(--bg-card, #1e293b);
    border-color: var(--border-color, #334155);
}

[data-theme="dark"] .tool-hero {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}

[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
    background: var(--input-bg, #1e293b);
    color: var(--text-primary, #f8fafc);
    border-color: var(--border-color, #334155);
}

[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
    color: var(--text-muted, #64748b);
}

[data-theme="dark"] .tab-btn.active {
    color: white;
}

[data-theme="dark"] label {
    color: var(--text-primary, #f8fafc);
}

[data-theme="dark"] h1, [data-theme="dark"] h2, [data-theme="dark"] h3,
[data-theme="dark"] h4, [data-theme="dark"] h5, [data-theme="dark"] h6 {
    color: var(--text-primary, #f8fafc);
}

[data-theme="dark"] p {
    color: var(--text-secondary, #cbd5e1);
}


/* Tool Interface */
.tool-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
}

/* Sections */
.input-section,
.actions-section,
.output-section,
.tree-section,
.error-section,
.stats-section {
    margin-bottom: 2.5rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.section-header h3 {
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.header-actions {
    display: flex;
    gap: 0.75rem;
}

/* Form Elements */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

#json-input {
    width: 100%;
    min-height: 200px;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875rem;
    line-height: 1.5;
    background: var(--bg-primary);
    color: var(--text-primary);
    resize: vertical;
    transition: border-color 0.2s ease;
}

#json-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

#json-input::placeholder {
    color: var(--text-tertiary);
}

.input-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
    font-size: 0.875rem;
}

.char-count {
    color: var(--text-secondary);
}

.status {
    font-weight: 500;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
}

.status.ready {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.status.valid {
    background: var(--success-light);
    color: var(--success-color);
}

.status.invalid {
    background: var(--error-light);
    color: var(--error-color);
}

.status.processing {
    background: var(--warning-light);
    color: var(--warning-color);
}

/* Actions Section */
.actions-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
}

.action-group {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.format-options {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.option-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
    font-weight: 500;
    cursor: pointer;
}

.option-label select {
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.875rem;
}

.option-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
    font-weight: 500;
    cursor: pointer;
}

.option-checkbox input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    border-radius: var(--radius-sm);
}

/* Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.25rem;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    var(--bg-primary)-space: nowrap;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

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

.btn-primary {
    background: var(--primary-color);
    color: var(--bg-primary);
    border-color: var(--primary-color);
}

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

.btn-outline {
    background: transparent;
    color: var(--text-primary);
    border-color: var(--border-color);
}

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

/* Output Section */
.output-container {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.json-output {
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875rem;
    line-height: 1.5;
    padding: 1rem;
    margin: 0;
    overflow-x: auto;
    min-height: 200px;
    var(--bg-primary)-space: pre;
}

.output-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.compression-ratio {
    font-weight: 500;
}

/* Tree View */
.tree-container {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    min-height: 200px;
    overflow: auto;
}

.json-tree {
    padding: 1rem;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875rem;
    line-height: 1.5;
}

.tree-node {
    margin: 0.25rem 0;
}

.tree-key {
    color: var(--primary-color);
    font-weight: 600;
}

.tree-string {
    color: var(--success-color);
}

.tree-number {
    color: #e97749;
}

.tree-boolean {
    color: #8b5cf6;
}

.tree-null {
    color: var(--text-tertiary);
    font-style: italic;
}

.tree-toggle {
    color: var(--text-secondary);
    cursor: pointer;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    margin-right: 0.25rem;
}

.tree-toggle:hover {
    color: var(--text-primary);
}

.tree-children {
    margin-left: 1.5rem;
    border-left: 1px solid var(--border-color);
    padding-left: 0.75rem;
}

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

/* Error Section */
.error-section {
    background: var(--error-light);
    border: 1px solid var(--error-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
}

.error-section.hidden {
    display: none;
}

.error-section h3 {
    color: var(--error-color);
    margin-top: 0;
}

.error-container {
    background: var(--bg-primary);
    border: 1px solid var(--error-color);
    border-radius: var(--radius-sm);
    padding: 1rem;
}

.error-details {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--error-color);
    var(--bg-primary)-space: pre-wrap;
}

/* Statistics */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.stat-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-label {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.875rem;
}

.stat-value {
    color: var(--text-primary);
    font-weight: 600;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875rem;
}

/* Info Panel */
.info-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-top: 2rem;
}

.info-panel h3 {
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.info-panel h4 {
    color: var(--text-primary);
    font-size: 1.125rem;
    font-weight: 600;
    margin: 1.5rem 0 0.75rem 0;
}

.info-panel h4:first-of-type {
    margin-top: 0;
}

.info-panel p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.info-panel ul {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.info-panel li {
    margin-bottom: 0.5rem;
}

.info-panel li strong {
    color: var(--text-primary);
    font-weight: 600;
}

.info-panel pre {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 1rem;
    margin: 0.75rem 0;
    overflow-x: auto;
}

.info-panel code {
    color: var(--text-primary);
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875rem;
}

.json-features,
.json-syntax,
.json-example {
    margin-bottom: 2rem;
}

.json-example {
    margin-bottom: 0;
}

/* Syntax Highlighting */
.json-key {
    color: var(--primary-color);
    font-weight: 600;
}

.json-string {
    color: var(--success-color);
}

.json-number {
    color: #e97749;
}

.json-boolean {
    color: #8b5cf6;
}

.json-null {
    color: var(--text-tertiary);
    font-style: italic;
}

/* Responsive Design */
@media (max-width: 768px) {
    .tool-card {
        padding: 1.5rem;
    }
    
    .section-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .header-actions {
        justify-content: center;
    }
    
    .action-group {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    .format-options {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .input-info,
    .output-info {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .info-panel {
        padding: 1.5rem;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .stat-item,
    .output-container,
    .tree-container {
        border-width: 2px;
    }
    
    .btn {
        border-width: 2px;
    }
}



