/* ============================================================================
   SPLIT VIEW LAYOUT
   Side-by-side panels with maximize/restore functionality
   ============================================================================ */

.split-view-container {
    display: none;
    height: calc(100vh - 40px);
    gap: 0;
    position: relative;
}

.split-view-container.active {
    display: flex;
}

/* Panels */
.split-panel {
    display: flex;
    flex-direction: column;
    min-width: 0;
    transition: flex 0.2s ease, opacity 0.2s ease, visibility 0.2s ease;
    background: #0f172a;
    overflow: hidden;
    /* Explicit reset values for when exiting maximized state */
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

.split-panel.left {
    flex: 1 1 50%;
    border-right: 1px solid #1e293b;
}

.split-panel.right {
    flex: 1 1 50%;
}

/* Panel Header */
.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    background: #0f172a;
    border-bottom: 1px solid #1e293b;
    flex-shrink: 0;
}

.panel-title {
    font-weight: 500;
    font-size: 0.8rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.panel-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.panel-action-btn {
    background: transparent;
    border: none;
    color: #475569;
    padding: 0.375rem;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    position: relative;
}

.panel-action-btn:hover {
    background: #1e293b;
    color: #94a3b8;
}

.panel-action-btn:active {
    background: #334155;
    color: #e2e8f0;
}

/* Fast custom tooltips */
.panel-action-btn[data-tooltip]::after,
.panel-expand-btn[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 8px;
    background: #1e293b;
    color: #e2e8f0;
    font-size: 0.7rem;
    white-space: nowrap;
    border-radius: 4px;
    border: 1px solid #334155;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.1s ease, visibility 0.1s ease;
    pointer-events: none;
    z-index: 1000;
}

.panel-action-btn[data-tooltip]:hover::after,
.panel-expand-btn[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
    transition-delay: 0.15s;
}

.panel-expand-btn {
    background: transparent;
    border: none;
    color: #475569;
    padding: 0.375rem;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.panel-expand-btn:hover {
    background: #1e293b;
    color: #94a3b8;
}

/* Panel Content (scrollable) */
.panel-content {
    flex: 1;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 1rem;
}

/* Resize Handle */
.split-resize-handle {
    width: 6px;
    background: #1e293b;
    cursor: col-resize;
    flex-shrink: 0;
    transition: background 0.15s ease;
    touch-action: none;
    /* Prevent scroll on touch */
}

.split-resize-handle:hover,
.split-resize-handle.dragging {
    background: #3b82f6;
}

/* Disable transitions during drag for smooth resize */
.split-view-container.resizing .split-panel {
    transition: none;
}

/* Maximized States */
.split-view-container.left-maximized .split-panel.right,
.split-view-container.right-maximized .split-panel.left {
    flex: 0 0 0 !important;
    width: 0 !important;
    min-width: 0 !important;
    opacity: 0;
    overflow: hidden;
    padding: 0;
    border: none;
    visibility: hidden;
    pointer-events: none;
}

.split-view-container.left-maximized .split-panel.left,
.split-view-container.right-maximized .split-panel.right {
    flex: 1 1 100% !important;
}

.split-view-container.left-maximized .split-resize-handle,
.split-view-container.right-maximized .split-resize-handle {
    display: none;
}

/* Restore Button */
.split-restore-btn {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    background: #1e293b;
    color: #94a3b8;
    border: 1px solid #334155;
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    z-index: 100;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
}

.split-restore-btn:hover {
    background: #334155;
    color: #e2e8f0;
    border-color: #475569;
}

.split-restore-btn.hidden {
    display: none;
}

/* Responsive: Stack on narrow screens */
@media (max-width: 900px) {
    .split-view-container {
        flex-direction: column;
    }

    .split-panel.left,
    .split-panel.right {
        flex: 1 1 50%;
        border-right: none;
        border-bottom: 1px solid #1e293b;
    }

    .split-resize-handle {
        width: 100%;
        height: 6px;
        cursor: row-resize;
    }
}

/* ============================================================================
   KEYBOARD SHORTCUTS HINT
   ============================================================================ */

.keyboard-hint {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: #64748b;
    margin-left: auto;
    padding-left: 1rem;
}

.kbd {
    display: inline-block;
    padding: 0.125rem 0.375rem;
    font-family: monospace;
    font-size: 0.7rem;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 3px;
    color: #94a3b8;
}

/* ============================================================================
   SYNC HIGHLIGHT ANIMATION (for Step 3)
   ============================================================================ */

.highlight-sync {
    animation: sync-pulse 0.5s ease-out;
}

@keyframes sync-pulse {
    0% {
        box-shadow: inset 0 0 0 2px rgba(139, 92, 246, 0.8);
    }

    100% {
        box-shadow: inset 0 0 0 2px rgba(139, 92, 246, 0);
    }
}