/* Courses Grid Layout */
.course-list-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.course-row-section {
    /*! max-width: 1400px; */
    /*! margin: 0 auto 2rem; */
    /*! padding: 0 2rem; */
    width: 100%;
    transition: opacity 180ms ease, box-shadow 180ms ease;
    border-radius: 14px;
}

.course-row-section.drag-enabled {
    cursor: grab;
}

.sortable-ghost {
    opacity: 0 !important;
}

.course-video-card:hover {
    translate: 0 -5px;
}

.sortable-fallback {
    opacity: 1 !important;
    box-shadow: none !important;
    cursor: grabbing !important;
    z-index: 9999;
    transition: none !important;
    margin: 0 !important;
}

.course-row-heading {
    font-size: 2rem;
    line-height: 1.2;
    font-weight: 700;
    margin: 0 0 1rem;
    color: var(--primary_text);
    user-select: none;
    cursor: grab;
}

.course-row-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 2rem;
}

.course-video-card {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    cursor: grab;
    transition: opacity 180ms ease, box-shadow 180ms ease, translate 180ms ease;
    border-radius: 10px;
    user-select: none;
    translate: 0 0;
}

.course-video-card.drag-enabled {
    cursor: grab;
}

.course-video-thumb {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 10px;
    border: 1px solid var(--border);
    background-size: cover;
    background-position: center;
    background-color: #111;
}


.course-video-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--primary_text);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.course-row-empty {
    border: 1px dashed var(--border);
    border-radius: 10px;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--secondary_text);
    cursor: default;
}

.learning-context-menu {
    position: fixed;
    display: flex;
    flex-direction: column;
    min-width: 190px;
    padding: 0.35rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--foreground);
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.22);
    z-index: 10050;
    gap: 0.15rem;
}

.learning-context-menu-item {
    border: none;
    background: transparent;
    color: var(--primary_text);
    border-radius: 8px;
    padding: 0.5rem 0.6rem;
    text-align: left;
    cursor: pointer;
    font-size: 0.88rem;
    line-height: 1.2;
}

.learning-context-menu-item:hover {
    background: var(--background);
}

.course-inline-player {
    display: flex;
    gap: 1.5rem;
    /*! max-width: 1400px; */
    /*! margin: 0 auto 10.0rem; */
    /*! padding: 0 2rem; */
    width: 100%;
    animation: playerSlideDown 400ms cubic-bezier(0.25, 1, 0.5, 1) both;
    position: relative;
    /*! border-bottom: 1px solid #484848; */
}

#tutorials .body-content-preview,
#learn .body-content-preview {
    overflow: visible;
}

.player-main {
    flex: 2;
    min-width: 0;
    position: relative;
    z-index: 1;
}

.player-iframe-wrap {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    border-radius: 14px;
    overflow: hidden;
    /*! background: #000; */
    box-shadow: 0px 0px 50px #00000036;
}

.player-ambient-glow {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    filter: blur(80px) saturate(2.5) brightness(1.2);
    opacity: 0;
    z-index: 0;
    pointer-events: none;
    transition: opacity 1s ease;
    transform: none;
}

.player-iframe-wrap iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 14px;
    overflow: hidden;
}

.player-info {
    margin-top: 1.5rem;
}

.player-video-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary_text);
    margin: 0 0 2rem;
}

.player-video-description {
    margin: 0;
    color: var(--secondary_text);
    font-size: 0.95rem;
    line-height: 1.45;
    white-space: pre-line;
    background-color: var(--description-background);
    border-radius: 15px;
    padding: 0.5rem 1rem;
}

.player-course-label {
    font-size: 0.9rem;
    color: var(--secondary_text);
}

.player-sidebar {
    flex: 0 0 280px;
    display: flex;
    flex-direction: column;
    /*! background: var(--foreground); */
    position: relative;
    z-index: 1;
    /*! border: 1px solid var(--border); */
    /*! border-radius: 14px; */
    overflow: hidden;
    /*! max-height: 480px; */
}

.player-sidebar-header {
    padding: 0.85rem 1rem;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--primary_text);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.player-close-btn {
    background: none;
    border: none;
    color: var(--secondary_text);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    transition: background 150ms ease, color 150ms ease;
}

.player-close-btn:hover {
    background: var(--background);
    color: var(--primary_text);
}

.player-sidebar-list {
    flex: 1;
    overflow-y: auto;
    /*! padding: 0.5rem; */
}

.sidebar-video-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 150ms ease;
}

.sidebar-video-item:hover {
    background: var(--background);
}

