/* Custom styles for Firebase Database Editor */

/* Tree node animations and styles */
.tree-node {
    transition: all 0.2s ease-in-out;
    border-radius: 0.375rem;
    padding: 0.5rem;
    margin: 0.125rem 0;
    cursor: pointer;
    border-left: 3px solid transparent;
}

.tree-node:hover {
    background-color: #f3f4f6;
    border-left-color: #ff6b35;
}

.tree-node.active {
    background-color: #fef2f2;
    border-left-color: #ff6b35;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.tree-node.expanded > .node-content .expand-icon {
    transform: rotate(90deg);
}

.tree-children {
    margin-left: 1rem;
    border-left: 1px dashed #d1d5db;
    padding-left: 0.75rem;
}

.expand-icon {
    transition: transform 0.2s ease-in-out;
    color: #6b7280;
}

/* Node type indicators */
.node-type-object {
    color: #3b82f6;
}

.node-type-array {
    color: #10b981;
}

.node-type-string {
    color: #8b5cf6;
}

.node-type-number {
    color: #f59e0b;
}

.node-type-boolean {
    color: #ef4444;
}

.node-type-null {
    color: #6b7280;
}

/* Tab styles */
.tab-button {
    position: relative;
    transition: all 0.2s ease-in-out;
}

.tab-button.active {
    color: #ff6b35;
    border-bottom-color: #ff6b35;
}

.tab-button:not(.active):hover {
    color: #374151;
    border-bottom-color: #d1d5db;
}

/* Data display styles */
.data-item {
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    margin-bottom: 0.5rem;
    transition: all 0.2s ease-in-out;
}

.data-item:hover {
    border-color: #ff6b35;
    box-shadow: 0 1px 3px 0 rgba(255, 107, 53, 0.1);
}

.data-key {
    font-weight: 600;
    color: #374151;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
}

.data-value {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.875rem;
    line-height: 1.25rem;
}

.data-value.string {
    color: #059669;
}

.data-value.number {
    color: #dc2626;
}

.data-value.boolean {
    color: #7c3aed;
}

.data-value.null {
    color: #6b7280;
    font-style: italic;
}

/* Breadcrumb styles */
.breadcrumb-item {
    transition: all 0.2s ease-in-out;
}

.breadcrumb-item:hover {
    background-color: #fef2f2;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
}

.breadcrumb-separator {
    color: #9ca3af;
    margin: 0 0.5rem;
}

/* JSON syntax highlighting */
.json-key {
    color: #059669;
    font-weight: 600;
}

.json-string {
    color: #dc2626;
}

.json-number {
    color: #7c3aed;
}

.json-boolean {
    color: #ea580c;
}

.json-null {
    color: #6b7280;
    font-style: italic;
}

.json-punctuation {
    color: #374151;
}

/* Animation classes */
.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

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

.slide-in {
    animation: slideIn 0.2s ease-in-out;
}

@keyframes slideIn {
    from {
        transform: translateX(-10px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Loading states */
.loading-skeleton {
    background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Notification styles */
#notification.show {
    transform: translateY(0);
}

.notification-success {
    border-left: 4px solid #10b981;
}

.notification-error {
    border-left: 4px solid #ef4444;
}

.notification-warning {
    border-left: 4px solid #f59e0b;
}

.notification-info {
    border-left: 4px solid #3b82f6;
}

/* Modal styles */
#modal.show {
    display: flex;
}

#settingsModal.show {
    display: flex;
}

.modal-backdrop {
    backdrop-filter: blur(4px);
}

/* Search highlight */
.search-highlight {
    background-color: #fef3c7;
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    font-weight: 600;
}

/* Form validation */
.form-error {
    border-color: #ef4444;
    background-color: #fef2f2;
}

.form-success {
    border-color: #10b981;
    background-color: #f0fdf4;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .tree-children {
        margin-left: 0.75rem;
        padding-left: 0.5rem;
    }
}

