/* Custom styles for video display */

/* Fix list styling for better appearance */
.markdown-section ul {
    padding-left: 2em;
}

.markdown-section ul li {
    margin-bottom: 8px;
    line-height: 1.7;
}

.markdown-section ul ul {
    margin-top: 8px;
}

.markdown-section ol {
    padding-left: 2em;
}

.markdown-section ol > li {
    margin-bottom: 12px;
    line-height: 1.7;
}

.markdown-section ol ol {
    margin-top: 8px;
}

/* Style for side-by-side video containers */
video {
    width: 100% !important;
    height: auto !important;
    display: block;
    background: #f0f0f0; /* Light gray background instead of black */
}

/* For 640x480 videos with black borders, zoom in slightly to crop them */
video[src*="sim/"] {
    object-fit: cover !important; /* This will crop black borders */
    aspect-ratio: 4/3; /* Maintain 640/480 aspect ratio */
}

/* Alternative: if you want to see the full video without cropping */
.video-contain {
    object-fit: contain !important;
}

/* Remove default browser video controls background */
video::-webkit-media-controls-panel {
    background: transparent;
}

/* Ensure flex containers work properly */
div[style*="flex"] {
    align-items: center;
}

/* Optional: Add rounded corners and shadow for better appearance */
video {
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* RGB Grid Hover Effects */
.rgb-grid-container {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 15px !important;
    max-width: 800px !important;
    margin: 20px auto !important;
}

.rgb-grid-item {
    position: relative !important;
    overflow: hidden !important;
    border-radius: 8px !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;
    transition: transform 0.3s ease, box-shadow 0.3s ease !important;
    background: #f8f9fa !important;
}

/* Video caption styles */
.video-caption {
    padding: 8px 12px !important;
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%) !important;
    color: #ffffff !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    text-align: center !important;
    letter-spacing: 0.3px !important;
    border-radius: 8px 8px 0 0 !important;
    margin: 0 !important;
    text-transform: uppercase !important;
}

.rgb-grid-item:hover {
    transform: translateY(-5px) scale(1.02) !important;
    box-shadow: 0 8px 20px rgba(0,0,0,0.2) !important;
    z-index: 10 !important;
}

.rgb-grid-item img {
    width: 100% !important;
    display: block !important;
    transition: transform 0.3s ease !important;
}

.rgb-grid-item:hover img {
    transform: scale(1.05) !important;
}

/* Hierarchical Navigation Collapse Styles */
.nav-collapse-toggle {
    display: inline-block;
    margin-left: 5px;
    cursor: pointer;
    color: #666;
    font-size: 12px;
    transition: color 0.2s ease;
    user-select: none;
    padding: 2px 4px;
}

.nav-collapse-toggle:hover {
    color: #333;
}

/* Header styles with text wrapping */
nav .summary li.header > a {
    display: block !important;
    white-space: normal !important;
    word-wrap: break-word !important;
    word-break: break-word !important;
    padding-right: 30px !important; /* Space for arrow */
    position: relative !important;
}

nav .summary li.header > a .nav-collapse-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
}

/* Keep existing header styling */
nav .summary li.header {
    font-weight: 600;
    margin: 12px 0 8px 0;
}

nav .summary li.header > a {
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    border-left: 4px solid #e2e8f0;
    border-radius: 0 6px 6px 0;
    padding: 10px 40px 10px 12px !important; /* Right padding for arrow */
    font-size: 14px;
    color: #2d3748;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    line-height: 1.4;
}

nav .summary li.header > a:hover {
    background: linear-gradient(135deg, #edf2f7 0%, #e2e8f0 100%);
    border-left-color: #4299e1;
    transform: translateX(2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Subheader (H2) styles */
nav .summary li.subheader {
    margin-left: 16px;
    margin-top: 6px;
    margin-bottom: 4px;
    position: relative;
}

nav .summary li.subheader::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 4px;
    background: #cbd5e0;
    border-radius: 50%;
}

nav .summary li.subheader > a {
    display: block !important;
    white-space: normal !important;
    word-wrap: break-word !important;
    padding: 8px 40px 8px 12px !important;
    color: #4a5568;
    font-size: 13px;
    font-weight: 500;
    border-radius: 4px;
    transition: all 0.15s ease;
    position: relative !important;
    background: rgba(226, 232, 240, 0.2);
}

nav .summary li.subheader > a:hover {
    background: rgba(66, 153, 225, 0.12);
    color: #2b6cb0;
    transform: translateX(2px);
}

nav .summary li.subheader > a .nav-collapse-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
}

/* Subitem (H3) styles */
nav .summary li.subitem {
    margin-left: 32px;
    margin-top: 3px;
    margin-bottom: 3px;
    position: relative;
}

nav .summary li.subitem::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 1px;
    background: #e2e8f0;
}

nav .summary li.subitem > a {
    padding: 5px 12px;
    color: #718096;
    font-size: 12px;
    border-radius: 3px;
    transition: all 0.15s ease;
    position: relative;
    display: block;
}

nav .summary li.subitem > a:hover {
    background: rgba(66, 153, 225, 0.08);
    color: #2b6cb0;
    transform: translateX(2px);
}

nav .summary li.subitem > a.active {
    background: linear-gradient(90deg, rgba(66, 153, 225, 0.12) 0%, rgba(66, 153, 225, 0.03) 100%);
    color: #2b6cb0;
    font-weight: 500;
}

/* Regular items (non-header, non-subheader, non-subitem) */
nav .summary li:not(.header):not(.subheader):not(.subitem):not(.divider) {
    margin-left: 16px;
    margin-top: 4px;
    margin-bottom: 4px;
    position: relative;
}

nav .summary li:not(.header):not(.subheader):not(.subitem):not(.divider)::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 4px;
    background: #e2e8f0;
    border-radius: 50%;
}

nav .summary li:not(.header):not(.subheader):not(.subitem):not(.divider) > a {
    padding: 6px 16px;
    color: #4a5568;
    font-size: 13px;
    border-radius: 4px;
    transition: all 0.15s ease;
    position: relative;
    display: block;
}

nav .summary li:not(.header):not(.subheader):not(.subitem):not(.divider) > a:hover {
    background: rgba(66, 153, 225, 0.08);
    color: #2b6cb0;
    transform: translateX(3px);
}

nav .summary li:not(.header):not(.subheader):not(.subitem):not(.divider) > a.active {
    background: linear-gradient(90deg, rgba(66, 153, 225, 0.15) 0%, rgba(66, 153, 225, 0.05) 100%);
    color: #2b6cb0;
    font-weight: 600;
}