/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #C62E2E;
    --secondary: #1e1e1e;
    --accent: #C1E172;
    --background: #f8f9fa;
    --text-dark: #1e1e1e;
    --text-muted: #6c757d;
    --white: #ffffff;
    --error: #dc3545;
    --success: #28a745;
    --warning: #ffc107;
    --border: #dee2e6;
    --shadow: rgba(0, 0, 0, 0.08);
    --shadow-hover: rgba(0, 0, 0, 0.12);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--background);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: var(--white);
    box-shadow: 0 2px 8px var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-dark);
    text-decoration: none;
    transition: all 0.3s ease;
}

.logo:hover {
    opacity: 0.8;
}

.logo i {
    font-size: 1.8rem;
}

.nav {
    display: flex;
    gap: 2rem;
}

.nav a {
    color: var(--text-dark);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav a:hover {
    color: var(--primary);
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, #a02525 100%);
    color: var(--white);
    padding: 4rem 0;
    text-align: center;
}

.hero-content {
    max-width: 800px;
    margin: 0 auto;
}

.hero-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.hero h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.hero-description {
    font-size: 1.1rem;
    opacity: 0.95;
    line-height: 1.7;
}

/* Main Content */
.main-content {
    padding: 3rem 0;
}

.tool-wrapper {
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 2px 8px var(--shadow);
    padding: 2rem;
}

/* Toolbar */
.toolbar {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--border);
}

.toolbar-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-hover);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background: #a02525;
}

.btn-secondary {
    background: var(--secondary);
    color: var(--white);
}

.btn-secondary:hover {
    background: #333;
}

.btn-danger {
    background: var(--error);
    color: var(--white);
}

