/* JSON Formatter Custom Styles */

/* Use system CSS variables to avoid conflicts */
body {
    background-color: var(--surface-color, #f8fafc);
}

/* Remove generic header styles to avoid conflicts with system styles */

/* Card Styles */
.card {
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* Button Group Styles */
.btn-group .btn {
    font-size: 0.875rem;
}

/* Form Controls */
.form-control, .form-select {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.875rem;
    border-radius: 0.375rem;
}

#inputJson {
    resize: vertical;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.875rem;
    line-height: 1.5;
    background-color: #ffffff;
    border: none;
    padding: 1rem;
}

#outputJson {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.875rem;
    line-height: 1.5;
    margin: 0;
    padding: 1rem;
    background-color: #f8f9fa;
    border: none;
    white-space: pre-wrap;
    word-wrap: break-word;
}

#outputCode {
    background: transparent;
    padding: 0;
    margin: 0;
}

/* JSON Syntax Highlighting */
.json-key {
    color: #0066cc;
    font-weight: 600;
}

.json-string {
    color: #009900;
}

.json-number {
    color: #cc6600;
}

.json-boolean {
    color: #990099;
    font-weight: 600;
}

.json-null {
    color: #999999;
    font-weight: 600;
}

.json-bracket {
    color: #333333;
    font-weight: 600;
}

/* Collapsible Elements */
.json-collapsible {
    cursor: pointer;
    user-select: none;
    position: relative;
}

.json-collapsible:hover {
    background-color: rgba(13, 110, 253, 0.1);
}

.json-collapsible::before {
    content: '▼';
    display: inline-block;
    width: 1em;
    color: #666;
    font-size: 0.8em;
    transition: transform 0.2s ease;
}

.json-collapsed::before {
    transform: rotate(-90deg);
}

.json-collapsed + .json-collapsible-content {
    display: none;
}

.json-collapsible-content {
    margin-left: 1.5em;
    border-left: 1px dashed #ddd;
    padding-left: 1em;
}

/* Statistics */
.stat-item {
    padding: 1rem 0;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #3b82f6;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.875rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Status Bar */
.alert {
    border-radius: 0.5rem;
}

.alert-success {
    background-color: #d1e7dd;
    border-color: #badbcc;
    color: #0f5132;
}

.alert-warning {
    background-color: #fff3cd;
    border-color: #ffecb5;
    color: #664d03;
}

.alert-danger {
    background-color: #f8d7da;
    border-color: #f5c2c7;
    color: #721c24;
}

.alert-info {
    background-color: #cff4fc;
    border-color: #b6effb;
    color: #055160;
}

/* File Upload Area */
.upload-area {
    border: 2px dashed #e2e8f0;
    border-radius: 0.5rem;
    padding: 2rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: #3b82f6;
    background-color: rgba(59, 130, 246, 0.05);
}

.upload-area.dragover {
    border-style: solid;
    transform: scale(1.02);
}

/* Loading Animation */
.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #3b82f6;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Tooltips */
.tooltip {
    font-size: 0.875rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 0.5rem;
    }

    .card-body .row.g-2 {
        flex-direction: column;
        gap: 0.5rem;
    }

    .btn-group {
        flex-wrap: wrap;
        justify-content: center;
    }

    .btn-group .btn {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }

    .stat-item {
        padding: 0.5rem 0;
    }

    .stat-value {
        font-size: 1.25rem;
    }

    #inputJson, #outputJson {
        font-size: 0.8rem;
    }
}

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

/* Focus Styles */
.btn:focus,
.form-control:focus,
.form-select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.25);
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #1a1a1a;
        color: #ffffff;
    }

    .card {
        background-color: #2d2d2d;
        border-color: #404040;
    }

    .form-control,
    .form-select {
        background-color: #3d3d3d;
        border-color: #404040;
        color: #ffffff;
    }

    #outputJson {
        background-color: #2d2d2d;
        color: #ffffff;
    }

    .json-key { color: #66b3ff; }
    .json-string { color: #66ff66; }
    .json-number { color: #ffcc66; }
    .json-boolean { color: #ff66ff; }
    .json-null { color: #cccccc; }
    .json-bracket { color: #ffffff; }
}

/* Print Styles */
@media print {
    header,
    .card-header,
    .card-footer,
    .btn-group,
    .alert {
        display: none !important;
    }

    .container {
        max-width: none;
        padding: 0;
    }

    .row.g-3 {
        gap: 0;
    }

    .col-lg-6 {
        width: 100%;
        page-break-inside: avoid;
    }

    #inputJson,
    #outputJson {
        border: 1px solid #000;
        height: auto;
        page-break-inside: avoid;
    }
}