:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --dark-bg: #1f2937;
    --light-bg: #f8fafc;
    --border-color: #e5e7eb;
    --code-bg: #1e1e1e;
}

/* Navigation */
.site-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.nav-link {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 7px 16px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.15);
    transition: all 0.2s;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.28);
    color: white;
}

.nav-separator {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.85rem;
}

/* Breadcrumb */
.breadcrumb-nav {
    margin-bottom: 16px;
}

.breadcrumb {
    list-style: none;
    display: flex;
    gap: 6px;
    font-size: 0.88rem;
    flex-wrap: wrap;
}

.breadcrumb li {
    display: flex;
    align-items: center;
    color: rgba(255, 255, 255, 0.85);
}

.breadcrumb li:not(:last-child)::after {
    content: '›';
    margin-left: 6px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 1.1rem;
}

.breadcrumb a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    transition: opacity 0.2s;
}

.breadcrumb a:hover {
    opacity: 0.75;
    text-decoration: underline;
}

.breadcrumb [aria-current="page"] {
    color: white;
    font-weight: 600;
}

/* Tool Switcher */
.tool-switcher {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 14px;
    padding: 10px 16px;
    margin-bottom: 16px;
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
}

.tool-switcher-label {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 4px;
    white-space: nowrap;
}

.tool-switch-btn {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    transition: all 0.2s;
    white-space: nowrap;
    display: inline-block;
}

.tool-switch-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    color: white;
}

.tool-switch-btn.active {
    background: white;
    color: #667eea;
    font-weight: 700;
    border-color: white;
    pointer-events: none;
}

@media (max-width: 600px) {
    .tool-switcher {
        gap: 6px;
        padding: 8px 12px;
    }

    .tool-switch-btn {
        font-size: 0.78rem;
        padding: 5px 10px;
    }
}