.btn-danger:hover {
    background: #c82333;
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

/* View Toggle */
.view-toggle {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.view-btn {
    padding: 0.75rem 1.5rem;
    background: var(--background);
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.view-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.view-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--white);
}

/* Status Bar */
.status-bar {
    display: flex;
    gap: 2rem;
    padding: 1rem;
    background: var(--background);
    border-radius: 8px;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.status-item i {
    color: var(--primary);
}

/* Editor Container */
.editor-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.editor-panel {
    border: 2px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--background);
    border-bottom: 2px solid var(--border);
}

.panel-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.panel-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.indent-label {
    font-size: 0.9rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.indent-label select {
    padding: 0.4rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Editor Wrapper */
.editor-wrapper {
    position: relative;
    background: #282c34;
    min-height: 500px;
    max-height: 600px;
    overflow: auto;
}

.json-editor {
    width: 100%;
    height: 500px;
    padding: 1.5rem;
    padding-left: 4rem;
    background: #282c34;
    color: #abb2bf;
    border: none;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
    outline: none;
}

.json-editor::placeholder {
    color: #5c6370;
}

/* Line Numbers */
.line-numbers {
    position: absolute;
    left: 0;
    top: 0;
    padding: 1.5rem 0.5rem;
    background: #21252b;
    color: #5c6370;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    text-align: right;
    min-width: 3rem;
    border-right: 1px solid #181a1f;
    user-select: none;
}

/* JSON Output */
.json-output {
    padding: 1.5rem;
    background: #282c34;
    color: #abb2bf;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    min-height: 500px;
    max-height: 600px;
    overflow: auto;
}

.json-output:empty::before {
    content: 'Formatted JSON will appear here...';
    color: #5c6370;
}

/* Syntax Highlighting */
.json-key { color: #e06c75; }
.json-string { color: #98c379; }
.json-number { color: #d19a66; }
.json-boolean { color: #56b6c2; }
.json-null { color: #c678dd; }
.json-punctuation { color: #abb2bf; }

/* Tree View */
.tree-view {
    padding: 1.5rem;
    background: #282c34;
    color: #abb2bf;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.8;
    min-height: 500px;
    max-height: 600px;
    overflow: auto;
}

.tree-node {
    margin-left: 1.5rem;
}

.tree-key {
    color: #e06c75;
    cursor: pointer;
    user-select: none;
}

.tree-toggle {
    display: inline-block;
    width: 1rem;
    text-align: center;
    cursor: pointer;
    color: #61afef;
    margin-right: 0.3rem;
}

.tree-value {
    color: #98c379;
}

.tree-type {
    color: #5c6370;
    font-size: 0.85em;
    margin-left: 0.5rem;
}

.tree-collapsed {
    color: #5c6370;
}

/* Error Display */
.error-display {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: #fff5f5;
    border: 2px solid var(--error);
    border-radius: 8px;
}

.error-content {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.error-content i {
    font-size: 1.5rem;
    color: var(--error);
    margin-top: 0.2rem;
}

.error-details {
    flex: 1;
}

.error-details strong {
    color: var(--error);
    font-size: 1.1rem;
    display: block;
    margin-bottom: 0.5rem;
}

.error-details p {
    color: var(--text-dark);
    margin: 0.3rem 0;
}

/* Success Display */
.success-display {
    margin-top: 1.5rem;
    padding: 1rem 1.5rem;
    background: #d4edda;
    border: 2px solid var(--success);
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--success);
    font-weight: 600;
}

.success-display i {
    font-size: 1.5rem;
}

/* Features Section */
.features {
    padding: 5rem 0;
    background: var(--white);
}

.features h2 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 3rem;
    color: var(--text-dark);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.feature-card {
    padding: 2rem;
    background: var(--background);
    border-radius: 12px;
    transition: all 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px var(--shadow-hover);
}

.feature-icon {
    width: 60px;
    height: 60px;
    background: var(--primary);
    color: var(--white);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
}

.feature-card h3 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    color: var(--text-dark);
}

.feature-card p {
    color: var(--text-muted);
    line-height: 1.7;
}

/* How to Use Section */
.how-to-use {
    padding: 5rem 0;
    background: var(--background);
}

.how-to-use h2 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 3rem;
    color: var(--text-dark);
}

.steps {
    max-width: 900px;
    margin: 0 auto;
}

.step {
    display: flex;
    gap: 2rem;
    margin-bottom: 3rem;
    align-items: flex-start;
}

.step-number {
    width: 60px;
    height: 60px;
    background: var(--primary);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    font-weight: 700;
    flex-shrink: 0;
}

.step-content h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}

.step-content p {
    color: var(--text-muted);
    line-height: 1.7;
}

/* CTA Section */
.cta-section {
    padding: 5rem 0;
    background: linear-gradient(135deg, var(--secondary) 0%, #2d2d2d 100%);
    color: var(--white);
}

.cta-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 3rem;
    align-items: center;
}

.cta-text h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.cta-text p {
    font-size: 1.1rem;
    line-height: 1.7;
    opacity: 0.9;
    margin-bottom: 2rem;
}

.cta-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.cta-note {
    font-size: 0.9rem;
    opacity: 0.8;
    font-style: italic;
}

.cta-visual {
    text-align: center;
    font-size: 10rem;
    opacity: 0.2;
}

/* FAQ Section */
.faq {
    padding: 5rem 0;
    background: var(--white);
}

.faq h2 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 3rem;
    color: var(--text-dark);
}

.faq-list {
    max-width: 900px;
    margin: 0 auto;
}

.faq-item {
    margin-bottom: 1rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.faq-question {
    width: 100%;
    padding: 1.5rem;
    background: var(--white);
    border: none;
    text-align: left;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.faq-question:hover {
    background: var(--background);
}

.faq-question i {
    transition: transform 0.3s ease;
    color: var(--primary);
}

.faq-item.active .faq-question i {
    transform: rotate(180deg);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.faq-item.active .faq-answer {
    max-height: 500px;
}

.faq-answer p {
    padding: 1.5rem;
    color: var(--text-muted);
    line-height: 1.7;
    border-top: 1px solid var(--border);
}

/* Content Section */
.content-section {
    padding: 5rem 0;
    background: var(--background);
}

.content-article {
    max-width: 900px;
    margin: 0 auto;
    background: var(--white);
    padding: 3rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px var(--shadow);
}

.content-article h2 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: var(--text-dark);
}

.content-article h3 {
    font-size: 1.5rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: var(--text-dark);
}

.content-article p {
    margin-bottom: 1.5rem;
    line-height: 1.8;
    color: var(--text-muted);
}

/* Footer */
.footer {
    background: var(--secondary);
    color: var(--white);
    padding: 3rem 0 1rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h4 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--white);
}

.footer-section p {
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.7;
    margin-bottom: 1rem;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section ul li a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-section ul li a:hover {
    color: var(--accent);
}

.social-links {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.social-links a {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    text-decoration: none;
    transition: all 0.3s ease;
}

.social-links a:hover {
    background: var(--primary);
    transform: translateY(-3px);
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-bottom p {
    color: rgba(255, 255, 255, 0.6);
    margin: 0.5rem 0;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .editor-container {
        grid-template-columns: 1fr;
    }
    
    .cta-content {
        grid-template-columns: 1fr;
    }
    
    .cta-visual {
        display: none;
    }
}

@media (max-width: 768px) {
    .hero h1 {
        font-size: 2rem;
    }
    
    .hero-description {
        font-size: 1rem;
    }
    
    .toolbar {
        flex-direction: column;
    }
    
    .toolbar-group {
        width: 100%;
    }
    
    .btn {
        flex: 1;
        justify-content: center;
    }
    
    .nav {
        gap: 1rem;
    }
    
    .features h2,
    .how-to-use h2,
    .faq h2,
    .cta-text h2 {
        font-size: 2rem;
    }
    
    .step {
        flex-direction: column;
        text-align: center;
    }
    
    .step-number {
        margin: 0 auto;
    }
    
    .content-article {
        padding: 2rem;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    
    .tool-wrapper {
        padding: 1rem;
    }
    
    .hero {
        padding: 2rem 0;
    }
    
    .hero h1 {
        font-size: 1.5rem;
    }
    
    .editor-wrapper {
        min-height: 400px;
    }
    
    .json-editor {
        height: 400px;
        font-size: 12px;
    }
    
    .json-output {
        min-height: 400px;
        font-size: 12px;
    }
}

/* Scrollbar Styling */
.editor-wrapper::-webkit-scrollbar,
.json-editor::-webkit-scrollbar,
.json-output::-webkit-scrollbar,
.tree-view::-webkit-scrollbar {
    width: 10px;
}

.editor-wrapper::-webkit-scrollbar-track,
.json-editor::-webkit-scrollbar-track,
.json-output::-webkit-scrollbar-track,
.tree-view::-webkit-scrollbar-track {
    background: #21252b;
}

.editor-wrapper::-webkit-scrollbar-thumb,
.json-editor::-webkit-scrollbar-thumb,
.json-output::-webkit-scrollbar-thumb,
.tree-view::-webkit-scrollbar-thumb {
    background: #4b5263;
    border-radius: 5px;
}

.editor-wrapper::-webkit-scrollbar-thumb:hover,
.json-editor::-webkit-scrollbar-thumb:hover,
.json-output::-webkit-scrollbar-thumb:hover,
.tree-view::-webkit-scrollbar-thumb:hover {
    background: #5c6370;
}

/* Print Styles */
@media print {
    .header,
    .toolbar,
    .view-toggle,
    .cta-section,
    .footer {
        display: none;
    }
    
    .editor-container {
        grid-template-columns: 1fr;
    }
    
    .json-output {
        max-height: none;
    }
}