:root {
    --bg-color: #0f172a;
    --bg-secondary: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --accent-color: #3b82f6;
    --accent-hover: #2563eb;
    --border-color: #334155;
    --success-color: #22c55e;
    --warning-color: #eab308;
    --error-color: #ef4444;
    --info-color: #3b82f6;
    --debug-color: #94a3b8;
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-sans);
    height: 100vh;
    overflow: hidden;
}

/* Helpers */
.hidden {
    display: none !important;
}

/* Drop Zone */
.drop-zone {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    border: 2px dashed var(--border-color);
    margin: 20px;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.drop-zone.drag-over {
    border-color: var(--accent-color);
    background-color: rgba(59, 130, 246, 0.1);
}

.drop-content {
    text-align: center;
}

.drop-content h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    background: linear-gradient(to right, #60a5fa, #a78bfa);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.drop-content p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

/* Buttons */
.primary-btn {
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s;
}

.primary-btn:hover {
    background-color: var(--accent-hover);
}

.secondary-btn {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.secondary-btn:hover {
    border-color: var(--text-primary);
    color: var(--text-primary);
}

/* App Container */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.app-logo {
    height: 32px;
    width: auto;
}

.logo-text {
    font-weight: 700;
    font-size: 1.25rem;
}

.file-info {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Main Layout */
.main-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 300px;
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.filter-controls {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.filter-btn-all,
.filter-btn-none {
    flex: 1;
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    border: 1px solid var(--border-color);
    background-color: var(--bg-color);
    color: var(--text-secondary);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn-all:hover,
.filter-btn-none:hover {
    background-color: var(--border-color);
    color: var(--text-primary);
}

.filter-section h3 {
    margin-bottom: 1.5rem;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.filter-group {
    margin-bottom: 1.5rem;
}

.filter-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.filter-group input[type="text"] {
    width: 100%;
    padding: 0.5rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-color);
    color: var(--text-primary);
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.checkbox-group.scrollable {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.checkbox-item:hover {
    color: var(--text-primary);
}

/* Related Logs Panel */
.related-panel {
    height: 300px;
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    width: 100%;
    position: relative;
    z-index: 10;
    flex-shrink: 0;
}

.related-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background-color: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
}

.related-header h3 {
    margin: 0;
    font-size: 1rem;
    color: var(--text-primary);
}

.related-log-list {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.related-list-header {
    display: grid;
    grid-template-columns: 220px 80px 150px 1fr;
    gap: 1.5rem;
    padding: 0 1.5rem;
    height: 30px;
    align-items: center;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.related-log-item {
    display: grid;
    grid-template-columns: 220px 80px 150px 1fr;
    gap: 1.5rem;
    padding: 0.25rem 1.5rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    cursor: default;
    border-bottom: 1px solid transparent;
}

.related-log-item:hover {
    background-color: var(--highlight-color);
}

.related-log-item.highlighted-log {
    background-color: rgba(59, 130, 246, 0.2);
    border-left: 3px solid var(--primary-color);
}



/* Close Button */
.icon-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0 0.5rem;
}

.icon-btn:hover {
    color: var(--text-primary);
}

.content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

.timeline-container {
    height: 100px;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: relative;
}

#timeline-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.log-list-container {
    flex: 1;
    overflow: auto;
    background-color: var(--bg-color);
    position: relative;
    display: flex;
    flex-direction: column;
}

.log-header {
    display: grid;
    grid-template-columns: 220px 80px 150px 1fr;
    gap: 1.5rem;
    padding: 0 1rem;
    height: 36px;
    align-items: center;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    flex-shrink: 0;
    /* Prevent shrinking */
    z-index: 5;
}

.virtual-scroller {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    /* height will be set dynamically via spacer */
}

.scroller-spacer {
    height: 1px;
    /* Will be set to total height */
}

.log-list {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    will-change: transform;
}

/* Log Item */
.log-item {
    display: grid;
    grid-template-columns: 220px 80px 150px 1fr;
    gap: 1.5rem;
    padding: 0 1rem;
    height: 30px;
    align-items: center;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    border-bottom: 1px solid rgba(51, 65, 85, 0.4);
    cursor: pointer;
    white-space: nowrap;
}

.log-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.log-item.highlighted-log {
    background-color: rgba(59, 130, 246, 0.15);
    border-left: 2px solid var(--accent-color);
}

.log-ts {
    color: var(--text-secondary);
}

.log-sev {
    font-weight: 600;
}

.log-tenant {
    color: #a78bfa;
}

.log-msg {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #e2e8f0;
}

/* Severity Colors */
.sev-INF {
    color: var(--info-color);
}

.sev-DBG,
.sev-VRB {
    color: var(--debug-color);
}

.sev-ERR,
.sev-FAT {
    color: var(--error-color);
}

.sev-WRN {
    color: var(--warning-color);
}

/* Details Panel */
.details-panel {
    width: 400px;
    min-width: 300px;
    max-width: 800px;
    background-color: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 15px rgba(0, 0, 0, 0.3);
    z-index: 10;
    position: relative;
    transition: transform 0.3s ease;
}

.resize-handle {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 5px;
    cursor: col-resize;
    z-index: 20;
    /* invisible handle area */
    background: transparent;
}

.resize-handle:hover,
.details-panel.resizing .resize-handle {
    background: var(--accent-color);
}

/* ... existing styles ... */

/* Responsive Layout */
@media (max-width: 1024px) {
    .main-layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        max-height: 250px;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .filter-section h3 {
        margin-bottom: 0.5rem;
    }

    .filter-group {
        display: inline-block;
        margin-right: 1.5rem;
        vertical-align: top;
        margin-bottom: 0.5rem;
    }

    .checkbox-group.scrollable {
        max-height: 100px;
    }

    .details-panel {
        width: 100% !important;
        height: 40%;
        border-left: none;
        border-top: 1px solid var(--border-color);
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 50;
    }

    .details-panel.hidden {
        transform: translateY(100%);
        display: flex !important;
        /* Keep display flex for transition */
    }

    .resize-handle {
        display: none;
        /* No horizontal resize on mobile */
    }

    /* Mobile Log List */
    .row-header {
        display: none;
    }

    .log-item {
        display: block;
        height: auto !important;
        /* Hide Tenant on mobile to save space */
    }

    .log-tenant {
        display: none;
    }

    .log-ts {
        font-size: 0.75rem;
    }
}


.details-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
}

.details-content {
    padding: 1.5rem;
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    white-space: pre-wrap;
    word-break: break-all;
}

.detail-row {
    margin-bottom: 1rem;
}

.detail-label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
}

.detail-value {
    color: var(--text-primary);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(15, 23, 42, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(59, 130, 246, 0.3);
    border-radius: 50%;
    border-top-color: var(--accent-color);
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

.progress-bar {
    width: 300px;
    height: 8px;
    background-color: var(--bg-secondary);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 1rem;
}

.progress-fill {
    height: 100%;
    background-color: var(--accent-color);
    width: 0%;
    transition: width 0.1s linear;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #475569;
}