/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* Header */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px 40px;
    text-align: center;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 10px;
}

.logo i {
    font-size: 2.5rem;
}

.logo h1 {
    font-size: 2.5rem;
    font-weight: 700;
}

.tagline {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-top: 5px;
}

/* Main content layout */
.main-content {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 30px;
    padding: 30px;
}

@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

/* Tool container */
.tool-container {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

/* Sections */
.input-section,
.output-section,
.tree-view-section,
.controls-section {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 25px;
    border: 1px solid #e9ecef;
}

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

.section-header h2 {
    font-size: 1.4rem;
    font-weight: 600;
    color: #495057;
    display: flex;
    align-items: center;
    gap: 10px;
}

.actions {
    display: flex;
    gap: 10px;
}

/* Textarea */
.textarea-container {
    position: relative;
}

textarea {
    width: 100%;
    min-height: 200px;
    padding: 20px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
    transition: border-color 0.3s;
}

textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.char-count {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.9);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    color: #6c757d;
}

/* Controls */
.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.options {
    display: flex;
    gap: 20px;
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: #495057;
}

.checkbox input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
    transform: translateY(-2px);
}

.btn-small {
    padding: 8px 16px;
    font-size: 14px;
}

/* Output */
.output-container {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
}

pre {
    margin: 0;
    padding: 20px;
    max-height: 400px;
    overflow: auto;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 14px;
    line-height: 1.5;
    background: #f8f9fa;
}

code {
    color: #333;
}

/* Syntax highlighting */
.key { color: #d73a49; font-weight: 600; }
.string { color: #032f62; }
.number { color: #005cc5; }
.boolean { color: #6f42c1; }
.null { color: #6a737d; }

body.dark-theme .key { color: #ff7b72; }
body.dark-theme .string { color: #a5d6ff; }
body.dark-theme .number { color: #79c0ff; }
body.dark-theme .boolean { color: #d2a8ff; }
body.dark-theme .null { color: #8b949e; }

.output-info {
    display: flex;
    justify-content: space-between;
    padding: 15px 20px;
    background: #e9ecef;
    border-top: 1px solid #dee2e6;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #495057;
}

/* Status indicator */
.status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
}

.status-valid {
    color: #28a745;
}

.status-invalid {
    color: #dc3545;
}

/* Tree view */
.tree-container {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    max-height: 400px;
    overflow: auto;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 14px;
}

.tree-node {
    margin-left: 20px;
    position: relative;
}

.tree-node::before {
    content: '';
    position: absolute;
    left: -15px;
    top: 0;
    bottom: 0;
    width: 1px;
    background: #dee2e6;
}

.tree-node:last-child::before {
    height: 12px;
}

.tree-toggle {
    cursor: pointer;
    color: #667eea;
    margin-right: 5px;
    user-select: none;
}

.tree-key {
    color: #d73a49;
    font-weight: 600;
}

.tree-value {
    color: #032f62;
}

.tree-type {
    color: #6a737d;
    font-style: italic;
    margin-left: 5px;
}

/* Sidebar cards */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    border: 1px solid #e9ecef;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.card h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card ul {
    list-style: none;
    margin: 15px 0;
}

.card li {
    padding: 5px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card li::before {
    content: '✓';
    color: #28a745;
    font-weight: bold;
}

/* Stats */
.stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 20px 0;
}

.stat {
    text-align: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 14px;
    color: #6c757d;
}

/* Newsletter form */
.newsletter-card {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.newsletter-card h3,
.newsletter-card p {
    color: white;
}

.form-group {
    display: flex;
    gap: 10px;
    margin: 20px 0;
}

.form-group input {
    flex: 1;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
}

.form-group input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
}

.form-message {
    padding: 10px;
    border-radius: 6px;
    margin: 10px 0;
    font-size: 14px;
    display: none;
}

.form-message.success {
    background: rgba(40, 167, 69, 0.2);
    color: #155724;
    display: block;
}

.form-message.error {
    background: rgba(220, 53, 69, 0.2);
    color: #721c24;
    display: block;
}

.small-text {
    font-size: 12px;
    opacity: 0.8;
    margin-top: 10px;
}

/* Share buttons */
.share-buttons {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.btn-share {
    width: 100%;
    justify-content: center;
}

.twitter {
    background: #1da1f2;
    color: white;
}

.linkedin {
    background: #0077b5;
    color: white;
}

.copy-link {
    background: #6c757d;
    color: white;
}

/* Footer */
.footer {
    background: #343a40;
    color: white;
    padding: 40px;
    margin-top: 30px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
    margin-bottom: 30px;
}

@media (max-width: 768px) {
    .footer-content {
        grid-template-columns: 1fr;
    }
}

.footer-section h4 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: #adb5bd;
}

.footer-section ul {
    list-style: none;
}

.footer-section li {
    margin-bottom: 8px;
}

.footer-section a {
    color: #dee2e6;
    text-decoration: none;
    transition: color 0.3s;
}

.footer-section a:hover {
    color: white;
}

.footer-bottom {
    border-top: 1px solid #495057;
    padding-top: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    color: #adb5bd;
}

.analytics-note {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #28a745;
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    animation: slideIn 0.3s ease;
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast-icon {
    font-size: 1.2rem;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Utility classes */
.hidden {
    display: none !important;
}

/* Dark theme */
body.dark-theme {
    background: #121212;
    color: #e0e0e0;
}

body.dark-theme .container {
    background: #1e1e1e;
    color: #e0e0e0;
}

body.dark-theme .input-section,
body.dark-theme .output-section,
body.dark-theme .tree-view-section,
body.dark-theme .controls-section {
    background: #2d2d2d;
    border-color: #404040;
}

body.dark-theme textarea,
body.dark-theme .output-container,
body.dark-theme .tree-container {
    background: #252525;
    border-color: #404040;
    color: #e0e0e0;
}

body.dark-theme pre {
    background: #252525;
    color: #e0e0e0;
}

body.dark-theme .card {
    background: #2d2d2d;
    border-color: #404040;
    color: #e0e0e0;
}

body.dark-theme .footer {
    background: #1a1a1a;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .header {
        padding: 20px;
    }
    
    .logo h1 {
        font-size: 2rem;
    }
    
    .main-content {
        padding: 20px;
    }
    
    .controls {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .options {
        flex-direction: column;
        gap: 10px;
    }
    
    .output-info {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    
    .footer-bottom {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
}

/* Print styles */
@media print {
    .sidebar,
    .footer,
    .controls,
    .actions {
        display: none !important;
    }
    
    .main-content {
        grid-template-columns: 1fr;
        padding: 0;
    }
    
    .container {
        box-shadow: none;
        border-radius: 0;
    }
    
    textarea,
    pre {
        border: 1px solid #ccc;
    }
}