/* ===================================
   RIGHT SIDEBAR (Quick Files Access)
   =================================== */

.right-sidebar {
    position: fixed;
    right: 0;
    top: 64px; /* Below navbar */
    bottom: 0;
    width: 320px;
    background: white;
    border-left: 1px solid #e5e7eb;
    box-shadow: -4px 0 12px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 40;
    display: flex;
    flex-direction: column;
}

.right-sidebar-collapsed {
    transform: translateX(100%);
}

/* Toggle Button */
.right-sidebar-toggle {
    position: absolute;
    left: -40px;
    top: 20px;
    width: 40px;
    height: 40px;
    background: white;
    border: 1px solid #e5e7eb;
    border-right: none;
    border-radius: 8px 0 0 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: -2px 2px 8px rgba(0, 0, 0, 0.1);
}

.right-sidebar-toggle:hover {
    background: #f9fafb;
    box-shadow: -2px 2px 12px rgba(0, 0, 0, 0.15);
}

.right-sidebar-toggle.collapsed {
    left: -40px;
}

.right-sidebar-toggle svg {
    transition: transform 0.3s ease;
    color: #6b7280;
}

.right-sidebar-toggle:hover svg {
    color: #2563eb;
}

/* Content Area */
.right-sidebar-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* Header */
.right-sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.right-sidebar-title {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
}

/* Quick Stats */
.right-sidebar-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 16px 20px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
    color: #2563eb;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 11px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Files List */
.right-sidebar-files {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.right-sidebar-files::-webkit-scrollbar {
    width: 6px;
}

.right-sidebar-files::-webkit-scrollbar-track {
    background: #f9fafb;
}

.right-sidebar-files::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.right-sidebar-files::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* File Item */
.file-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    transition: all 0.2s ease;
    margin-bottom: 8px;
    border: 1px solid transparent;
}

.file-item:hover {
    background: #f9fafb;
    border-color: #e5e7eb;
}

.file-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.file-info {
    flex: 1;
    min-width: 0; /* Allow text truncation */
}

.file-name {
    font-size: 13px;
    font-weight: 500;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.file-meta {
    font-size: 11px;
    color: #6b7280;
}

/* File Actions */
.file-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.file-item:hover .file-actions {
    opacity: 1;
}

.file-action-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    color: #6b7280;
    transition: all 0.2s ease;
}

.file-action-btn:hover {
    background: #e5e7eb;
    color: #2563eb;
}

/* Footer */
.right-sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.btn-view-all {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px 16px;
    background: #2563eb;
    color: white;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-view-all:hover {
    background: #1d4ed8;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

/* ===================================
   RESPONSIVE ADJUSTMENTS
   =================================== */

/* Tablet */
@media (max-width: 1024px) {
    .right-sidebar {
        width: 280px;
    }
}

/* Mobile - Hide by default */
@media (max-width: 768px) {
    .right-sidebar {
        display: none;
    }
}

/* ===================================
   LAYOUT ADJUSTMENTS WHEN BOTH SIDEBARS OPEN
   =================================== */

/* Adjust main content when both sidebars are visible */
body:has(.left-sidebar):has(.right-sidebar:not(.right-sidebar-collapsed)) .main-content {
    margin-right: 320px;
}

@media (max-width: 1024px) {
    body:has(.left-sidebar):has(.right-sidebar:not(.right-sidebar-collapsed)) .main-content {
        margin-right: 280px;
    }
}

/* When left sidebar is collapsed but right is open */
body:has(.left-sidebar.collapsed):has(.right-sidebar:not(.right-sidebar-collapsed)) .main-content {
    margin-left: 0;
    margin-right: 320px;
}

/* ===================================
   EMPTY STATE
   =================================== */

.right-sidebar-files .text-center {
    padding: 40px 20px;
}

.right-sidebar-files .text-center svg {
    opacity: 0.3;
}

/* ===================================
   ANIMATIONS
   =================================== */

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.right-sidebar-content[x-show] {
    animation: slideInRight 0.3s ease-out;
}

/* ===================================
   LOADING STATE
   =================================== */

.file-item.loading {
    opacity: 0.5;
    pointer-events: none;
}

.file-item.loading .file-icon {
    animation: pulse 1.5s infinite;
}

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