/* ============================================
   VIDEO PLAYER STYLES
   ============================================
   Sections:
   1. Container und Video-Element
   2. Lazy Loading Wrapper und Play-Button
   3. Vimeo Container
   4. Error State
   5. Chapter List
   6. Transcript (Header, Body, Segments, Search)
   7. Keyboard Feedback Overlay
   8-10. Overlay Controls (Flex Wrapper, Buttons, Quality Menu)
   11. Thumbnail Preview
   12. Fullscreen State
   13. Responsive Breakpoints
   14. Bookmark CRUD
   ============================================ */

/* ============================================
   1. CONTAINER UND VIDEO-ELEMENT
   ============================================ */

.video-container {
    position: relative;
    width: 100%;
    margin: 1.5rem 0;
    background: var(--color-bg-dark, #1a1a1a);
    border-radius: var(--radius-md, 8px);
    overflow: hidden;
}

.video-container.video-local {
    aspect-ratio: 16 / 9;
}

.video-container video,
.video-container .video-player {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

/* ============================================
   2. LAZY LOADING WRAPPER UND PLAY-BUTTON
   ============================================ */

.video-lazy-wrapper {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 5;
}

.video-poster-placeholder {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-play-button {
    position: relative;
    z-index: 6;
    width: 80px;
    height: 80px;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
}

.video-play-button svg {
    width: 32px;
    height: 32px;
    margin-left: 4px;
}

.video-play-button:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

/* ============================================
   3. VIMEO CONTAINER
   ============================================ */

.video-container.video-vimeo > div[style*="padding:56.25%"] {
    background: #000;
}

/* ============================================
   4. ERROR STATE
   ============================================ */

.video-error {
    padding: 2rem;
    text-align: center;
    color: #999;
    background: var(--color-bg-dark, #1a1a1a);
    border-radius: var(--radius-md, 8px);
}

/* ============================================
   5. CHAPTER LIST
   ============================================ */

.video-chapters {
    margin: 1rem 0;
}

.video-chapters-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
}

.video-chapters-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.video-chapter-item {
    border-bottom: 1px solid var(--color-border-light, #eee);
}

.video-chapter-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.5rem 0;
    background: none;
    border: none;
    cursor: pointer;
    font: inherit;
    color: inherit;
    text-align: left;
}

.video-chapter-btn:hover {
    color: var(--color-primary, #4a90d9);
}

.video-chapter-time {
    font-family: var(--font-family-mono, monospace);
    font-size: 0.85rem;
    color: var(--color-primary, #4a90d9);
    min-width: 4em;
}

.video-chapter-label {
    flex: 1;
}

.video-chapter-item.video-chapter-active .video-chapter-btn {
    font-weight: 600;
    color: var(--color-primary, #4a90d9);
}

/* ============================================
   BOOKMARK TRACK + DOTS
   ============================================ */

.video-bookmark-track {
    position: relative;
    height: 6px;
    background: rgba(232, 168, 56, 0.15);
    border-radius: 3px;
    margin: 0.5rem 0;
    cursor: pointer;
}

.video-bookmark-dot {
    position: absolute;
    top: 50%;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #e8a838;
    cursor: pointer;
    transform: translate(-50%, -50%);
    transition: transform 0.15s ease;
    z-index: 2;
}

.video-bookmark-dot:hover {
    transform: translate(-50%, -50%) scale(1.6);
}

.video-bookmark-dot::after {
    content: attr(data-label);
    position: absolute;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 3px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
}

.video-bookmark-dot:hover::after {
    opacity: 1;
}

.video-bookmark-progress {
    position: absolute;
    top: 50%;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--color-primary, #4a90d9);
    transform: translate(-50%, -50%);
    z-index: 1;
    transition: left 0.25s linear;
    pointer-events: none;
}

/* ============================================
   BOOKMARK LIST (below video)
   ============================================ */

.video-bookmarks {
    margin: 1rem 0;
}

.video-bookmarks-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
}

.video-bookmarks-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.video-bookmark-item {
    border-bottom: 1px solid var(--color-border-light, #eee);
}

.video-bookmark-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.5rem 0;
    background: none;
    border: none;
    cursor: pointer;
    font: inherit;
    color: inherit;
    text-align: left;
}

.video-bookmark-btn:hover {
    color: #e8a838;
}

.video-bookmark-time {
    font-family: var(--font-family-mono, monospace);
    font-size: 0.85rem;
    color: #e8a838;
    min-width: 4em;
}

.video-bookmark-label {
    flex: 1;
}

.video-bookmark-item.video-bookmark-active .video-bookmark-btn {
    font-weight: 600;
    color: #e8a838;
}

/* ============================================
   6. TRANSCRIPT (Header, Body, Segments, Search)
   ============================================ */

.video-transcript {
    margin: 1.5rem 0;
    border: 1px solid var(--color-border-light, #ddd);
    border-radius: var(--radius-md, 8px);
    overflow: hidden;
}

.video-transcript-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--color-bg-secondary, #f5f5f5);
    border-bottom: 1px solid var(--color-border-light, #ddd);
}

.video-transcript-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.video-transcript-search {
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--color-border-light, #ddd);
    border-radius: 4px;
    font: inherit;
    font-size: 0.85rem;
    width: 200px;
}

.video-transcript-body {
    max-height: 300px;
    overflow-y: auto;
    padding: 0.5rem 0;
}

.video-transcript-segment {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.35rem 1rem;
    transition: background 0.15s;
}

.video-transcript-segment:hover {
    background: var(--color-bg-hover, #fafafa);
}

.video-transcript-segment.video-transcript-active {
    background: var(--color-mark, #fff3cd);
}

.video-transcript-time {
    font-family: var(--font-family-mono, monospace);
    font-size: 0.8rem;
    color: var(--color-primary, #4a90d9);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    min-width: 4em;
    white-space: nowrap;
}

.video-transcript-time:hover {
    text-decoration: underline;
}

.video-transcript-text {
    flex: 1;
    font-size: 0.9rem;
    line-height: 1.5;
}

.video-transcript-text mark {
    background: var(--color-mark, #fff3cd);
    padding: 0 2px;
    border-radius: 2px;
}

/* ============================================
   7. KEYBOARD FEEDBACK OVERLAY
   ============================================ */

.video-feedback {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    font-size: 1.25rem;
    padding: 0.5em 1em;
    border-radius: var(--radius-md, 8px);
    pointer-events: none;
    z-index: 12;
    opacity: 1;
    transition: opacity 0.4s;
}

.video-feedback--fade {
    opacity: 0;
}

/* ============================================
   8-10. OVERLAY CONTROLS (flex wrapper + shared base)
   ============================================ */

.video-overlay-controls {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 8;
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.video-container:hover .video-overlay-controls,
.video-container:focus-within .video-overlay-controls {
    opacity: 1;
}

.video-speed-btn,
.video-fullscreen-btn,
.video-quality-btn {
    box-sizing: border-box;
    margin: 0;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 0 10px;
    height: 28px;
    font-size: 13px;
    font-family: inherit;
    line-height: 28px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.video-speed-btn:hover,
.video-fullscreen-btn:hover,
.video-quality-btn:hover {
    background: rgba(0, 0, 0, 0.85);
}

.video-fullscreen-btn svg {
    width: 16px;
    height: 16px;
}

/* 10. QUALITY SELECTOR (Wrapper, Button, Menu, Options) */

.video-quality-wrapper {
    position: relative;
}

.video-quality-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: rgba(20, 20, 20, 0.95);
    border-radius: 4px;
    padding: 4px 0;
    min-width: 100px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.video-quality-option {
    display: block;
    width: 100%;
    background: none;
    border: none;
    color: #ccc;
    padding: 6px 16px;
    font-size: 13px;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    white-space: nowrap;
}

.video-quality-option:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.video-quality-option.video-quality-active {
    color: #fff;
    font-weight: 600;
}

.video-quality-option.video-quality-active::before {
    content: '\25CF\00a0';
}

/* ============================================
   11. THUMBNAIL PREVIEW
   ============================================ */

.video-thumb-preview {
    position: absolute;
    bottom: 50px;
    z-index: 10;
    border: 2px solid #fff;
    border-radius: 4px;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

.vjs-thumbnail-holder {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    background: #000;
    border: 2px solid #fff;
    border-radius: 4px;
    pointer-events: none;
    z-index: 10;
}

/* ============================================
   12. FULLSCREEN STATE
   ============================================ */

.video-container:fullscreen,
.video-container:-webkit-full-screen {
    max-width: none;
    border-radius: 0;
}

.video-container.video-fullscreen {
    border-radius: 0;
}

.video-container.video-fullscreen .video-player {
    width: 100vw;
    height: 100vh;
    object-fit: contain;
}

/* Subtitle styling */
.video-player::cue {
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    font-size: 1rem;
    line-height: 1.4;
    padding: 0.25em 0.5em;
    border-radius: 4px;
}

/* Video loading state */
.video-container video[data-loading="true"] {
    opacity: 0.7;
}

/* ============================================
   13. RESPONSIVE BREAKPOINTS
   ============================================ */

@media (max-width: 768px) {
    .video-play-button {
        width: 60px;
        height: 60px;
    }

    .video-play-button svg {
        width: 24px;
        height: 24px;
    }

    .video-overlay-controls {
        opacity: 1;
    }

    .video-transcript-search {
        width: 120px;
    }

    .video-transcript-body {
        max-height: 200px;
    }
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
    .video-container {
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    }

    .video-chapter-item {
        border-bottom-color: rgba(255, 255, 255, 0.1);
    }

    .video-transcript {
        border-color: rgba(255, 255, 255, 0.1);
    }

    .video-transcript-header {
        background: rgba(255, 255, 255, 0.05);
        border-bottom-color: rgba(255, 255, 255, 0.1);
    }

    .video-transcript-segment:hover {
        background: rgba(255, 255, 255, 0.05);
    }

    .video-bookmark-item {
        border-bottom-color: rgba(255, 255, 255, 0.1);
    }
}

/* ============================================
   14. BOOKMARK CRUD
   ============================================ */

.video-bookmarks-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.video-bookmark-add-btn {
    background: none;
    border: 1px solid #e8a838;
    color: #e8a838;
    border-radius: 4px;
    padding: 0.2rem 0.6rem;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.video-bookmark-add-btn:hover {
    background: #e8a838;
    color: #fff;
}

.video-bookmark-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    border-bottom: 1px solid var(--color-border-light, #eee);
}

.video-bookmark-action-btn {
    display: inline-flex;
    align-items: center;
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 3px;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s;
    flex-shrink: 0;
}

.video-bookmark-item:hover .video-bookmark-action-btn,
.video-bookmark-item--own .video-bookmark-action-btn {
    opacity: 1;
}

.video-bookmark-action-btn:hover {
    color: #e8a838;
}

.video-bookmark-action-btn--del:hover {
    color: #d9534f;
}

.video-bookmark-edit-input {
    flex: 1;
    padding: 0.2rem 0.4rem;
    border: 1px solid #e8a838;
    border-radius: 3px;
    font: inherit;
    font-size: 0.9rem;
}

.video-bookmark-label-widget {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.4rem;
    padding: 0.4rem 0.6rem;
    background: var(--color-bg-secondary, #f9f9f9);
    border: 1px solid #e8a838;
    border-radius: 4px;
}

.video-bookmark-label-input {
    flex: 1;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--color-border-light, #ddd);
    border-radius: 3px;
    font: inherit;
    font-size: 0.9rem;
}

.video-bookmark-label-widget button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.2rem;
    border-radius: 3px;
    font-size: 0.85rem;
    color: #666;
    transition: color 0.15s;
}

.video-bookmark-label-widget button:hover {
    color: #e8a838;
}

.video-bookmark-dot--own {
    background: #c8843a;
    border: 2px solid #e8a838;
    width: 14px;
    height: 14px;
}

