/* File Browser Styles */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}
.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow: hidden;
}
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 30px;
}
header h1 {
    font-size: 24px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
    font-size: 14px;
    opacity: 0.9;
}
.breadcrumb a {
    color: white;
    text-decoration: none;
    padding: 2px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}
.breadcrumb a:hover { background: rgba(255,255,255,0.2); }
.controls {
    padding: 20px 30px;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
}
.search-box {
    flex: 1;
    min-width: 200px;
    position: relative;
}
.search-box input {
    width: 100%;
    padding: 10px 40px 10px 15px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}
.search-box input:focus {
    outline: none;
    border-color: #667eea;
}
.search-box .clear-search {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: #999;
    display: none;
}
.search-box.has-value .clear-search { display: block; }
.sort-controls {
    display: flex;
    gap: 10px;
}
.sort-btn {
    padding: 10px 15px;
    border: 2px solid #dee2e6;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}
.sort-btn:hover {
    border-color: #667eea;
    color: #667eea;
}
.sort-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}
.file-list { min-height: 400px; position: relative; }
.loading {
    display: none;
    text-align: center;
    padding: 60px 20px;
    color: #999;
}
.loading.active { display: block; }
.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
table {
    width: 100%;
    border-collapse: collapse;
}
thead {
    background: #f8f9fa;
    position: sticky;
    top: 0;
    z-index: 10;
}
th {
    padding: 15px 20px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    color: #666;
    border-bottom: 2px solid #dee2e6;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s;
    position: relative;
}
th:hover {
    background: #e9ecef;
    color: #667eea;
}
th.sortable::after {
    content: ' ⇅';
    opacity: 0.3;
    font-size: 14px;
    margin-left: 5px;
}
th.sortable:hover::after {
    opacity: 0.6;
}
th.sort-asc::after {
    content: ' ↑';
    opacity: 1;
    color: #667eea;
    font-weight: bold;
}
th.sort-desc::after {
    content: ' ↓';
    opacity: 1;
    color: #667eea;
    font-weight: bold;
}
th.sort-asc,
th.sort-desc {
    color: #667eea;
    background: #f0f4ff;
}
td {
    padding: 12px 20px;
    border-bottom: 1px solid #f0f0f0;
}
tr:hover { background: #f8f9fa; }
.file-name {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #333;
}
.file-name a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}
.file-name a:hover {
    color: #764ba2;
    text-decoration: underline;
}
.file-icon {
    font-size: 20px;
    flex-shrink: 0;
}
.file-size, .file-date {
    color: #666;
    font-size: 14px;
}
.preview-badge {
    display: inline-block;
    padding: 2px 8px;
    background: #e3f2fd;
    color: #1976d2;
    border-radius: 4px;
    font-size: 11px;
    margin-left: 8px;
    font-weight: 600;
}
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}
.empty-state-icon {
    font-size: 64px;
    margin-bottom: 15px;
    opacity: 0.5;
}
.pagination {
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #dee2e6;
    background: #f8f9fa;
}
.pagination-info {
    color: #666;
    font-size: 14px;
}
.pagination-controls {
    display: flex;
    gap: 5px;
}
.page-btn {
    padding: 8px 12px;
    border: 1px solid #dee2e6;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}
.page-btn:hover:not(:disabled) {
    background: #667eea;
    color: white;
    border-color: #667eea;
}
.page-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}
.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.stats {
    padding: 15px 30px;
    background: #e3f2fd;
    border-top: 1px solid #90caf9;
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: #1565c0;
}
.preview-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.95);
    z-index: 1000;
    animation: fadeIn 0.2s;
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.preview-modal.active {
    display: flex;
    flex-direction: column;
}

/* Special handling for code mode */
.preview-modal.code-modal {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.preview-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    min-height: 0; /* Critical for flexbox scrolling */
}

