/* Left Panel - Recursive Hierarchical Tree Styles */

/* Fragment List Container */
.fragments-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Course Group Container (Top Level) */
.course-group {
    border: 3px solid #4f46e5;
    border-radius: 12px;
    background: white;
    overflow: hidden;
    transition: all 0.2s ease;
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.15);
    margin-bottom: 20px;
}

.course-group:hover {
    border-color: #3730a3;
    box-shadow: 0 8px 30px rgba(79, 70, 229, 0.25);
}

/* Course Header (Top Level) */
.course-header {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: white;
    padding: 18px 24px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
    font-weight: 700;
    font-size: 18px;
}

.course-header:hover {
    background: linear-gradient(135deg, #3730a3 0%, #6b21a8 100%);
}

.course-title {
    flex: 1;
}

.course-description {
    font-size: 13px;
    opacity: 0.8;
    margin-top: 4px;
    font-weight: 400;
}

.course-expand-arrow {
    margin-left: 15px;
    transition: transform 0.2s ease;
    font-size: 16px;
}

.course-header.expanded .course-expand-arrow {
    transform: rotate(180deg);
}

/* Course Content Container */
.course-content-container {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: #f8fafc;
    padding: 0;
}

.course-content-container.expanded {
    max-height: 2000px; /* Larger for nested content */
    overflow-y: auto;
    padding: 20px;
}

/* Node Group Container (Recursive - can be nested) */
.node-group {
    border: 2px solid #d0d0d0;
    border-radius: 10px;
    background: white;
    overflow: hidden;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    margin-bottom: 12px;
    position: relative;
}

.node-group:hover {
    border-color: #667eea;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.15);
}

/* Add visual connector lines for nested nodes */
.node-group:not(:first-child)::before {
    content: '';
    position: absolute;
    left: -15px;
    top: 0;
    bottom: 50%;
    border-left: 2px solid #e0e0e0;
    border-bottom: 2px solid #e0e0e0;
    width: 10px;
}

/* Last child connector line should be shorter */
.node-group:last-child::before {
    bottom: auto;
    height: 25px;
}

/* Node Header (Top Level) */
.node-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
    font-weight: 600;
    font-size: 16px;
}

.node-header:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
}

.node-title {
    flex: 1;
}

.node-path {
    font-size: 12px;
    opacity: 0.8;
    margin-top: 2px;
    font-weight: 400;
}

.node-stats {
    display: flex;
    align-items: center;
    gap: 10px;
}

