/**
 * Video Transcript Styles
 * 
 * Styles for the collapsible transcript panel beneath videos.
 * 
 * @package WebtronDocs
 */

/* ============================================================================
   Transcript Container
   ============================================================================ */

.webtron-video-transcript {
    margin-top: 1rem;
    font-size: 0.9375rem;
    line-height: 1.6;
}

.webtron-video-transcript__details {
    background: var(--wp--preset--color--contrast-light, #f7f7f7);
    border: 1px solid var(--wp--preset--color--contrast-lighter, #e0e0e0);
    border-radius: 8px;
    overflow: hidden;
}

/* ============================================================================
   Summary / Toggle
   ============================================================================ */

.webtron-video-transcript__summary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.25rem;
    cursor: pointer;
    font-weight: 500;
    color: var(--wp--preset--color--contrast, #333);
    user-select: none;
    transition: background-color 0.2s ease;
}

.webtron-video-transcript__summary:hover {
    background: var(--wp--preset--color--contrast-lighter, #ebebeb);
}

.webtron-video-transcript__summary::-webkit-details-marker {
    display: none;
}

.webtron-video-transcript__summary::marker {
    display: none;
    content: '';
}

.webtron-video-transcript__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    color: var(--wp--preset--color--primary, #0073aa);
}

.webtron-video-transcript__chevron {
    display: flex;
    align-items: center;
    margin-left: auto;
    transition: transform 0.2s ease;
    color: var(--wp--preset--color--contrast-muted, #666);
}

details[open] .webtron-video-transcript__chevron {
    transform: rotate(180deg);
}

/* ============================================================================
   Content Area
   ============================================================================ */

.webtron-video-transcript__content {
    padding: 1.25rem;
    background: #fff;
    border-top: 1px solid var(--wp--preset--color--contrast-lighter, #e0e0e0);
    max-height: 400px;
    overflow-y: auto;
}

/* Custom scrollbar */
.webtron-video-transcript__content::-webkit-scrollbar {
    width: 6px;
}

.webtron-video-transcript__content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.webtron-video-transcript__content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.webtron-video-transcript__content::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* ============================================================================
   Timestamped Segments
   ============================================================================ */

.webtron-video-transcript__segments {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.webtron-video-transcript__segment {
    display: flex;
    gap: 0.75rem;
    margin: 0;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    transition: background-color 0.15s ease;
}

.webtron-video-transcript__segment:hover {
    background: var(--wp--preset--color--contrast-light, #f7f7f7);
}

.webtron-video-transcript__segment.is-active {
    background: rgba(0, 115, 170, 0.08);
    border-left: 3px solid var(--wp--preset--color--primary, #0073aa);
    padding-left: calc(0.75rem - 3px);
}

.webtron-video-transcript__timestamp {
    flex-shrink: 0;
    padding: 0.125rem 0.5rem;
    background: var(--wp--preset--color--primary, #0073aa);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 500;
    font-family: ui-monospace, 'SF Mono', 'Cascadia Code', 'Source Code Pro', Menlo, monospace;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.15s ease, transform 0.1s ease;
}

.webtron-video-transcript__timestamp:hover {
    background: var(--wp--preset--color--primary-dark, #005d87);
    transform: scale(1.05);
}

.webtron-video-transcript__timestamp:active {
    transform: scale(0.98);
}

.webtron-video-transcript__text {
    color: var(--wp--preset--color--contrast, #333);
}

/* ============================================================================
   Plain Text (No Timestamps)
   ============================================================================ */

.webtron-video-transcript__plain {
    color: var(--wp--preset--color--contrast, #333);
    white-space: pre-wrap;
}

/* ============================================================================
   Dark Mode
   ============================================================================ */

body.dark-mode .webtron-video-transcript__details,
body.body_dark .webtron-video-transcript__details {
    background: #1e293b;
    border-color: #334155;
}

body.dark-mode .webtron-video-transcript__summary,
body.body_dark .webtron-video-transcript__summary {
    color: #f1f5f9;
}

body.dark-mode .webtron-video-transcript__summary:hover,
body.body_dark .webtron-video-transcript__summary:hover {
    background: #334155;
}

body.dark-mode .webtron-video-transcript__content,
body.body_dark .webtron-video-transcript__content {
    background: #0f172a;
    border-color: #334155;
}

body.dark-mode .webtron-video-transcript__segment:hover,
body.body_dark .webtron-video-transcript__segment:hover {
    background: #1e293b;
}

body.dark-mode .webtron-video-transcript__segment.is-active,
body.body_dark .webtron-video-transcript__segment.is-active {
    background: rgba(59, 130, 246, 0.15);
}

body.dark-mode .webtron-video-transcript__text,
body.dark-mode .webtron-video-transcript__plain,
body.body_dark .webtron-video-transcript__text,
body.body_dark .webtron-video-transcript__plain {
    color: #e2e8f0;
}

body.dark-mode .webtron-video-transcript__chevron,
body.body_dark .webtron-video-transcript__chevron {
    color: #94a3b8;
}

/* ============================================================================
   Search Highlighting
   ============================================================================ */

.webtron-video-transcript__text mark,
.webtron-video-transcript__plain mark {
    background: rgba(255, 213, 0, 0.4);
    color: inherit;
    padding: 0.1em 0.2em;
    border-radius: 2px;
}

body.dark-mode .webtron-video-transcript__text mark,
body.dark-mode .webtron-video-transcript__plain mark,
body.body_dark .webtron-video-transcript__text mark,
body.body_dark .webtron-video-transcript__plain mark {
    background: rgba(250, 204, 21, 0.3);
}

/* ============================================================================
   Mobile Responsive
   ============================================================================ */

@media (max-width: 640px) {
    .webtron-video-transcript__summary {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
    
    .webtron-video-transcript__content {
        padding: 1rem;
        max-height: 300px;
    }
    
    .webtron-video-transcript__segment {
        flex-direction: column;
        gap: 0.25rem;
        padding: 0.625rem 0.5rem;
    }
    
    .webtron-video-transcript__timestamp {
        align-self: flex-start;
    }
}

/* ============================================================================
   Print Styles
   ============================================================================ */

@media print {
    .webtron-video-transcript__details[open] {
        break-inside: avoid;
    }
    
    .webtron-video-transcript__summary {
        display: none;
    }
    
    .webtron-video-transcript__content {
        max-height: none;
        overflow: visible;
        border: none;
        padding: 0;
    }
    
    .webtron-video-transcript__timestamp {
        background: #333;
        color: #fff;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}
