/* Modern Custom Styles for JSON Viewer */

/* Smooth Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.animate-fadeIn {
    animation: fadeIn 0.3s ease-out;
}

.animate-scaleIn {
    animation: scaleIn 0.2s ease-out;
}

/* Monaco Editor Container */
#editorContainer {
    position: relative;
    width: 100%;
    height: 100%;
    outline: none;
    background: transparent;
}

/* Monaco Editor Styles */
.monaco-editor {
    cursor: text !important;
    border-radius: 0.5rem;
}

.monaco-editor .margin {
    background-color: transparent !important;
}

.monaco-editor .monaco-editor-background {
    background-color: transparent !important;
}

/* Fallback Textarea */
#editorContainer textarea {
    width: 100%;
    height: 100%;
    padding: 1rem;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    border: none;
    resize: none;
    outline: none;
    background: transparent;
    color: inherit;
}

.dark #editorContainer textarea {
    color: #e5e7eb;
}

/* Smooth Scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
}

.dark ::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    transition: background 0.2s;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

.dark ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
}

.dark ::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Tree View Styles */
/* Ultra-Modern Compact JSON Tree Styles with Data Type Indicators */
.json-tree {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    font-size: 11px;
    line-height: 1.4;
    color: #1f2937;
}

.json-tree-node {
    margin: 0;
    user-select: none;
    transition: all 0.15s ease;
}

.json-tree-node:hover {
    background-color: rgba(59, 130, 246, 0.03);
}

.json-tree-root {
    padding: 10px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.json-tree-key {
    color: #9333ea;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-block;
    font-size: 11px;
}

.json-tree-key:hover {
    color: #7c3aed;
    transform: scale(1.01);
}

.json-tree-value {
    color: #1f2937;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-block;
    font-size: 11px;
}

.json-tree-value:hover {
    transform: scale(1.01);
}

.json-tree-string {
    color: #16a34a;
    font-size: 11px;
}

.json-tree-number {
    color: #2563eb;
    font-size: 11px;
}

.json-tree-boolean {
    color: #ea580c;
    font-size: 11px;
}

.json-tree-null {
    color: #6b7280;
    font-style: italic;
    font-size: 11px;
}

.json-tree-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    color: #6b7280;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.json-tree-toggle svg {
    transition: transform 0.15s ease;
}

.json-tree-toggle:hover {
    color: #374151;
    background-color: rgba(0, 0, 0, 0.05);
}

.json-tree-toggle.expanded svg {
    transform: rotate(90deg);
}

.json-tree-children {
    transition: all 0.2s ease;
    overflow: hidden;
}

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

.json-tree-highlight {
    background: linear-gradient(120deg, #fef08a 0%, #fde047 100%) !important;
    padding: 1px 4px !important;
    border-radius: 3px !important;
    font-weight: 600 !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    animation: pulse 2s ease-in-out infinite;
}

/* Data Type Badge Styles */
.json-tree-type-badge {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    letter-spacing: 0.5px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 16px;
    transition: all 0.15s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.json-tree-type-badge:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.85;
    }
}

/* Smooth transitions for expand/collapse */
.json-tree-children {
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 5000px;
    }
}

/* Drag and Drop Zone */
.drag-over {
    border: 3px dashed #3b82f6 !important;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(99, 102, 241, 0.1) 100%) !important;
    transform: scale(1.02);
    transition: all 0.3s;
}

.dark .drag-over {
    border-color: #60a5fa !important;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2) 0%, rgba(99, 102, 241, 0.2) 100%) !important;
}

/* Error Highlight */
.error-line {
    background: linear-gradient(90deg, #fee2e2 0%, #fecaca 100%);
    border-left: 4px solid #ef4444;
    padding-left: 8px;
    animation: pulse 2s infinite;
}

.dark .error-line {
    background: linear-gradient(90deg, #7f1d1d 0%, #991b1b 100%);
    border-left-color: #f87171;
}

/* Status Indicator */
.status-valid {
    color: #10b981;
}

.status-invalid {
    color: #ef4444;
    animation: pulse 1s infinite;
}

.status-processing {
    color: #f59e0b;
    animation: pulse 1.5s infinite;
}

/* Button Hover Effects */
button {
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

button:active {
    transform: scale(0.95);
}

button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

button:active::before {
    width: 300px;
    height: 300px;
}

/* History Item */
.history-item {
    padding: 14px;
    border-radius: 12px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
    background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
}

.dark .history-item {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
}

.history-item:hover {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    transform: translateX(6px);
    border-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.dark .history-item:hover {
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
    border-color: #60a5fa;
}

/* Modal Animation */
.modal-content {
    animation: scaleIn 0.2s ease-out;
}

/* Code Block Styling in Modal */
.modal-content pre {
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    padding: 20px;
    border-radius: 12px;
    overflow-x: auto;
    margin: 16px 0;
    border: 1px solid #d1d5db;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.dark .modal-content pre {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    border-color: #374151;
}

.modal-content code {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
    line-height: 1.8;
}

/* Notification Toast */
.notification-toast {
    animation: slideInRight 0.3s ease-out, fadeOut 0.3s ease-in 2.7s;
}

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

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* Responsive Adjustments */
@media (max-width: 1024px) {
    .grid-cols-1.lg\\:grid-cols-2 {
        grid-template-columns: 1fr;
    }
    
    #treeView, #editorContainer {
        min-height: 400px !important;
    }
}

/* Loading Spinner */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* Pulse Animation */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Focus Styles */
*:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
    border-radius: 4px;
}

/* Selection Styles */
::selection {
    background-color: rgba(59, 130, 246, 0.3);
    color: inherit;
}

.dark ::selection {
    background-color: rgba(96, 165, 250, 0.3);
}

/* Smooth Transitions */
* {
    transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

/* Glass Morphism Effect */
.backdrop-blur-xl {
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

/* Gradient Text */
.bg-clip-text {
    -webkit-background-clip: text;
    background-clip: text;
}

/* FAQ Accordion Styles */
.faq-item {
    transition: all 0.3s ease;
}

.faq-question {
    cursor: pointer;
    user-select: none;
}

.faq-question:hover {
    background-color: #f3f4f6 !important;
}

.faq-question:focus {
    outline: none;
    ring: 2px;
    ring-color: #3b82f6;
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, padding 0.3s ease-out;
}

.faq-answer:not(.hidden) {
    max-height: 500px;
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.faq-icon {
    transition: transform 0.3s ease;
}

.faq-item.active .faq-icon {
    transform: rotate(180deg);
}

/* Smooth accordion animation */
@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
    }
    to {
        opacity: 1;
        max-height: 500px;
        padding-top: 1rem;
        padding-bottom: 1rem;
    }
}

.faq-answer:not(.hidden) {
    animation: slideDown 0.3s ease-out;
}
