/* Speech services: cards, live transcript and speaker controls. */

.speech-card .image-container {
    aspect-ratio: 3 / 2;
    overflow: hidden;
    border-radius: 10px;
}

.speech-card .image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.speech-card-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: #edf3f2;
    color: #9fb5b1;
    font-size: 64px;
}

.dark .speech-card-placeholder {
    background: rgba(255, 255, 255, .06);
}

.speech-card {
    display: flex;
    flex-direction: column;
}

.speech-card-footer {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid #dfeae8;
}

.speech-card .mt-3 {
    margin-bottom: 15px;
}

.speech-card-footer-text {
    display: flex;
    flex-direction: column;
    font-size: 14px;
    line-height: 1.35;
}

.speech-card-footer-text span {
    opacity: .7;
}

.speech-qr {
    flex: 0 0 auto;
    width: 92px;
    height: 92px;
    padding: 4px;
    border-radius: 8px;
    background: #fff;
}

.speech-qr svg {
    display: block;
    width: 100%;
    height: 100%;
}

.speech-qr-large {
    width: 220px;
    height: 220px;
    max-width: 100%;
    margin: 0 auto;
}

.speech-live-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 50px;
    background: rgba(0, 0, 0, .7);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.speech-live-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #dc3545;
    animation: speech-pulse 1.4s ease-in-out infinite;
}

@keyframes speech-pulse {
    50% {
        opacity: .35;
    }
}

/* ---------- live panel ---------- */

.speech-live {
    --speech-font-size: 20px;
    padding: 0;
    overflow: hidden;
}

.speech-live-header,
.speech-live-footer,
.speech-speaker {
    padding: 12px 20px;
}

.speech-live-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-bottom: 1px solid #dfeae8;
}

.speech-live-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.speech-live-tools .form-select {
    width: auto;
    min-width: 150px;
    margin: 0;
}

.speech-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
}

.speech-status::before {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #adb5bd;
}

.speech-status-live {
    color: #dc3545;
}

.speech-status-live::before {
    background: #dc3545;
    animation: speech-pulse 1.4s ease-in-out infinite;
}

.speech-status-waiting::before,
.speech-status-paused::before {
    background: #f0ad4e;
}

.speech-status-paused {
    color: #b8860b;
}

.speech-status-ended::before,
.speech-status-archive::before {
    background: #6c757d;
}

.speech-speaker {
    background: #fff8e6;
    border-bottom: 1px solid #f3e2b3;
}

.dark .speech-speaker {
    background: rgba(240, 173, 78, .12);
    border-color: rgba(240, 173, 78, .3);
}

.speech-speaker-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.speech-speaker-row .form-select {
    width: auto;
    margin: 0;
}

.speech-speaker-label {
    font-weight: 700;
    margin-right: auto;
}

.speech-speaker-status {
    margin-top: 6px;
    font-size: 14px;
    opacity: .8;
}

.speech-speaker-status.is-live {
    color: #198754;
    opacity: 1;
}

.speech-speaker-status.is-warn {
    color: #b8860b;
    opacity: 1;
}

.speech-speaker-status.is-error {
    color: #dc3545;
    opacity: 1;
}

.speech-transcript-wrap {
    position: relative;
}

.speech-transcript {
    --speech-pad: 20px;
    height: 60vh;
    min-height: 280px;
    overflow-y: auto;
    padding: var(--speech-pad);
    font-size: var(--speech-font-size);
    line-height: 1.6;
    scroll-behavior: smooth;
}

.speech-transcript p {
    margin: 0 0 .6em;
}

.speech-transcript .speech-pending {
    opacity: .55;
    font-style: italic;
}

.speech-transcript .speech-partial {
    opacity: .7;
    padding-left: 10px;
    border-left: 3px solid #0cbaa4;
}

.speech-transcript[dir="rtl"] .speech-partial {
    padding-left: 0;
    padding-right: 10px;
    border-left: 0;
    border-right: 3px solid #0cbaa4;
}

/* "Show original": every sentence is a band reaching the box edges, the spoken sentence on top
   and its translation underneath after an arrow. */
