:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #9c27b0;
    --dark-color: #343a40;
    --text-color: #333;
    --border-color: #dee2e6;
    --disabled-color: #6c757d;
    --background-color: #f8f9fa;
}

/* 添加 logo 相关样式 */
.header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    margin-bottom: 30px;
    padding: 0 20px;
}

.header-main {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo {
    width: 48px;
    height: 48px;
}

h1 {
    text-align: center;
    color: var(--text-color);
    margin: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--background-color);
    color: var(--text-color);
}

.container {
    max-width: 1500px;
    margin: 0 auto;
    padding: 20px;
}

.upload-section {
    background: white;
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    margin-bottom: 30px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.upload-section.drag-over {
    border-color: var(--primary-color);
    background-color: rgba(0, 123, 255, 0.05);
    transform: scale(1.01);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.upload-section.has-file {
    padding: 12px 20px;
    margin-bottom: 20px;
    border-style: solid;
    border-width: 1px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-align: left;
}

.upload-section.has-file .drop-text {
    display: none;
}

.upload-section.has-file .file-info {
    margin: 0;
    padding: 0;
    background: none;
    flex: 1;
}

.upload-section.has-file .file-info-group {
    justify-content: flex-start;
}

.upload-section.has-file .file-actions {
    margin: 0 0 0 20px;
}

.upload-section.has-file .control-button {
    padding: 6px 16px;
    font-size: 14px;
}

.drop-text {
    font-size: 18px;
    margin-bottom: 20px;
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.drop-text::before {
    content: '📁';
    font-size: 48px;
    margin-bottom: 10px;
    opacity: 0.8;
    transition: transform 0.3s ease;
}

.upload-section.drag-over .drop-text::before {
    transform: scale(1.1);
}

.file-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 20px 0;
}

.control-button {
    padding: 10px 24px;
    border: none;
    border-radius: 6px;
    background-color: var(--primary-color);
    color: white;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-button:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.2);
}

.control-button:active {
    transform: translateY(0);
}

.control-button.danger {
    background-color: var(--danger-color);
}

.control-button.danger:hover {
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.2);
}

.file-info {
    margin: 20px 0;
    padding: 15px;
    background-color: var(--background-color);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.file-info-group {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    font-size: 15px;
    color: var(--text-color);
    padding: 0 30px;
}

.file-info-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.file-info-label {
    color: var(--secondary-color);
}

.file-info-value {
    font-weight: 500;
}

.h264-analysis {
    display: grid;
    grid-template-columns: minmax(250px, 0.8fr) minmax(600px, 2fr);
    gap: 20px;
    margin-top: 20px;
}

.nalu-info-panel,
.hex-viewer {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    min-width: 0;
    min-height: 600px;
    overflow: visible;
}

.nalu-info-panel {
    display: flex;
    flex-direction: column;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    height: auto;
    min-height: 600px;
    overflow-y: visible;
    overflow-x: hidden;
}

.nalu-info-header,
.hex-viewer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-shrink: 0;
    color: var(--text-color);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
    min-height: 40px;
    height: 46px; /* 固定高度确保对齐 */
    box-sizing: border-box;
}

.nalu-info-header h3,
.hex-viewer-header h3 {
    margin: 0;
    color: var(--text-color);
    white-space: nowrap;
    font-size: 18px;
}

.nalu-navigation {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-left: 10px;
    flex-shrink: 0;
}

.nalu-counter {
    color: var(--secondary-color);
    font-size: 14px;
    white-space: nowrap;
    min-width: 80px;
    text-align: center;
}

.nalu-navigation .control-button {
    padding: 4px 12px;
    font-size: 13px;
    white-space: nowrap;
    min-width: 60px;
}

.nalu-type {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    padding: 12px;
    border-radius: 6px;
    color: white;
    transition: background-color 0.3s ease;
}

.nalu-type-description {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
    margin-top: 4px;
}

.nalu-type-value {
    display: inline-block;
    background-color: rgba(255, 255, 255, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 6px;
    font-size: 14px;
}

.nalu-type-indicator {
    display: inline-block;
    width: 4px;
    height: 100%;
    margin-right: 8px;
    border-radius: 2px;
}

.nalu-details {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-color);
}

