* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #1a1a2e;
    min-height: 100vh;
    color: #333;
}

#app {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

h1 {
    color: #f5f5f5;
    text-align: center;
    margin-bottom: 30px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.version-badge {
    font-size: 14px;
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 10px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-weight: normal;
    white-space: nowrap;
}

h2 {
    color: #212529;
    margin-bottom: 15px;
    font-size: 1.4rem;
    font-weight: 600;
}

h3 {
    color: #495057;
    margin-bottom: 10px;
    font-size: 1.1rem;
    font-weight: 500;
}

#controls {
    background: #ffffff;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 1px solid #e9ecef;
}

button {
    background: #0066cc;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

button:hover {
    background: #0052a3;
    box-shadow: 0 2px 4px rgba(0, 102, 204, 0.3);
}

button.delete-btn {
    background: #dc3545;
}

button.delete-btn:hover {
    background: #c82333;
}

.btn-small {
    background: #6c757d;
    color: white;
    border: none;
    padding: 5px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-small:hover {
    background: #5a6268;
}

#payload-count {
    margin-left: auto;
    font-weight: 600;
    font-size: 14px;
    color: #495057;
}

/* Main container for split view */
#main-container {
    display: flex !important;
    gap: 20px;
    height: calc(100vh - 200px);
    min-height: 600px;
}

#payload-list {
    background: #ffffff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    border: 1px solid #e9ecef;
    width: 40%;
    min-width: 300px;
    display: flex !important;
    flex-direction: column;
    overflow: hidden;
}

#payload-detail {
    background: #ffffff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    border: 1px solid #e9ecef;
    flex: 1;
    min-width: 400px;
    overflow-y: auto;
    display: block !important;
}

.payload-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.payload-item {
    background: #ffffff;
    padding: 12px 15px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid #dee2e6;
}

.payload-item:hover {
    border-color: #0066cc;
    box-shadow: 0 2px 8px rgba(0, 102, 204, 0.15);
}

.payload-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.timestamp {
    color: #212529;
    font-weight: 500;
    font-size: 14px;
}

.measurement-count {
    color: #212529;
    font-weight: 600;
    font-size: 14px;
}

.payload-item-info {
    font-size: 12px;
    color: #6c757d;
}

.file-size {
    font-family: 'Courier New', monospace;
}

.payload-detail-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.detail-section {
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 20px;
}

.detail-section:last-child {
    border-bottom: none;
}

.metadata p {
    margin-bottom: 8px;
    color: #495057;
}

.metadata strong {
    color: #333;
    margin-right: 8px;
}


.measurements-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-height: 75vh;
    overflow-y: auto;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
}

.measurements-grouped {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.measurement-group {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
}

.measurements-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.measurements-controls {
    display: flex;
    gap: 8px;
}

.measurement-group-header {
    background: #0066cc;
    color: white;
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease;
}

.measurement-group-header:hover {
    background: #0052a3;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.collapse-indicator {
    font-size: 12px;
    transition: transform 0.2s ease;
}

.measurement-id {
    font-weight: 600;
    font-size: 15px;
}

.measurement-count {
    background: rgba(255, 255, 255, 0.2);
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 12px;
}

.measurement-stats {
    font-size: 12px;
    opacity: 0.9;
    font-family: 'Courier New', monospace;
}

.measurement-group-items {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: all 0.3s ease;
}

.measurement-item.compact {
    padding: 8px 12px;
    border-radius: 4px;
    border-left: 3px solid #0066cc;
    transition: background 0.2s ease;
}

.measurement-item.compact.even-row {
    background: #f8f9fa;
}

.measurement-item.compact.odd-row {
    background: #ffffff;
}

.measurement-item.compact:hover {
    background: #e7f3ff;
}

.measurement-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.measurement-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}


.value-display {
    color: #212529;
    font-weight: 600;
    font-family: 'Courier New', monospace;
    background: #ffffff;
    padding: 3px 8px;
    border-radius: 3px;
    border: 1px solid #dee2e6;
}

.source-display,
.extra-display {
    color: #0066cc;
    font-size: 12px;
    background: #e7f3ff;
    padding: 2px 6px;
    border-radius: 3px;
    border: 1px solid #b3d9ff;
}