@media (max-width: 768px) {
    .breadcrumb-item {
        font-size: 0.875rem;
    }
    
    .tree-node {
        padding: 0.375rem;
    }
    
    .data-item {
        font-size: 0.875rem;
    }
}

/* Context menu styles */
.context-menu {
    position: absolute;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    z-index: 1000;
    min-width: 150px;
}

.context-menu-item {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out;
    font-size: 0.875rem;
}

.context-menu-item:hover {
    background-color: #f3f4f6;
}

.context-menu-item:first-child {
    border-radius: 0.375rem 0.375rem 0 0;
}

.context-menu-item:last-child {
    border-radius: 0 0 0.375rem 0.375rem;
}

.context-menu-separator {
    height: 1px;
    background-color: #e5e7eb;
    margin: 0.25rem 0;
}

/* Value editor specific styles */
.value-editor {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
}

.value-editor.object,
.value-editor.array {
    white-space: pre;
    tab-size: 2;
}

/* Path indicator */
.path-indicator {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.875rem;
    color: #6b7280;
    background-color: #f9fafb;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    border: 1px solid #e5e7eb;
}

/* Drag and drop styles */
.drag-over {
    border: 2px dashed #ff6b35;
    background-color: #fef2f2;
}

.dragging {
    opacity: 0.5;
}

/* Custom scrollbar */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Apply custom scrollbar to specific elements */
#dataTree,
#dataDisplay,
#rawDisplay {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f1f5f9;
}

/* Settings modal styles */
.settings-tab-button {
    position: relative;
    transition: all 0.2s ease-in-out;
}

.settings-tab-button.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
}

.settings-tab-button:not(.active):hover {
    color: #374151;
    border-bottom-color: #d1d5db;
}

.settings-tab-content {
    animation: fadeInUp 0.3s ease-in-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Configuration form styles */
.config-field-group {
    transition: all 0.2s ease-in-out;
}

.config-field-group:focus-within {
    transform: scale(1.01);
}

.preset-item {
    transition: all 0.2s ease-in-out;
    cursor: pointer;
}

.preset-item:hover {
    background-color: #f3f4f6;
    border-color: #3b82f6;
    box-shadow: 0 1px 3px 0 rgba(59, 130, 246, 0.1);
}

.preset-item.active {
    background-color: #dbeafe;
    border-color: #3b82f6;
}

/* Connection status indicators */
.status-connecting {
    background-color: #fbbf24;
    animation: pulse 2s infinite;
}

.status-connected {
    background-color: #10b981;
}

.status-disconnected {
    background-color: #ef4444;
    animation: pulse 2s infinite;
}

.status-error {
    background-color: #dc2626;
}

/* Form validation styles */
.field-valid {
    border-color: #10b981;
    background-color: #f0fdf4;
}

.field-invalid {
    border-color: #ef4444;
    background-color: #fef2f2;
}

.validation-message {
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

.validation-success {
    color: #10b981;
}

.validation-error {
    color: #ef4444;
}

/* File input styling */
input[type="file"] {
    transition: all 0.2s ease-in-out;
}

input[type="file"]:hover {
    background-color: #f9fafb;
}

/* JSON editor styling */
.json-editor {
    font-family: 'JetBrains Mono', 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    line-height: 1.5;
}

.json-syntax-error {
    border-color: #ef4444;
    background-color: #fef2f2;
}

/* Settings modal responsive */
@media (max-width: 768px) {
    #settingsModal .max-w-2xl {
        max-width: calc(100vw - 2rem);
    }
    
    .settings-tab-button {
        font-size: 0.875rem;
        padding: 0.75rem 0.5rem;
    }
    
    .grid.md\\:grid-cols-2 {
        grid-template-columns: 1fr;
    }
}

/* Preset item animations */
.preset-enter {
    animation: slideInRight 0.3s ease-in-out;
}

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

.preset-leave {
    animation: slideOutRight 0.2s ease-in-out forwards;
}

@keyframes slideOutRight {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(20px);
    }
}