/* --- Global --- */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, sans-serif; background-color: #09090b; color: #f4f4f5; }
.hidden { display: none !important; }

/* --- Header & Navigation --- */
header { 
    padding: 20px; display: flex; align-items: center; gap: 20px; 
    border-bottom: 1px solid #27272a; margin-bottom: 10px; 
}
header h1 { font-size: 1.5rem; flex-grow: 1; }

.breadcrumb-container { padding: 10px 20px; display: flex; gap: 5px; }
.breadcrumb-item { cursor: pointer; color: #007bff; text-decoration: underline; }
.breadcrumb-item:hover { color: #0056b3; }
.breadcrumb-separator { color: #666; }

/* --- Gallery Layout --- */
.section-title { padding: 20px 20px 0; font-size: 1.2rem; color: #a1a1aa; }
#folderGrid, #fileGrid { display: grid; gap: 16px; padding: 20px; }

#folderGrid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
#fileGrid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); grid-auto-rows: 200px; }

/* --- Media Cards --- */
.media-card { 
    /* Base Container */
    position: relative;
    background: #18181b; 
    border: 1px solid #27272a; 
    border-radius: 12px; 
    overflow: hidden; 
    cursor: pointer; 
    transition: all 0.3s ease;
}

.media-card img { 
    /* Child Image */
    width: 100%; 
    height: 100%; 
    object-fit: cover; 
    display: block; 
    background: #000; 
}

/* Interaction States */
.media-card:hover { 
    transform: scale(1.02); 
    border-color: #52525b; 
}

/* Custom Tooltip */
.media-card:hover::after {
    content: attr(title);
    position: absolute;
    bottom: -35px; 
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

/* Document Overlay */
.media-card.doc-card .file-label {
    position: absolute;
    bottom: 0; left: 0; width: 100%;
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 8px;
    text-align: center;
    backdrop-filter: blur(4px);
}
.file-title {
    font-size: 14px;
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.file-author {
    font-size: 11px;
    color: #cbd5e1; /* Light gray for contrast */
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.folder-card { display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 8px; }
.folder-card .icon { font-size: 3rem; }

/* --- Modals & Overlays --- */
/* Use a wrapper to handle the centering */
.modal-overlay { 
    position: fixed; inset: 0; background: rgba(0,0,0,0.85); 
    z-index: 1000; display: flex; align-items: center; justify-content: center; 
}
.modal-overlay.hidden { display: none !important; }

.modal-content { 
    background: #18181b; padding: 20px; border-radius: 8px; 
    border: 1px solid #27272a; position: relative; z-index: 1001; 
}

/* Theater Specifics */
#videoModal .modal-content { 
    width: 90vw; height: 85vh; display: flex; gap: 20px; 
    padding: 0; overflow: visible; /* Change from hidden to visible */
    position: relative;
}

#playerContainer { flex: 3; display: flex; flex-direction: column; }
#mediaViewer { width: 100%; height: 100%; overflow: auto; }
video { width: 100%; height: 100%; background: #000; }
.close-btn { 
    position: absolute; 
    top: 10px; right: 10px; /* Positioned inside the modal */
    background: rgba(0,0,0,0.5); 
    border-radius: 50%; 
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 1.5rem; cursor: pointer; z-index: 1002; 
    border: none;
}
.close-btn:hover { background: rgba(255,255,255,0.2); }

#playlist { flex: 1; overflow-y: auto; list-style: none; border-left: 1px solid #27272a; }
.video-item { padding: 12px; border-bottom: 1px solid #27272a; cursor: pointer; font-size: 0.85rem; }
.video-item.active { background: #2563eb; }


/* --- UI Elements --- */
.btn-primary {
    background: #2563eb; color: white; border: none;
    padding: 8px 16px; border-radius: 6px; cursor: pointer; font-weight: 500;
}
.btn-primary:hover { background: #1d4ed8; }

#newFolderName { 
    width: 100%; padding: 10px; margin: 10px 0; background: #09090b; 
    border: 1px solid #3f3f46; color: white; border-radius: 4px; 
}