.info-display {
    color: #495057;
    font-size: 13px;
    font-family: 'Courier New', monospace;
}


/* Tabs styling */
.tabs {
    margin-top: 15px;
}

.tab-nav {
    display: flex;
    gap: 2px;
    border-bottom: 2px solid #dee2e6;
    margin-bottom: 20px;
}

.tab-button {
    background: #f8f9fa;
    color: #495057;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    border-radius: 4px 4px 0 0;
    margin-bottom: -2px;
}

.tab-button:hover {
    background: #e9ecef;
}

.tab-button.active {
    background: #ffffff;
    color: #0066cc;
    border-bottom: 2px solid #0066cc;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Hierarchical view styling */
.hierarchy-grouped {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.hierarchy-level-1,
.hierarchy-level-2,
.hierarchy-level-3,
.hierarchy-level-4 {
    margin-bottom: 8px;
}

.hierarchy-level-2 {
    margin-left: 20px;
}

.hierarchy-level-3 {
    margin-left: 40px;
}

.hierarchy-level-4 {
    margin-left: 60px;
    background: transparent;
    padding: 0;
    border: none;
}

.hierarchy-header {
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s ease;
}

.hierarchy-header.level-1 {
    background: #0066cc;
    color: white;
    font-weight: 600;
}

.hierarchy-header.level-1:hover {
    background: #0052a3;
}

.hierarchy-header.level-2 {
    background: #17a2b8;
    color: white;
}

.hierarchy-header.level-2:hover {
    background: #138496;
}

.hierarchy-header.level-3 {
    background: #6c757d;
    color: white;
}

.hierarchy-header.level-3:hover {
    background: #5a6268;
}

.hierarchy-label {
    flex-grow: 1;
}

.hierarchy-count {
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.hierarchy-content {
    padding: 8px 0;
    transition: all 0.3s ease;
}

.measurement-name {
    color: #495057;
    font-size: 13px;
    font-weight: 500;
}

.measurement-group-label {
    color: #495057;
    font-size: 13px;
    font-weight: 600;
    padding: 4px 8px;
    background: #e9ecef;
    border-radius: 4px;
    margin-bottom: 8px;
}

.value-only {
    margin-left: 20px;
}

.measurement-items {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-left: 10px;
}

/* Complex data types styling */
.complex-layout {
    flex-direction: column;
    align-items: stretch;
}

.complex-data-table {
    margin-top: 8px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 8px;
}

.complex-data-header {
    font-weight: 600;
    color: #495057;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid #dee2e6;
    font-size: 13px;
}

.route-item, .stp-item, .vty-item {
    display: flex;
    gap: 12px;
    padding: 4px 0;
    font-size: 12px;
    font-family: 'Courier New', monospace;
    border-bottom: 1px dashed #e9ecef;
}

.route-item:last-child, .stp-item:last-child, .vty-item:last-child {
    border-bottom: none;
}

.route-dest {
    color: #0066cc;
    min-width: 150px;
}

.route-next {
    color: #28a745;
    flex: 1;
}

.route-metric {
    color: #6c757d;
    font-size: 11px;
}

.stp-instance {
    color: #495057;
    min-width: 120px;
}

.stp-state {
    color: #0066cc;
    font-weight: 600;
    min-width: 120px;
}

.stp-interface {
    color: #6c757d;
}

.vty-range {
    color: #495057;
    min-width: 100px;
}

.vty-transport {
    color: #0066cc;
}

/* Proto viewer modal */
.proto-viewer-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.proto-viewer-content {
    background: #ffffff;
    width: 90%;
    max-width: 1200px;
    height: 80vh;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.proto-viewer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #dee2e6;
}

.proto-viewer-header h2 {
    margin: 0;
    color: #212529;
    font-size: 1.5rem;
}

.close-btn {
    background: none;
    border: none;
    font-size: 28px;
    color: #6c757d;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    color: #212529;
}

.proto-tab-nav {
    display: flex;
    gap: 2px;
    padding: 10px 20px;
    border-bottom: 1px solid #dee2e6;
}

.proto-tab-button {
    background: #f8f9fa;
    color: #495057;
    border: none;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
}

.proto-tab-button:hover {
    background: #e9ecef;
}

.proto-tab-button.active {
    background: #0066cc;
    color: white;
}

.proto-content {
    flex: 1;
    overflow: auto;
    padding: 20px;
    background: #f8f9fa;
}

#proto-display {
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 20px;
    font-family: 'Courier New', Consolas, Monaco, monospace;
    font-size: 13px;
    line-height: 1.6;
    color: #2d3748;
    margin: 0;
    white-space: pre;
    overflow-x: auto;
}

/* Proto schema display in tab */
.proto-sub-tabs {
    display: flex;
    flex-direction: column;
    height: 75vh;
}

.proto-tab-content {
    flex: 1;
    overflow-y: auto;
    background: #f8f9fa;
    border-radius: 0 0 8px 8px;
    padding: 10px;
}

.proto-display {
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 15px;
    font-family: 'Courier New', Consolas, Monaco, monospace;
    font-size: 12px;
    line-height: 1.5;
    overflow-x: auto;
    white-space: pre;
    color: #2d3748;
    margin: 0;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f3f5;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #adb5bd;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #868e96;
}

/* Reporter tabs styling */
.reporter-tab-nav {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid #dee2e6;
    padding-bottom: 0;
    overflow-x: auto;
    white-space: nowrap;
    flex-shrink: 0;
}

.reporter-tab-button {
    background: #f8f9fa;
    color: #495057;
    border: none;
    border-bottom: 3px solid transparent;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    border-radius: 4px 4px 0 0;
    margin-bottom: -2px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: 'Courier New', monospace;
}

.reporter-tab-button:hover {
    background: #e9ecef;
}

.reporter-tab-button.active {
    background: #ffffff;
    color: #0066cc;
    border-bottom: 3px solid #0066cc;
    font-weight: 600;
}

.reporter-payload-count {
    background: rgba(0, 102, 204, 0.1);
    color: #0066cc;
    padding: 2px 6px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}

.reporter-tab-button.active .reporter-payload-count {
    background: #0066cc;
    color: white;
}

.reporter-payload-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.reporter-payload-container h3 {
    margin: 0 0 10px 0;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
}

/* Empty state message */
.reporter-payload-container p {
    color: #6c757d;
    font-style: italic;
    text-align: center;
    padding: 20px;
}

.reporter-payload-container h3 {
    color: #212529;
    margin-bottom: 15px;
    font-size: 1.2rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.scrollable-payload-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    background: #f8f9fa;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
    margin-top: 10px;
}

/* Make scrollbar always visible when content overflows */
.scrollable-payload-list::-webkit-scrollbar {
    width: 10px;
}

.scrollable-payload-list::-webkit-scrollbar-track {
    background: #e9ecef;
    border-radius: 5px;
}

.scrollable-payload-list::-webkit-scrollbar-thumb {
    background: #6c757d;
    border-radius: 5px;
    border: 1px solid #e9ecef;
}

.scrollable-payload-list::-webkit-scrollbar-thumb:hover {
    background: #495057;
}

.payload-item.selected {
    background: #0066cc !important;
    color: white;
    border-color: #0052a3;
    box-shadow: 0 2px 8px rgba(0, 102, 204, 0.3);
}

.payload-item.selected .timestamp,
.payload-item.selected .measurement-count,
.payload-item.selected .file-size {
    color: white !important;
}

/* Empty detail message */
.empty-detail-message {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 200px;
}

.empty-detail-message p {
    color: #6c757d;
    font-style: italic;
    font-size: 16px;
}

/* Responsive design */
@media (max-width: 1024px) {
    #main-container {
        flex-direction: column;
        height: auto;
    }

    #payload-list {
        width: 100%;
        max-height: 400px;
    }

    #payload-detail {
        min-height: 400px;
    }
}

@media (max-width: 768px) {
    #app {
        padding: 10px;
    }

    #controls {
        flex-wrap: wrap;
    }

    #payload-count {
        width: 100%;
        text-align: center;
        margin-left: 0;
        margin-top: 10px;
    }

    .measurement-content {
        grid-template-columns: 1fr;
    }

    h1 {
        flex-direction: column;
        gap: 8px;
    }

    .version-badge {
        font-size: 12px;
    }

    #main-container {
        gap: 10px;
    }

    #payload-list,
    #payload-detail {
        padding: 10px;
    }
}