/**
 * Mux Video Frontend Styles
 * Transcript segments, chapters, tabs, poster facade, active state
 */

/* Tabbed container */
.mux-transcript-chapters {
    border: 1px solid #c3c4c7;
    border-radius: 8px;
    overflow: hidden;
}

.mux-tabs {
    display: flex;
    border-bottom: 1px solid #c3c4c7;
    background: #f6f7f7;
}

.mux-tab {
    padding: 10px 16px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    color: #646970;
    transition: color 0.15s ease, background 0.15s ease;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.mux-tab:hover {
    color: #1d2327;
}

.mux-tab.mux-tab-active {
    color: #1d2327;
    border-bottom-color: #2271b1;
}

.mux-transcript-panel,
.mux-chapters-panel {
    max-height: 400px;
    overflow-y: auto;
}

.mux-transcript {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.5rem;
}

.mux-transcript-segment {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    text-align: left;
    border: none;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    line-height: 1.5;
    transition: background-color 0.15s ease;
    border-radius: 4px;
}

.mux-transcript-segment:hover,
.mux-transcript-segment:focus {
    background-color: rgba(0, 0, 0, 0.05);
    outline: none;
}

.mux-transcript-segment:focus-visible {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

.mux-transcript-segment.mux-transcript-segment-active {
    background-color: rgba(34, 113, 177, 0.12);
}

.mux-transcript-timestamp {
    flex-shrink: 0;
    color: #646970;
    font-size: 0.875em;
    min-width: 3.5rem;
}

.mux-transcript-text {
    flex: 1;
}

/* Chapters list */
.mux-chapters {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.5rem;
}

.mux-chapter-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.5rem;
    text-align: left;
    border: none;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    line-height: 1.5;
    transition: background-color 0.15s ease;
    border-radius: 4px;
}

.mux-chapter-item:hover,
.mux-chapter-item:focus {
    background-color: rgba(0, 0, 0, 0.05);
    outline: none;
}

.mux-chapter-item:focus-visible {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

.mux-chapter-item.mux-chapter-item-active {
    background-color: rgba(34, 113, 177, 0.12);
}

.mux-chapter-thumb {
    width: 100px;
    border-radius: 4px;
    overflow: hidden;
    background: #ddd;
}

.mux-chapter-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.mux-chapter-thumb-placeholder {
    background: #e2e4e7;
}

.mux-chapter-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.mux-chapter-title {
    font-weight: 500;
}

.mux-chapter-timestamp {
    color: #2271b1;
    font-size: 0.875em;
}

/* Poster facade */
.mux-video-block.mux-video-revealed .mux-video-poster {
    display: none !important;
    pointer-events: none;
}

.mux-video-block {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
}

.mux-video-poster {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mux-video-poster:hover .mux-video-poster-play,
.mux-video-poster:focus .mux-video-poster-play {
    transform: scale(1.1);
}

.mux-video-poster:focus {
    outline: none;
}

.mux-video-poster:focus-visible {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

.mux-video-poster-play {
    width: 68px;
    height: 48px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 12px;
    position: relative;
    transition: transform 0.2s ease;
}

.mux-video-poster-play::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    margin-left: -8px;
    margin-top: -12px;
    border-style: solid;
    border-width: 12px 0 12px 20px;
    border-color: transparent transparent transparent #fff;
}

.mux-video-loading,
.mux-video-error {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    z-index: 3;
}

.mux-video-loading {
    background-color: #000;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.mux-video-loading::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
}

.mux-video-loading p,
.mux-video-error p {
    position: relative;
    z-index: 1;
    margin: 0;
}

.mux-video-error {
    background: #000;
}

.mux-video-error p {
    color: #f87171;
}

.mux-video-mux-container,
.mux-video-yt-container {
    width: 100%;
    aspect-ratio: 16 / 9;
}

.mux-video-mux-container mux-player,
.mux-video-yt-container iframe {
    width: 100%;
    height: 100%;
    display: block;
}
