/**
 * Transcript Panel Styles
 * Expandable "read along" panel for audio tours
 * Matches floating audio player theme (dark with red accents)
 */

/* Transcript Toggle Button - now part of the left control column */
.audio-transcript-btn {
    color: #999;
}

.audio-transcript-btn i {
    font-size: 14px;
    transition: transform 0.3s ease;
}

/* Arrow rotates when panel is open */
.audio-transcript-btn.open i {
    transform: rotate(180deg);
}

.audio-transcript-btn:hover {
    background: rgba(255, 0, 0, 0.1);
    box-shadow: 0 4px 12px rgba(255, 0, 0, 0.4);
}

/* Transcript Panel - Expands upward from audio player */
.transcript-panel {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 0;
    overflow: hidden;
    background: linear-gradient(135deg, #2a2a2a, #1a1a1a);
    border: 1px solid rgba(255, 0, 0, 0.3);
    border-bottom: none;
    border-radius: 12px 12px 0 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                padding 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.25s ease;
    opacity: 0;
    z-index: 1005;
    pointer-events: auto;
}

.transcript-panel.open {
    max-height: 80vh;
    padding: 16px;
    opacity: 1;
}

/* Panel Header */
.transcript-panel-header {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 0, 0, 0.2);
}

.transcript-panel-title {
    font-family: 'Anton SC', sans-serif;
    font-size: 18px;
    font-weight: 400;
    color: #fff;
    letter-spacing: 0.02em;
    line-height: 1.1;
    text-transform: none;
    margin: 0;
    width: 100%;
    text-align: center;
}

/* Scrollable Content Area */
.transcript-content {
    position: relative;
    height: 300px;
    min-height: 300px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    overscroll-behavior: contain;
    padding: 12px;
    background: #1a1a1a;
    border-radius: 8px;
    border: 1px solid rgba(255, 0, 0, 0.15);
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color, #ff0000) #1a1a1a;
}

.transcript-jump-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    padding: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
    background: rgba(8, 8, 8, 0.78);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 2;
}

.transcript-jump-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

body.ios-device .transcript-jump-overlay {
    background: rgba(8, 8, 8, 0.92);
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

body.ios-device .transcript-jump-overlay .poi-picker-sheet {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

.transcript-jump-overlay-content {
    flex: 1;
    min-height: 0;
}

.transcript-jump-overlay .poi-picker-sheet {
    height: 100%;
    border-radius: 8px;
    box-shadow: none;
}

.transcript-jump-overlay .poi-picker-list {
    max-height: none;
    height: calc(100% - 62px);
}

.transcript-panel.jump-overlay-open .transcript-text {
    pointer-events: none;
}

.transcript-panel.jump-overlay-open .transcript-content {
    overflow: hidden;
}

.transcript-content::-webkit-scrollbar {
    width: 6px;
}

.transcript-content::-webkit-scrollbar-track {
    background: #1a1a1a;
    border-radius: 3px;
}

.transcript-content::-webkit-scrollbar-thumb {
    background: var(--primary-color, #ff0000);
    border-radius: 3px;
}

.transcript-content::-webkit-scrollbar-thumb:hover {
    background: #ff3333;
}

/* Transcript Text Container */
.transcript-text {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-primary, #e0e0e0);
    margin: 0;
    word-wrap: break-word;
}

/* Individual Paragraphs - visual grouping */
.transcript-paragraph {
    margin: 0 0 14px 0;
    padding: 8px 12px;
    border-radius: 6px;
    border-left: 3px solid transparent;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.transcript-paragraph:last-child {
    margin-bottom: 0;
}

/* Individual Sentences within paragraphs (read-along highlighting) */
.transcript-sentence {
    transition: background-color 0.3s ease,
                color 0.3s ease;
    border-radius: 3px;
    padding: 1px 2px;
}

/* Active/highlighted sentence - follows along with audio */
.transcript-sentence.active {
    background-color: rgba(255, 0, 0, 0.2);
    color: #ffffff;
}

/* Slightly dim non-active sentences when any sentence is active */
.transcript-text.has-active .transcript-sentence:not(.active) {
    color: rgba(224, 224, 224, 0.5);
}

/* Placeholder state when no transcript available */
.transcript-text.empty {
    color: var(--text-secondary, #a0a0a0);
    font-style: italic;
    text-align: center;
    padding: 20px 0;
}

/* Loading state */
.transcript-text.loading {
    color: var(--text-secondary, #a0a0a0);
    text-align: center;
    padding: 20px 0;
}

.transcript-text.loading::after {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid rgba(255, 0, 0, 0.3);
    border-top-color: var(--primary-color, #ff0000);
    border-radius: 50%;
    margin-left: 8px;
    animation: transcript-spin 0.8s linear infinite;
    vertical-align: middle;
}

@keyframes transcript-spin {
    to { transform: rotate(360deg); }
}

/* Adjust audio player border radius when panel is open */
.audio-player.transcript-open {
    border-radius: 0 0 12px 12px;
}

/* Mobile responsiveness */
@media (max-width: 400px) {
    .transcript-panel.open {
        max-height: 70vh;
        padding: 12px;
    }
    
    .transcript-content {
        height: 240px;
        min-height: 240px;
    }

    .transcript-jump-overlay .poi-picker-list {
        height: calc(100% - 58px);
    }
    
    .transcript-text {
        font-size: 13px;
        line-height: 1.6;
    }
    
    .transcript-paragraph {
        padding: 6px 10px;
        margin-bottom: 10px;
    }
    
    .transcript-panel-title {
        font-size: 16px;
    }
    
    .audio-transcript-btn {
        /* sizing handled by .control-btn in main.css */
    }
    
    .audio-transcript-btn i {
        font-size: 12px;
    }
}

body.light-mode .transcript-jump-overlay {
    background: rgba(255, 255, 255, 0.7);
}

body.light-mode .transcript-jump-overlay .poi-picker-sheet {
    box-shadow: none;
}

/* When panel is open, add subtle glow effect */
.transcript-panel.open {
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5),
                0 0 30px rgba(255, 0, 0, 0.1);
}

/* ===== LIGHT MODE — Transcript panel ===== */
body.light-mode .transcript-panel-title {
    color: #fff;
}