.speech-transcript.speech-paired p.speech-seg,
.speech-transcript.speech-paired .speech-partial {
    margin: 0 calc(-1 * var(--speech-pad));
    padding: .7em var(--speech-pad);
}

.speech-transcript.speech-paired .speech-band-alt {
    background: rgba(46, 62, 78, .05);
}

.speech-paired .speech-src {
    display: block;
    font-size: .9em;
    line-height: 1.5;
    color: #6b7680;
}

.speech-paired .speech-tr {
    position: relative;
    display: block;
    margin-top: .25em;
    padding-left: 1.6em;
}

.speech-paired .speech-tr::before {
    content: "\21B3";
    position: absolute;
    top: 0;
    left: .15em;
    color: #9aa4ad;
}

.speech-paired[dir="rtl"] .speech-tr {
    padding-left: 0;
    padding-right: 1.6em;
}

.speech-paired[dir="rtl"] .speech-tr::before {
    content: "\21B2";
    left: auto;
    right: .15em;
}

.speech-paired .speech-src[hidden] + .speech-tr {
    margin-top: 0;
    padding: 0;
}

.speech-paired .speech-src[hidden] + .speech-tr::before {
    content: none;
}

/* Only the translation waits; the original is already final. */
.speech-transcript.speech-paired .speech-pending {
    opacity: 1;
    font-style: normal;
}

.speech-paired .speech-pending .speech-tr,
.speech-paired .speech-partial .speech-tr {
    opacity: .6;
}

.speech-paired .speech-pending .speech-tr {
    font-style: italic;
}

.speech-transcript.speech-paired .speech-partial {
    opacity: 1;
    padding-left: calc(var(--speech-pad) - 3px);
}

.speech-transcript.speech-paired[dir="rtl"] .speech-partial {
    padding-left: var(--speech-pad);
    padding-right: calc(var(--speech-pad) - 3px);
}

.dark .speech-transcript.speech-paired .speech-band-alt {
    background: rgba(255, 255, 255, .05);
}

.dark .speech-paired .speech-src {
    color: rgba(255, 255, 255, .6);
}

.dark .speech-paired .speech-tr::before {
    color: rgba(255, 255, 255, .45);
}

.speech-source-switch {
    display: flex;
    align-items: center;
    gap: .4rem;
    min-height: 0;
    margin: 0;
    padding-left: 0;
    font-size: 14px;
    white-space: nowrap;
}

.speech-source-switch .form-check-input {
    float: none;
    margin-left: 0;
}

.speech-source-switch[hidden] {
    display: none;
}

.speech-source-switch .form-check-input {
    margin-top: 0;
    cursor: pointer;
}

.speech-source-switch .form-check-label {
    cursor: pointer;
}

.speech-transcript .speech-empty {
    margin-top: 2em;
    text-align: center;
    font-size: 16px;
    opacity: .6;
}

.speech-jump {
    position: absolute;
    right: 20px;
    bottom: 12px;
    padding: 6px 16px;
}

.speech-live-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 6px;
    border-top: 1px solid #dfeae8;
    font-size: 13px;
}

.speech-disclaimer {
    opacity: .6;
}

/* ---------- side column ---------- */

.speech-side-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.speech-sessions {
    list-style: none;
    margin: 0;
    padding: 0;
}

.speech-sessions li {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 4px 10px;
    padding: 8px 0;
    border-bottom: 1px solid #edf3f2;
    list-style: none;
}

.speech-sessions li:last-child {
    border-bottom: 0;
}

.speech-sessions li.active a {
    font-weight: 700;
}

@media (max-width: 768px) {
    /* The visible screen minus the fixed site header and the language bar, so the whole box,
       newest line included, fits on screen once the page follows it. */
    .speech-transcript {
        height: 65vh;
        height: calc(100svh - 170px);
        min-height: 260px;
        --speech-pad: 15px;
    }

    .speech-speaker + .speech-transcript-wrap .speech-transcript {
        height: calc(100svh - 290px);
    }

    .speech-live-header,
    .speech-live-footer,
    .speech-speaker {
        padding: 10px 15px;
    }
}