.nalu-stat {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.nalu-stat-item {
    flex: 1;
    padding: 12px;
    background-color: var(--background-color);
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.nalu-stat-label {
    font-size: 12px;
    color: var(--secondary-color);
    margin-bottom: 4px;
}

.nalu-stat-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
}

.nalu-details-secondary {
    color: var(--secondary-color);
    padding: 12px;
    background-color: var(--background-color);
    border-radius: 6px;
    margin-top: 8px;
    border: 1px solid var(--border-color);
    font-family: monospace, "Courier New", Consolas;
}

.hex-content {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    font-family: 'Fira Code', monospace;
    font-size: 14px;
    line-height: 1.5;
    background: white;
    border-radius: 8px;
    color: var(--text-color);
    white-space: nowrap;
}

.hex-row {
    display: grid;
    grid-template-columns: 100px minmax(300px, 1fr) 200px;
    gap: 20px;
    padding: 2px 0;
}

.hex-row:hover {
    background: rgba(0, 0, 0, 0.05);
}

.hex-offset {
    color: var(--secondary-color);
    padding-right: 12px;
    border-right: 1px solid var(--border-color);
}

.hex-bytes {
    display: flex;
    gap: 8px;
    border-right: 1px solid var(--border-color);
    padding-right: 12px;
}

.hex-byte {
    color: var(--dark-color);
    width: 20px;
    text-align: center;
    display: inline-block;
    padding: 2px 4px;
    border-radius: 2px;
    margin: 0 2px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.hex-byte:hover {
    color: var(--primary-color);
    background: rgba(0, 123, 255, 0.1);
}

.hex-byte.start-code {
    background-color: var(--warning-color);
    font-weight: bold;
}

.hex-byte.nalu-header {
    color: white;
    transition: background-color 0.3s ease;
}

.hex-ascii {
    color: var(--success-color);
    font-family: monospace;
}

.hex-byte-tooltip {
    position: absolute;
    background-color: var(--dark-color);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    z-index: 1000;
    pointer-events: none;
    white-space: normal;
    max-width: 300px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.hex-viewer {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    height: 700px;
    overflow-y: auto;
    overflow-x: hidden;
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.nalu-info-panel,
.hex-viewer {
    position: relative;
}

.nalu-stats-panel {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
}

.nalu-stats-header {
    margin-bottom: 16px;
    color: var(--text-color);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.nalu-stats-header h3 {
    margin: 0;
    color: var(--text-color);
}

.nalu-stats-content {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.nalu-stat-card {
    background: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 12px;
}

.nalu-stat-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.nalu-stat-card-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.nalu-stat-card-title {
    font-size: 14px;
    color: var(--text-color);
    font-weight: 500;
}

.nalu-stat-card-count {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-color);
}

.nalu-stat-card-percent {
    font-size: 12px;
    color: var(--secondary-color);
}

.nalu-sequence-panel {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
}

.nalu-sequence-header {
    margin-bottom: 16px;
    color: var(--text-color);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nalu-sequence-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

.nalu-sequence-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--secondary-color);
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-color);
    transition: .4s;
    border-radius: 20px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

.toggle-switch input:checked+.toggle-slider {
    background-color: var(--primary-color);
}

.toggle-switch input:checked+.toggle-slider:before {
    transform: translateX(20px);
}

.nalu-sequence-overview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.nalu-sequence-stats {
    font-size: 14px;
    color: var(--secondary-color);
}

.nalu-sequence-content {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 8px;
    background: var(--background-color);
    border-radius: 6px;
    min-height: var(--content-height, 40px);
    align-content: flex-end;
    position: relative;
    transition: min-height 0.3s ease;
}

.nalu-sequence-item {
    width: 12px;
    height: var(--item-height, 12px);
    border-radius: 2px;
    cursor: pointer;
    transition: transform 0.2s ease;
    position: relative;
    transform-origin: bottom;
}

.nalu-sequence-item:hover {
    transform: scaleY(1) scale(1.5);
    z-index: 1;
}

.nalu-sequence-item.selected {
    box-shadow: 0 0 0 2px white, 0 0 0 4px var(--primary-color);
    z-index: 2;
}

.nalu-sequence-scale {
    position: absolute;
    left: -30px;
    bottom: 8px;
    top: 8px;
    width: 30px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    font-size: 10px;
    color: var(--secondary-color);
}

.nalu-sequence-scale-line {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
}

.nalu-sequence-scale-line::after {
    content: '';
    display: block;
    width: 4px;
    height: 1px;
    background: var(--border-color);
}

.nalu-sequence-tooltip {
    position: absolute;
    background-color: var(--dark-color);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 1000;
    display: none;
}

.file-actions.initial-actions {
    display: flex;
    gap: 12px;
}

.control-button.info {
    background-color: var(--info-color);
}

.control-button.info:hover {
    box-shadow: 0 2px 8px rgba(23, 162, 184, 0.2);
} 