/* Fix Horizontal Layout of Catalog Sections */
#course-catalog {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.catalog-section {
    width: 100%;
    margin-bottom: 40px;
    display: block;
}

/* Fix Card Height & Overflow */
.course-grid .dynamic-card {
    height: 100%;
    /* Ensure card fills grid cell height */
    width: 100%;
    /* Ensure card fits in cell */
}

.dynamic-card-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

/* Fix Static Badge in Footer */
.duration-info-static {
    font-size: 0.8rem;
    color: #666;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 3px;
    background: #e0f7fa;
    /* Light cyan background */
    color: #006064;
    /* Dark cyan text */
    padding: 4px 8px;
    /* More padding */
    border-radius: 12px;
    /* Pill shape */
    font-weight: 600;
    /* Bold text */
    border-radius: 4px;
}

.duration-info-static i {
    color: var(--el-primary);
}

/* Override existing conflicting styles if any */
.service-group .dynamic-container {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)) !important;
    /* Slightly smaller min-width to fit better */
}

/* Force flex layout for editable lesson items and clean up controls */
#player-modules-list .lesson-item.editable {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    flex-wrap: nowrap !important;
    overflow: visible !important;
}

#player-modules-list .lesson-item.editable .admin-controls {
    opacity: 1 !important;
    display: flex !important;
    visibility: visible !important;
    /* Prevent shrinking */
    flex-shrink: 0 !important;
    min-width: 30px !important;
    margin-left: auto !important;
    z-index: 10 !important;
    background: transparent !important;
    pointer-events: auto !important;
}

#player-modules-list .lesson-item.editable button.remove-btn {
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    color: #ef5350 !important;
    opacity: 1 !important;
    visibility: visible !important;
    width: auto !important;
    height: auto !important;
    padding: 8px !important;
    display: block !important;
    cursor: pointer !important;
}

/* --- Google Drive Embed Cropping --- */

/* Wrapper to hide the top bar (pop-out button) */
.drive-embed-container {
    width: 100%;
    overflow: hidden;
    position: relative;
    border-radius: 8px;
    /* Optional rounded corners */
    background: #000;
    /* Dark background for video/audio */
}

.drive-embed-container iframe {
    width: 100%;
    border: none;
    /* Move the iframe UP to hide the top bar */
    margin-top: -60px;
    /* Increase height to compensate for the hidden top part */
    height: calc(100% + 60px) !important;
    display: block;
}

/* For Audio, we used a fixed height container. We need to ensure the crop works there too. */
.drive-audio-wrapper {
    height: 150px;
    /* Visible height */
    overflow: hidden;
    position: relative;
    border-radius: 8px;
    background: #f5f5f5;
}

.drive-audio-wrapper iframe {
    width: 100%;
    margin-top: -60px;
    /* Hide top bar */
    height: calc(100% + 60px);
    border: none;
}

/* Video Container Override for Drive */
.video-container.drive-video {
    overflow: hidden;
    padding-bottom: 56.25%;
    /* 16:9 */
    position: relative;
    height: 0;
}

.video-container.drive-video iframe {
    position: absolute;
    top: -60px;
    /* Shift up */
    left: 0;
    width: 100%;
    height: calc(100% + 60px) !important;
    /* compensate */
}

/* PDF Container Override */
.pdf-container.drive-pdf {
    overflow: hidden;
    height: 600px;
    /* Visible height */
    position: relative;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.pdf-container.drive-pdf iframe {
    width: 100%;
    margin-top: -60px;
    height: calc(100% + 60px) !important;
    border: none;
}

/* Mobile Adjustment for Drive PDFs */
@media (max-width: 768px) {
    .pdf-container.drive-pdf iframe {
        margin-top: 0 !important;
        height: 100% !important;
    }

    .pdf-container.drive-pdf {
        /* Optional: Add a note or small padding if needed */
        border: 2px solid var(--el-primary);
        /* Visual cue? maybe not needed */
    }
}

/* --- Focus Mode (Full Screen) --- */
body.focus-mode {
    overflow: hidden;
    /* Lock main scroll */
}

/* Hide everything by default in focus mode */
body.focus-mode nav.sidebar,
body.focus-mode .elearning-header,
body.focus-mode .site-footer,
body.focus-mode #floating-notification {
    display: none !important;
}

/* Page container reset */
body.focus-mode .page-container,
body.focus-mode .content,
body.focus-mode .main-content {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 100vh !important;
    border: none !important;
    display: block !important;
}

/* Maximize Player View */
body.focus-mode #player-view {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #fff;
    z-index: 10000;
    overflow-y: auto;
    /* Scroll inside player */
    padding: 15px;
    box-sizing: border-box;
    display: block !important;
}

/* Adjust Player Layout */
body.focus-mode .player-layout {
    display: block !important;
    margin-top: 0;
}

body.focus-mode .course-sidebar {
    display: none !important;
    /* Hide Sidebar in Focus Mode for max space */
}

body.focus-mode .player-content {
    border: none !important;
    padding: 0 !important;
    min-height: auto !important;
    box-shadow: none !important;
}

/* Improve header inside focus mode */
body.focus-mode .player-nav-header {
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    margin-bottom: 20px !important;
    position: sticky;
    top: -15px;
    /* Pull up slightly */
    background: #fff;
    z-index: 100;
    padding-top: 5px;
}

body.focus-mode #back-to-catalog-btn {
    display: none;
    /* Hide 'Back to Courses' in focus mode to avoid confusion */
}