:root {
    --header-bg: #004085;
    --sidebar-bg: #ffffff;
    --footer-bg: #e1e4e8;
    --text-red: #d93025;
}

body {
    margin: 0;
    font-family: 'Inter', Arial, sans-serif;
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: #f0f0f0;
}

/* Header */
.header {
    background: var(--header-bg);
    color: white;
    display: flex;
    align-items: center;
    padding: 10px 15px;
    height: 50px;
}

.header-text {
    margin-left: 15px;
    font-weight: bold;
    line-height: 1.2;
}

/* Layout chính */
.main-container {
    display: flex;
    flex: 1;
    overflow: hidden;
    width: 100% !important;
    max-width: none !important;
    height: 70vh; /* Giới hạn chiều cao để kích hoạt scroll */
    min-height: 500px;
}

/* Sidebar */
.sidebar {
    width: 250px;
    min-width: 250px;
    background: var(--sidebar-bg);
    border: 1px solid #ccc;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease, min-width 0.3s ease;
}

.sidebar-header {
    background: #eee;
    padding: 5px 10px;
    border-bottom: 1px solid #ccc;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
}

/* Trạng thái thu gọn */
.sidebar.collapsed {
    width: 45px;
    min-width: 45px;
}

.sidebar.collapsed #sidebar-title,
.sidebar.collapsed .tree-view {
    display: none;
}

.tree-view {
    overflow-y: auto;
    flex: 1;
    font-size: 13px;
}

.situation-item {
    padding: 4px 25px;
    cursor: pointer;
}

.situation-item:hover { background: #e8f0fe; }

/* Video Area */
.video-section {
    flex: 1;
    background: #000; /* Chuyển nền sang đen để video nổi bật hơn */
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0; /* Loại bỏ padding để video mở rộng tối đa */
}

.video-wrapper {
    width: 100%;
    height: 100%;
    position: relative;
    background: #000;
    display: flex;
    align-items: center;
}

video {
    width: 100%;
    max-height: 100%;
    display: block;
    pointer-events: none; /* Ngăn chặn bấm nhầm vào video */
}

/* Custom Timeline theo yêu cầu cũ */
.custom-timeline {
    height: 8px;
    background: #ddd;
    width: 100%;
    position: relative;
    margin-top: 5px;
}

#scoring-zone {
    position: absolute;
    height: 100%;
    display: flex;
}

.segment { height: 100%; flex: 1; }
.s5 { background: #2ecc71; } .s4 { background: #a2d149; }
.s3 { background: #f1c40f; } .s2 { background: #e67e22; }
.s1 { background: #e74c3c; }

#progress-pointer {
    position: absolute;
    width: 2px;
    height: 100%;
    background: #007bff;
    z-index: 5;
}

#flag-marker {
    position: absolute;
    top: -25px;
    transform: translateX(-50%);
    z-index: 20;
    font-size: 20px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
    transition: left 0.1s ease-out;
}

.instruction-text {
    margin-top: 15px;
    color: var(--text-red);
    font-weight: bold;
    font-size: 14px;
}

/* Result Panel */
.result-panel {
    width: 200px;
    background: #fff;
    border: 1px solid #ccc;
    padding: 10px;
}

.result-header { text-align: center; font-weight: bold; margin-bottom: 10px; }

.score-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.score-table th, .score-table td {
    border: 1px solid #ddd;
    padding: 5px;
    text-align: center;
}

/* Bottom Controls */
.bottom-controls {
    background: var(--footer-bg);
    height: 100px;
    display: flex;
    align-items: center;
    padding: 0 20px;
    border-top: 1px solid #ccc;
}

.btn-control, .btn-nav {
    padding: 4px 12px;
    margin-right: 5px;
    cursor: pointer;
}

.hidden { display: none !important; }

/* Responsive styles for tablets and mobiles */
@media (max-width: 992px) {
    .main-container {
        flex-direction: column;
        height: auto;
        min-height: auto;
        overflow: visible;
    }
    
    .sidebar {
        width: 100%;
        min-width: 100%;
        height: 250px;
        order: 2;
    }
    
    .video-section {
        width: 100%;
        height: auto;
        aspect-ratio: 16/9;
        order: 1;
    }
    
    .result-panel {
        width: 100%;
        order: 3;
        box-sizing: border-box;
    }
    
    .bottom-controls {
        height: auto;
        padding: 15px 10px;
    }
    
    .bottom-controls > div {
        flex-direction: column;
        align-items: center;
        gap: 12px;
        width: 100%;
        padding: 0 10px;
    }
}