.asset-count, .fragment-count-total {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.node-expand-arrow {
    margin-left: 10px;
    transition: transform 0.2s ease;
    font-size: 14px;
}

.node-header.expanded .node-expand-arrow {
    transform: rotate(180deg);
}

/* Node Content Container (holds children and assets) */
.node-content-container {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: #f8f9ff;
    padding: 0;
}

.node-content-container.expanded {
    max-height: 1500px; /* Larger for nested content */
    overflow-y: auto;
    padding: 15px;
}

/* Add left border for visual nesting indication */
.node-content-container.expanded {
    border-left: 3px solid #e0e7ff;
    margin-left: 10px;
}

/* Asset Group Container (can be at various nesting levels) */
.asset-group {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    overflow: hidden;
    transition: all 0.2s ease;
    margin-bottom: 10px;
    position: relative;
}

.asset-group:last-child {
    margin-bottom: 0;
}

.asset-group:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

/* Add subtle visual indicator for nested assets */
.asset-group::before {
    content: '';
    position: absolute;
    left: -15px;
    top: 0;
    bottom: 50%;
    border-left: 1px solid #d0d0d0;
    border-bottom: 1px solid #d0d0d0;
    width: 10px;
}

.asset-group:last-child::before {
    bottom: auto;
    height: 20px;
}

/* Asset Header (clickable) */
.asset-header {
    background: linear-gradient(135deg, #f8f9ff 0%, #f0f2ff 100%);
    padding: 12px 15px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
    border-bottom: 1px solid #e8e8e8;
}

.asset-header:hover {
    background: linear-gradient(135deg, #f0f2ff 0%, #e6ebff 100%);
}

.asset-header.expanded {
    background: linear-gradient(135deg, #e6ebff 0%, #dce4ff 100%);
}

.asset-title {
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.asset-path {
    color: #666;
    font-size: 11px;
    margin-top: 2px;
}

.fragment-count {
    background: #667eea;
    color: white;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.expand-arrow {
    margin-left: 10px;
    transition: transform 0.2s ease;
    color: #667eea;
    font-weight: bold;
}

.asset-header.expanded .expand-arrow {
    transform: rotate(180deg);
}

/* Level 3 - Fragments Container */
.fragments-container {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: #ffffff;
}

.fragments-container.expanded {
    max-height: 800px; /* Adjust based on content */
    overflow-y: auto;
}

/* Fragment Items (can be at various nesting levels) */
.fragment-item {
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
    position: relative;
}

.fragment-item:last-child {
    border-bottom: none;
}

.fragment-item:hover {
    background-color: #f8f9ff;
}

/* Add very subtle visual indicator for nested fragments */
.fragment-item::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 0;
    bottom: 50%;
    border-left: 1px solid #e8e8e8;
    border-bottom: 1px solid #e8e8e8;
    width: 5px;
}

.fragment-item:last-child::before {
    bottom: auto;
    height: 15px;
}

/* Node Description Styling */
.node-description {
    font-size: 12px;
    opacity: 0.8;
    margin-top: 2px;
    font-weight: 400;
    font-style: italic;
}

/* Compressed Path Styling */
.compressed-path {
    font-weight: 600;
    color: #4f46e5;
}

.compressed-path::after {
    content: " (compressed)";
    font-size: 10px;
    opacity: 0.7;
    font-weight: 400;
    font-style: italic;
    color: #666;
}

/* Enhanced indentation styling */
.node-group[style*="margin-left"] {
    border-left: 3px solid #e0e7ff;
}

.asset-group[style*="margin-left"] {
    border-left: 2px solid #f0f2ff;
}

.fragment-item[style*="margin-left"] {
    border-left: 1px solid #f8f9ff;
}

/* Summary Button Styling */
.summary-btn {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(99, 102, 241, 0.2);
    margin-right: 8px;
}

.summary-btn:hover {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(99, 102, 241, 0.3);
}

.summary-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(99, 102, 241, 0.2);
}

.summary-icon {
    font-size: 12px;
}

.summary-text {
    font-size: 10px;
    letter-spacing: 0.5px;
}

/* Node Actions Container */
.node-actions {
    display: flex;
    align-items: center;
    margin-right: 10px;
}

/* Asset Actions Container */
.asset-actions {
    display: flex;
    align-items: center;
    margin-right: 8px;
}

/* Update node header layout */
.node-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.node-stats {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Update asset header layout */
.asset-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

/* Modal Styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-container {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    animation: modalAppear 0.3s ease-out;
}

@keyframes modalAppear {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: white;
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header-content h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
}

.modal-type {
    font-size: 12px;
    opacity: 0.8;
    margin-top: 2px;
    font-weight: 400;
}

.modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: white;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.close-icon {
    font-size: 18px;
    font-weight: bold;
    line-height: 1;
}

.modal-body {
    padding: 24px;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-content {
    line-height: 1.6;
    color: #333;
    font-size: 14px;
}

.modal-content p {
    margin: 0 0 16px 0;
}

.modal-content p:last-child {
    margin-bottom: 0;
}

.no-summary {
    color: #666;
    font-style: italic;
    text-align: center;
    padding: 20px;
}

/* Media Type Information Styling */
.media-type-info {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.media-type-badge {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.summary-text {
    margin-top: 0;
}

.summary-text p:first-child {
    margin-top: 0;
}

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

.fragment-id {
    font-size: 11px;
    color: #666;
    font-weight: 500;
}

.fragment-position {
    background: #f0f0f0;
    color: #555;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 500;
}

.fragment-content {
    color: #333;
    line-height: 1.4;
    font-size: 13px;
}