.preview-modal.code-modal .preview-content {
    overflow: hidden;
}
.preview-header {
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0,0,0,0.8);
    color: white;
    backdrop-filter: blur(10px);
}
.preview-header h3 {
    font-size: 16px;
    font-weight: 500;
    margin: 0;
}
.preview-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}
.preview-btn {
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
}
.preview-btn:hover {
    background: rgba(255,255,255,0.2);
}
.preview-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}
.preview-close {
    background: rgba(255,0,0,0.3);
}
.preview-close:hover {
    background: rgba(255,0,0,0.5);
}
.admin-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
.admin-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.2);
}
.admin-btn:active {
    transform: translateY(0);
}
.admin-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}
.preview-body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    background: rgba(0,0,0,0.5);
    min-height: 0; /* Critical for flexbox scrolling */
}

.preview-body.code-mode {
    align-items: flex-start !important;
    justify-content: flex-start !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    display: block !important;
    -webkit-overflow-scrolling: touch;
    padding: 0 !important;
}

/* Scrollbar styling for code preview */
.preview-body.code-mode::-webkit-scrollbar {
    width: 12px;
}

.preview-body.code-mode::-webkit-scrollbar-track {
    background: #1e1e1e;
}

.preview-body.code-mode::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 6px;
}

.preview-body.code-mode::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}
.image-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* When in code mode, imageContainer should not restrict height */
.preview-body.code-mode .image-container {
    height: auto;
    min-height: 100%;
    display: block;
    overflow: visible;
    align-items: stretch;
    justify-content: stretch;
}
.preview-body img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
    cursor: zoom-in;
}
.preview-body img.zoomed {
    cursor: zoom-out;
}
.nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.9);
    border: none;
    color: #333;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 24px;
    z-index: 10;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.nav-btn:hover {
    background: white;
    transform: translateY(-50%) scale(1.1);
}
.nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}
.nav-btn.prev {
    left: 20px;
}
.nav-btn.next {
    right: 20px;
}
.image-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 15px;
    text-align: center;
    font-size: 14px;
    backdrop-filter: blur(10px);
}

/* In code mode, image-info should be fixed at bottom of viewport, not content */
.preview-modal.code-modal .image-info {
    position: fixed;
    z-index: 1001;
}
.zoom-controls {
    display: flex;
    gap: 5px;
}
.code-preview {
    width: 100%;
    background: #1e1e1e;
    min-height: fit-content;
}

.code-preview > pre {
    margin: 0;
    padding: 20px;
    min-height: 100%;
}
.code-preview pre {
    margin: 0;
    color: #d4d4d4;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    tab-size: 4;
}
.code-line {
    display: block;
    padding: 0 10px;
}
.code-line:hover {
    background: rgba(255,255,255,0.05);
}
.line-number {
    display: inline-block;
    width: 50px;
    text-align: right;
    color: #858585;
    user-select: none;
    margin-right: 15px;
}
.canvas-overlay {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
}

/* ============= Sidebar Styles ============= */
.layout-wrapper {
    display: flex;
    gap: 0;
    width: 100%;
    position: relative;
}
.sidebar {
    width: 280px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    height: calc(100vh - 40px);
    position: sticky;
    top: 20px;
    overflow-y: auto;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(102, 126, 234, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}
.sidebar.collapsed {
    width: 0;
    opacity: 0;
    overflow: hidden;
    margin-right: 0;
}
.sidebar-toggle {
    position: fixed;
    left: 20px;
    top: 20px;
    z-index: 1000;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.3s ease;
}
.sidebar-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}
.main-content {
    flex: 1;
    min-width: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.main-content.expanded {
    margin-left: 0;
}
.sidebar-section {
    margin: 20px 0;
    padding: 0 15px;
}
.sidebar-section-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
    opacity: 0.8;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-section-title.collapsible-title {
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 8px;
    margin: -8px;
    border-radius: 8px;
}

.sidebar-section-title.collapsible-title:hover {
    background: rgba(255, 255, 255, 0.1);
    opacity: 1;
}

.collapse-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 10px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
}