.sidebar-video-item.active {
    /*! background: var(--background); */
    outline: 2px solid var(--color-indigo, #ffffff70);
    outline-offset: -2px;
    /*! filter: blur(100px); */
}

.sidebar-video-thumb {
    flex: 0 0 80px;
    height: 45px;
    border-radius: 6px;
    background-size: cover;
    background-position: center;
    background-color: #111;
}

.sidebar-video-title {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--primary_text);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.player-add-video-form {
    display: flex;
    gap: 0.4rem;
    padding: 0.65rem;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.player-add-video-form input {
    flex: 1;
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.4rem 0.6rem;
    background: var(--background);
    color: var(--primary_text);
    font-size: 0.8rem;
}

.player-add-video-form button {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.4rem 0.75rem;
    background: var(--foreground);
    color: var(--primary_text);
    cursor: pointer;
    font-size: 0.8rem;
    white-space: nowrap;
}

@keyframes playerSlideDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes playerSlideUp {
    from {
        opacity: 1;
        transform: translateY(0);
    }

    to {
        opacity: 0;
        transform: translateY(-30px);
    }
}

.course-row-grid.drag-over,
.course-row-section.drag-over {
    outline: 2px dashed var(--color-indigo, #5f49ff);
    outline-offset: 6px;
}

.course-item {
    background: var(--foreground);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.course-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.course-thumbnail {
    height: 180px;
    background-size: cover;
    background-position: center;
    position: relative;
}

.course-play-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.course-item:hover .course-play-overlay {
    opacity: 1;
}

.course-play-overlay svg {
    width: 48px;
    height: 48px;
    color: white;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.course-info {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.course-info h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--primary_text);
    line-height: 1.4;
}

.course-info p {
    font-size: 0.9rem;
    color: var(--secondary_text, #666);
    margin-bottom: 1rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

.course-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-muted, #888);
    margin-top: auto;
}

.course-meta span {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.course-meta svg {
    width: 14px;
    height: 14px;
}

/* Course Watch / Detail View */
.course-watch-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    animation: fadeIn 0.3s ease-out;
    width: 100%;
}

.course-back-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--primary_text);
    font-weight: 500;
    margin-bottom: 1.5rem;
    border-radius: 8px;
    transition: background 0.2s;
}

.course-back-btn:hover {
    background: var(--background-secondary);
}

.course-back-btn svg {
    width: 16px;
    height: 16px;
}

.video-player-wrapper {
    position: relative;
    width: 100%;
    height: 450px;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.video-player-wrapper iframe {
    width: 100%;
    height: 100%;
    border: none;
    outline: none;
}

.course-list-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    /*! margin: 0 auto 1.25rem; */
    /*! max-width: 1400px; */
    /*! padding: 0 2rem; */
    width: 100%;
}

.course-add-button {
    align-self: flex-start;
    border: 1px solid var(--border);
    background: var(--foreground);
    color: var(--primary_text);
    border-radius: 50px;
    padding: 0.6rem 1rem;
    cursor: pointer;
    /*! width: 100%; */
}

.course-add-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.5rem;
}

.course-add-form input,
.course-add-form button,
.course-add-video-row input,
.course-add-video-row button {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.65rem 0.75rem;
    background: var(--foreground);
    color: var(--primary_text);
}

.course-add-form button,
.course-add-video-row button {
    cursor: pointer;
}

.course-add-video-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.course-watch-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--primary_text);
}

.course-watch-description {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--secondary_text, #666);
    margin-bottom: 2.5rem;
    max-width: 800px;
}

/* Vertical Next Videos List (YouTube Style) */
.next-videos-list.vertical-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 2rem;
}

.next-video-item {
    display: flex;
    gap: 1rem;
    background: transparent;
    border: none;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: background 0.2s;
    padding: 0.5rem;
}

.next-video-item:hover {
    background: var(--background-secondary);
    transform: none;
    border-color: transparent;
}

.video-preview-small {
    flex: 0 0 160px;
    height: 90px;
    background-size: cover;
    background-position: center;
    position: relative;
    border-radius: 8px;
    overflow: hidden;
}

.video-details-small {
    padding: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.video-title-small {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--primary_text);
    margin-bottom: 0.25rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

/* Hide fallback */
.next-videos-list.horizontal-scroll {
    display: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsiveness */
@media (max-width: 768px) {
    .course-list-container {
        grid-template-columns: 1fr;
        padding: 1rem;
    }

    .course-row-section {
        padding: 0 1rem;
    }

    .course-row-heading {
        font-size: 1.5rem;
    }

    .course-row-grid {
        grid-template-columns: 1fr;
    }

    .course-watch-container {
        padding: 1rem;
    }

    .video-player-wrapper {
        height: 240px;
    }

    .course-list-actions {
        padding: 0 1rem;
    }

    .course-add-video-row {
        grid-template-columns: 1fr;
    }

    .course-watch-title {
        font-size: 1.4rem;
    }
}