/* Related Tools */
.related-tools-section {
    background: white;
    border-radius: 12px;
    padding: 25px 30px;
    margin-top: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.related-tools-section h3 {
    color: #333;
    font-size: 1.1rem;
    margin-bottom: 15px;
}

.related-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.related-link {
    display: inline-block;
    padding: 8px 18px;
    background: #f0f4ff;
    color: #4a5568;
    text-decoration: none;
    border-radius: 20px;
    font-weight: 500;
    font-size: 0.88rem;
    border: 1px solid #e2e8f0;
    transition: all 0.2s;
}

.related-link:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

/* FAQ Section */
.faq-section {
    background: white;
    border-radius: 12px;
    padding: 25px 30px;
    margin-top: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.faq-section h3 {
    color: #333;
    font-size: 1.1rem;
    margin-bottom: 15px;
}

.faq-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 12px;
}

.faq-item {
    background: #f8fafc;
    padding: 14px 18px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.faq-item summary {
    font-weight: 600;
    color: #333;
    cursor: pointer;
    padding: 4px 0;
    font-size: 0.92rem;
}

.faq-item summary:hover {
    color: var(--primary-color);
}

.faq-item p {
    margin-top: 8px;
    color: #555;
    line-height: 1.6;
    font-size: 0.9rem;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    min-height: 100vh;
    padding: 20px;
    color: #1f2937;
    transition: background 0.3s ease;
}

body.dark-theme {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

.header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
    animation: fadeInDown 0.5s ease;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.main-card {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    margin-bottom: 30px;
    animation: fadeIn 0.6s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.card-header {
    background: var(--dark-bg);
    color: white;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.card-header h2 {
    font-size: 1.5rem;
}

.controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.control-button {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 10px 18px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
    font-weight: 500;
}

.control-button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.control-button:active {
    transform: translateY(0);
}

.card-body {
    padding: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    min-height: 500px;
}

@media (max-width: 1024px) {
    .card-body {
        grid-template-columns: 1fr;
    }
}

.editor-panel,
.preview-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.panel-header {
    padding: 15px 20px;
    background: var(--light-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-title {
    font-weight: 600;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-actions {
    display: flex;
    gap: 10px;
}

.action-button {
    background: white;
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.action-button:hover {
    background: #f3f4f6;
    border-color: var(--primary-color);
}

.editor-container {
    flex: 1;
    position: relative;
    border-right: 1px solid var(--border-color);
}

#jsonInput {
    width: 100%;
    height: 100%;
    border: none;
    padding: 20px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
    resize: none;
    outline: none;
    background: var(--light-bg);
}

.preview-container {
    flex: 1;
    padding: 20px 20px 20px 60px;
    background: var(--code-bg);
    color: #d4d4d4;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
    overflow: auto;
    position: relative;
    white-space: pre;
}

.json-key {
    color: #9cdcfe;
}

.json-string {
    color: #ce9178;
}

.json-number {
    color: #b5cea8;
}

.json-boolean {
    color: #569cd6;
}

.json-null {
    color: #569cd6;
}

.json-punctuation {
    color: #d4d4d4;
}

.line-numbers {
    position: absolute;
    left: 0;
    top: 0;
    width: 50px;
    height: 100%;
    background: #2d2d2d;
    color: #858585;
    text-align: right;
    padding: 20px 8px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
    border-right: 1px solid #404040;
    user-select: none;
    overflow: hidden;
}

.options-panel {
    padding: 25px;
    background: var(--light-bg);
    border-top: 1px solid var(--border-color);
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.option-group {
    display: flex;
    flex-direction: column;
}

.option-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #374151;
    font-size: 0.9rem;
}

.option-select {
    width: 100%;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    font-size: 0.95rem;
    background: white;
    transition: border-color 0.2s;
}

.option-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
}

.checkbox-group input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.checkbox-group label {
    margin: 0;
    cursor: pointer;
    font-weight: 500;
}

.stats-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    padding: 20px;
    background: white;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.stat-item {
    text-align: center;
    padding: 10px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.stat-label {
    font-size: 0.85rem;
    color: #6b7280;
    margin-top: 5px;
}

.message {
    padding: 12px 15px;
    border-radius: 6px;
    margin: 15px 0;
    display: none;
    font-size: 0.9rem;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.show {
    display: block;
}

.error-message {
    background: #fef2f2;
    color: var(--error-color);
    border: 1px solid #fecaca;
}

.success-message {
    background: #f0fdf4;
    color: var(--success-color);
    border: 1px solid #bbf7d0;
}

.warning-message {
    background: #fffbeb;
    color: var(--warning-color);
    border: 1px solid #fed7aa;
}

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 40px;
}

.feature {
    text-align: center;
    padding: 30px 25px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.feature:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.feature-icon {
    font-size: 2.5rem;
    margin-bottom: 15px;
}

.feature h4 {
    margin-bottom: 10px;
    color: #1f2937;
}

.feature p {
    color: #6b7280;
    font-size: 0.9rem;
}

.footer {
    text-align: center;
    margin-top: 40px;
    color: white;
    opacity: 0.8;
    font-size: 0.9rem;
}

.validation-result {
    margin-top: 15px;
    padding: 15px;
    border-radius: 6px;
    display: none;
}

.validation-result.show {
    display: block;
}

.validation-success {
    background: #f0fdf4;
    color: var(--success-color);
    border: 1px solid #bbf7d0;
}

.validation-error {
    background: #fef2f2;
    color: var(--error-color);
    border: 1px solid #fecaca;
}

.error-details {
    margin-top: 10px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.85rem;
    background: white;
    padding: 12px;
    border-radius: 4px;
    border-left: 3px solid var(--error-color);
}

.copy-button {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(102, 126, 234, 0.9);
    color: white;
    border: none;
    padding: 8px 14px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
    z-index: 10;
    font-weight: 500;
}

.copy-button:hover {
    background: rgba(102, 126, 234, 1);
    transform: scale(1.05);
}

.copy-button.copied {
    background: var(--success-color);
}

.theme-toggle {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.2s;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
}

.file-input-wrapper {
    position: relative;
    overflow: hidden;
}

#fileInput {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.loading-overlay.show {
    display: flex;
}

.spinner {
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.kbd {
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 3px;
    padding: 2px 6px;
    font-family: monospace;
    font-size: 0.85em;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.shortcuts-hint {
    margin-top: 15px;
    padding: 12px;
    background: white;
    border-radius: 6px;
    font-size: 0.85rem;
    color: #6b7280;
    border: 1px solid var(--border-color);
}


/* Search Bar */
.search-bar {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #f1f5f9;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.search-bar.show {
    display: flex;
}

.search-bar input {
    flex: 1;
    min-width: 160px;
    padding: 6px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.85rem;
    outline: none;
    background: white;
}

.search-bar input:focus {
    border-color: var(--primary-color);
}

.search-count {
    font-size: 0.8rem;
    color: #64748b;
    min-width: 60px;
    white-space: nowrap;
}

.search-nav-btn {
    background: white;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 5px 9px;
    cursor: pointer;
    font-size: 0.85rem;
    color: #374151;
    transition: all 0.15s;
}

.search-nav-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Search highlight */
.search-highlight {
    background: #fef08a;
    border-radius: 2px;
}

.search-highlight.active {
    background: #f97316;
    color: white;
    border-radius: 2px;
}

/* Wrap toggle */
.json-output.wrap {
    white-space: pre-wrap;
    word-break: break-all;
}

.shortcuts-hint strong {
    color: #374151;
}

/* Toast Notification */
.toast {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    min-width: 320px;
    max-width: 520px;
    padding: 16px 20px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 500;
    color: white;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.toast-success {
    background: #10b981;
}

.toast-error {
    background: #ef4444;
}

.toast-body {
    flex: 1;
    line-height: 1.5;
}

.toast-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.toast-detail {
    font-size: 0.82rem;
    opacity: 0.92;
}

.toast-close {
    background: rgba(255, 255, 255, 0.25);
    border: none;
    color: white;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 2px 7px;
    border-radius: 6px;
    flex-shrink: 0;
    transition: background 0.15s;
}

.toast-close:hover {
    background: rgba(255, 255, 255, 0.4);
}