.collapse-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
}

.collapse-btn.collapsed {
    transform: rotate(-90deg);
}

.sidebar-section-content {
    max-height: 1000px;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    opacity: 1;
}

.sidebar-section-content.collapsed {
    max-height: 0;
    opacity: 0;
    margin-bottom: 0;
}
.sidebar-item {
    background: rgba(255, 255, 255, 0.1);
    padding: 10px 12px;
    margin: 6px 0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    backdrop-filter: blur(10px);
}
.sidebar-item:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(5px);
}
.sidebar-item.active {
    background: rgba(255, 255, 255, 0.25);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
.sidebar-item .icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
}
.sidebar-item .text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sidebar-item .badge {
    background: rgba(255, 255, 255, 0.3);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}
.sidebar-item .action {
    opacity: 0;
    transition: opacity 0.2s;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
}
.sidebar-item:hover .action {
    opacity: 1;
}
.sidebar-item .action:hover {
    background: rgba(255, 255, 255, 0.2);
}
.tree-item {
    padding-left: 0;
}
.tree-item .tree-toggle {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s;
}
.tree-item .tree-toggle.expanded {
    transform: rotate(90deg);
}
.tree-children {
    display: none;
    padding-left: 20px;
    margin-top: 4px;
}
.tree-children.expanded {
    display: block;
}
.disk-usage {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 12px;
    backdrop-filter: blur(10px);
}
.disk-usage-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
    margin: 10px 0;
}
.disk-usage-fill {
    height: 100%;
    background: linear-gradient(90deg, #4caf50, #8bc34a);
    transition: width 0.3s ease;
    border-radius: 4px;
}
.disk-usage-fill.warning {
    background: linear-gradient(90deg, #ff9800, #ffc107);
}
.disk-usage-fill.danger {
    background: linear-gradient(90deg, #f44336, #e91e63);
}
.disk-usage-text {
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
}
.file-details {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 12px;
    backdrop-filter: blur(10px);
    font-size: 13px;
}
.file-details .detail-row {
    display: flex;
    justify-content: space-between;
    margin: 8px 0;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.file-details .detail-row:last-child {
    border-bottom: none;
}
.file-details .label {
    opacity: 0.8;
}
.file-details .value {
    font-weight: 600;
    text-align: right;
}
.empty-sidebar {
    text-align: center;
    padding: 20px;
    opacity: 0.6;
    font-size: 13px;
}
.disk-mode-toggle {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    padding: 4px 8px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s ease;
    margin-left: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}
.disk-mode-toggle:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
}
.disk-mode-toggle:active {
    transform: scale(0.95);
}
/* Sidebar overlay for mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* ============= Performance Monitor Styles ============= */
#performanceMonitor {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.95) 0%, rgba(118, 75, 162, 0.95) 100%);
    backdrop-filter: blur(20px);
    color: white;
    padding: 12px 30px;
    font-size: 13px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 40px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
    z-index: 900;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#performanceMonitor.hidden {
    transform: translateY(100%);
}

.perf-metric {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.perf-metric::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5), transparent);
    transform: translateX(-100%);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0%, 100% { transform: translateX(-100%); }
    50% { transform: translateX(100%); }
}

.perf-metric:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.perf-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.8;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.perf-value {
    font-size: 18px;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    letter-spacing: 0.5px;
}

.perf-value.fast {
    color: #4caf50;
}

.perf-value.medium {
    color: #ffc107;
}

.perf-value.slow {
    color: #f44336;
}

.perf-separator {
    width: 1px;
    height: 40px;
    background: linear-gradient(180deg, transparent, rgba(255,255,255,0.3), transparent);
}

#togglePerf {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 6px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#togglePerf:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

#togglePerf:active {
    transform: scale(0.95);
}

/* ============= Enhanced Disk Usage with Circular Progress ============= */
.disk-usage {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 16px;
    backdrop-filter: blur(10px);
}

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

.disk-usage-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.9;
}

.disk-circular-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px 0;
}

.disk-circular-progress {
    position: relative;
    width: 120px;
    height: 120px;
}

.disk-circular-progress svg {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
}

.disk-circular-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 10;
}

.disk-circular-fill {
    fill: none;
    stroke: url(#diskGradient);
    stroke-width: 10;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.6s ease-in-out;
}

.disk-circular-fill.warning {
    stroke: url(#diskGradientWarning);
}

.disk-circular-fill.danger {
    stroke: url(#diskGradientDanger);
}

.disk-circular-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.disk-circular-percentage {
    font-size: 24px;
    font-weight: 700;
    line-height: 1;
}

.disk-circular-label {
    font-size: 10px;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.disk-usage-bar {
    height: 10px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    overflow: hidden;
    margin: 12px 0;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.disk-usage-fill {
    height: 100%;
    background: linear-gradient(90deg, #4caf50, #8bc34a);
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.4);
    position: relative;
    overflow: hidden;
}

.disk-usage-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transform: translateX(-100%);
    animation: shimmer 2s infinite;
}

.disk-usage-fill.warning {
    background: linear-gradient(90deg, #ff9800, #ffc107);
    box-shadow: 0 2px 8px rgba(255, 152, 0, 0.4);
}

.disk-usage-fill.danger {
    background: linear-gradient(90deg, #f44336, #e91e63);
    box-shadow: 0 2px 8px rgba(244, 67, 54, 0.4);
}

.disk-usage-text {
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
}

.disk-usage-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 15px;
}

.disk-stat {
    background: rgba(255, 255, 255, 0.08);
    padding: 10px;
    border-radius: 8px;
    text-align: center;
}

.disk-stat-value {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 4px;
}

.disk-stat-label {
    font-size: 10px;
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============= Admin Panel Improvements ============= */
.admin-section {
    margin-bottom: 25px;
    padding: 25px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(102, 126, 234, 0.1);
    transition: all 0.3s ease;
}

.admin-section:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.admin-section h4 {
    margin-bottom: 18px;
    font-size: 16px;
    font-weight: 700;
    color: #667eea;
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-section input[type="file"],
.admin-section input[type="text"] {
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 14px;
    transition: all 0.3s ease;
    background: white;
}

.admin-section input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.admin-section input[type="file"] {
    border-style: dashed;
    border-color: #4caf50;
    cursor: pointer;
}

.admin-section input[type="file"]:hover {
    background: rgba(76, 175, 80, 0.05);
    border-color: #45a049;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        width: 320px;
        max-width: 85vw;
        z-index: 999;
        border-radius: 0 20px 20px 0;
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
        transform: translateX(0);
    }
    .sidebar.collapsed {
        transform: translateX(-100%);
    }
    .sidebar-toggle {
        left: 20px;
        top: 20px;
        z-index: 1000;
    }
    .layout-wrapper {
        flex-direction: column;
    }
    .main-content {
        width: 100%;
    }
}
@media (max-width: 768px) {
    .controls { flex-direction: column; }
    .search-box { width: 100%; }
    .sort-controls { width: 100%; overflow-x: auto; }
    table { font-size: 14px; }
    th, td { padding: 10px; }
    .file-date { display: none; }
    .sidebar {
        width: 280px;
    }
    .sidebar-toggle {
        left: 15px;
        top: 15px;
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
}

/* ============= Markdown Preview Styles ============= */
.markdown-body {
    box-sizing: border-box;
    min-width: 200px;
    max-width: 980px;
    margin: 0 auto;
    padding: 45px;
    background: white;
    border-radius: 8px;
    font-size: 16px;
    line-height: 1.6;
    color: #24292f;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: 100%;
}

.preview-modal.markdown-modal {
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-modal.markdown-modal .preview-content {
    width: 90%;
    max-width: 1200px;
    height: 90%;
    max-height: 900px;
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 12px;
    overflow: hidden;
}

.preview-modal.markdown-modal .preview-header {
    flex-shrink: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 12px 12px 0 0;
}

.preview-modal.markdown-modal .preview-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    display: block;
    padding: 0;
    background: #f6f8fa;
}

.preview-modal.markdown-modal .markdown-body {
    height: auto;
    min-height: 100%;
}

/* Dark mode toggle for markdown */
.markdown-body.dark-mode {
    background: #0d1117;
    color: #c9d1d9;
}

.markdown-body.dark-mode a {
    color: #58a6ff;
}

.markdown-body.dark-mode code {
    background: rgba(110, 118, 129, 0.4);
    color: #c9d1d9;
}

.markdown-body.dark-mode pre {
    background: #161b22;
}

/* Markdown file icon enhancement */
.file-link[data-is-markdown="1"] .icon::after {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #e65100;
    border-radius: 50%;
    margin-left: 4px;
    vertical-align: super;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ============= README Preview Card ============= */
.readme-preview-card {
    margin: 30px 0;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08), 0 0 0 1px rgba(0,0,0,0.05);
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.readme-preview-card:hover {
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.12), 0 0 0 1px rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
}

.readme-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 18px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: none;
    position: relative;
}

.readme-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, rgba(255,255,255,0.3) 0%, rgba(255,255,255,0) 100%);
}

.readme-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 17px;
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.readme-icon {
    font-size: 22px;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.1));
}

.readme-actions {
    display: flex;
    gap: 8px;
}

.readme-toggle-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.readme-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.readme-toggle-btn .toggle-icon {
    transition: transform 0.3s ease;
    display: inline-block;
}

.readme-toggle-btn.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

.readme-body {
    padding: 24px;
    max-height: 700px;
    overflow-y: auto;
    overflow-x: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: #f6f8fa;
}

.readme-body.collapsed {
    max-height: 0;
    padding: 0 24px;
    opacity: 0;
}

/* Override markdown-body styles for inline README */
.readme-preview-card .markdown-body {
    max-width: 100%;
    padding: 32px;
    font-size: 16px;
    line-height: 1.7;
    background: white;
    color: #24292f;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    margin: 0;
}

.readme-preview-card .markdown-body h1 {
    font-size: 32px;
    font-weight: 700;
    padding-bottom: 0.4em;
    border-bottom: 3px solid #e1e4e8;
    margin-bottom: 20px;
    margin-top: 0;
    color: #1a202c;
    letter-spacing: -0.5px;
}

.readme-preview-card .markdown-body h2 {
    font-size: 24px;
    font-weight: 600;
    padding-bottom: 0.4em;
    border-bottom: 2px solid #e1e4e8;
    margin-top: 32px;
    margin-bottom: 18px;
    color: #2d3748;
    letter-spacing: -0.3px;
}

.readme-preview-card .markdown-body h3 {
    font-size: 20px;
    font-weight: 600;
    margin-top: 24px;
    margin-bottom: 12px;
    color: #2d3748;
}

.readme-preview-card .markdown-body h4 {
    font-size: 18px;
    font-weight: 600;
    margin-top: 20px;
    margin-bottom: 10px;
    color: #4a5568;
}

.readme-preview-card .markdown-body p {
    margin-bottom: 16px;
    line-height: 1.8;
}

.readme-preview-card .markdown-body ul,
.readme-preview-card .markdown-body ol {
    margin-bottom: 16px;
    padding-left: 28px;
}

.readme-preview-card .markdown-body li {
    margin-bottom: 8px;
    line-height: 1.7;
}

.readme-preview-card .markdown-body blockquote {
    margin: 20px 0;
    padding: 12px 20px;
    border-left: 4px solid #667eea;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 0 8px 8px 0;
    color: #4a5568;
}

.readme-preview-card .markdown-body strong {
    font-weight: 600;
    color: #1a202c;
}

.readme-preview-card .markdown-body em {
    font-style: italic;
    color: #4a5568;
}

.readme-preview-card .markdown-body a {
    color: #667eea;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all 0.2s ease;
}

.readme-preview-card .markdown-body a:hover {
    color: #764ba2;
    border-bottom-color: #764ba2;
}

.readme-preview-card .markdown-body pre {
    background: #2d3748;
    border: 1px solid #1a202c;
    border-radius: 10px;
    padding: 20px;
    margin: 20px 0;
    overflow-x: auto;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.readme-preview-card .markdown-body pre code {
    background: transparent;
    padding: 0;
    color: #e2e8f0;
    font-size: 14px;
    line-height: 1.6;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

.readme-preview-card .markdown-body code {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    padding: 0.2em 0.5em;
    border-radius: 4px;
    font-size: 87%;
    font-weight: 500;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

.readme-preview-card .markdown-body table {
    border-collapse: collapse;
    width: 100%;
    margin: 24px 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.readme-preview-card .markdown-body table th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
    text-align: left;
    padding: 12px 16px;
    border: none;
}

.readme-preview-card .markdown-body table td {
    border: 1px solid #e1e4e8;
    border-left: none;
    border-right: none;
    padding: 12px 16px;
}

.readme-preview-card .markdown-body table tr {
    background: white;
    transition: background 0.2s ease;
}

.readme-preview-card .markdown-body table tr:nth-child(2n) {
    background: #fafbfc;
}

.readme-preview-card .markdown-body table tr:hover {
    background: rgba(102, 126, 234, 0.05);
}

.readme-preview-card .markdown-body hr {
    border: none;
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, #e1e4e8 50%, transparent 100%);
    margin: 32px 0;
}

.readme-preview-card .markdown-body img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 16px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Scrollbar styling for README */
.readme-body::-webkit-scrollbar {
    width: 10px;
}

.readme-body::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.03);
    border-radius: 5px;
    margin: 8px 0;
}

.readme-body::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 5px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

.readme-body::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #5568d3 0%, #6a3f8f 100%);
    background-clip: padding-box;
}

/* Responsive adjustments for README */
@media (max-width: 768px) {
    .readme-body {
        padding: 16px;
    }

    .readme-preview-card .markdown-body {
        padding: 20px;
        font-size: 15px;
    }

    .readme-preview-card .markdown-body h1 {
        font-size: 26px;
    }

    .readme-preview-card .markdown-body h2 {
        font-size: 22px;
    }

    .readme-preview-card .markdown-body h3 {
        font-size: 18px;
    }
}

/* ============= Sidebar Performance Monitor ============= */
.sidebar-perf-monitor {
    padding: 8px;
}

.sidebar-perf-item {
    padding: 10px 12px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    border-left: 3px solid transparent;
    transition: all 0.3s ease;
}

.sidebar-perf-item:last-child {
    margin-bottom: 0;
}

.sidebar-perf-item:hover {
    background: rgba(255, 255, 255, 0.12);
}

/* Color coding for performance values */
.sidebar-perf-item:nth-child(1) {
    border-left-color: #667eea;
}

.sidebar-perf-item:nth-child(2) {
    border-left-color: #4caf50;
}

.sidebar-perf-item:nth-child(3) {
    border-left-color: #ffc107;
}

.sidebar-perf-item:nth-child(4) {
    border-left-color: #764ba2;
}

.sidebar-perf-label {
    font-size: 11px;
    opacity: 0.8;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-perf-value {
    font-size: 16px;
    font-weight: 600;
    color: white;
}

/* Color coding for performance values based on speed */
.sidebar-perf-value.fast {
    color: #4caf50;
}

.sidebar-perf-value.medium {
    color: #ffc107;
}

.sidebar-perf-value.slow {
    color: #f44336;
}
