/**
 * AI dubbing on reels (2026-10-02). Viewer language picker + creator
 * "Dub this reel" control. Hidden entirely while the feature is off
 * (body.reel-dubbing-off).
 */

/* Fail-closed: every dub control hides while the switch is off. */
body.reel-dubbing-off .reel-dub-chip,
body.reel-dubbing-off .reel-dub-btn,
body.reel-dubbing-off .reel-dub-menu,
body.reel-dubbing-off .reel-dub-overlay {
    display: none !important;
}

/* Viewer language chip in the viewer topbar. */
.reel-dub-chip,
.reel-dub-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(11, 11, 15, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.22);
    color: #f2f2f5;
    border-radius: 8px;
    padding: 5px 9px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.reel-dub-chip ion-icon,
.reel-dub-btn ion-icon {
    font-size: 15px;
}

.reel-dub-chip.is-dubbed {
    border-color: #7c3cff;
    color: #cdb4ff;
}

.reel-dub-chip:hover,
.reel-dub-btn:hover {
    border-color: #7c3cff;
}

/* Language dropdown. */
.reel-dub-menu {
    position: fixed;
    z-index: 9999;
    min-width: 170px;
    background: var(--jf-near-black, #0B0B0F);
    border: 1px solid var(--jf-graphite, #2C2C37);
    border-radius: 10px;
    padding: 6px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
}

.reel-dub-item {
    display: block;
    width: 100%;
    text-align: left;
    background: transparent;
    border: 0;
    color: #f2f2f5;
    font-size: 13px;
    padding: 9px 10px;
    border-radius: 7px;
    cursor: pointer;
}

.reel-dub-item:hover {
    background: #23232c;
}

.reel-dub-item.is-active {
    color: #cdb4ff;
}

/* Creator modal. */
.reel-dub-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(5, 5, 7, 0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.reel-dub-modal {
    width: 100%;
    max-width: 430px;
    background: #101014;
    border: 1px solid var(--jf-graphite, #2C2C37);
    border-radius: 14px;
    padding: 18px;
    color: #f2f2f5;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
}

.reel-dub-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.reel-dub-modal-head h4 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
}

.reel-dub-close {
    background: transparent;
    border: 0;
    color: #a7a7b3;
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
}

.reel-dub-modal-sub {
    color: #a7a7b3;
    font-size: 13px;
    margin: 0 0 12px;
}

.reel-dub-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-top: 1px solid var(--jf-graphite, #2C2C37);
}

.reel-dub-lang {
    font-weight: 700;
    font-size: 14px;
    min-width: 88px;
}

.reel-dub-status {
    flex: 1;
    font-size: 12px;
}

.reel-dub-pill {
    display: inline-block;
    background: rgba(255,255,255,0.07);
    color: #a7a7b3;
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 700;
}

.reel-dub-pill.is-ready {
    background: rgba(52, 199, 123, 0.16);
    color: #4ade9e;
}

.reel-dub-pill.is-working {
    background: rgba(124, 60, 255, 0.18);
    color: #cdb4ff;
}

.reel-dub-pill.is-failed {
    background: rgba(255, 92, 98, 0.16);
    color: #ff8f94;
}

.reel-dub-bar {
    height: 5px;
    background: #23232c;
    border-radius: 3px;
    margin-top: 7px;
    overflow: hidden;
}

.reel-dub-bar-fill {
    height: 100%;
    background: linear-gradient(135deg, #7c3cff, #a855f7);
    border-radius: 3px;
    transition: width 0.6s ease;
}

.reel-dub-step {
    color: #a7a7b3;
    font-size: 11px;
    margin-top: 5px;
    word-break: break-word;
}

.reel-dub-action {
    text-align: right;
}

.reel-dub-start {
    background: linear-gradient(135deg, #7c3cff, #a855f7);
    border: 0;
    color: #fff;
    border-radius: 8px;
    padding: 7px 12px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.reel-dub-start:disabled {
    opacity: 0.55;
    cursor: default;
}

.reel-dub-link {
    color: #cdb4ff;
    font-size: 12px;
    font-weight: 600;
    margin-right: 8px;
}

.reel-dub-loading,
.reel-dub-error {
    color: #a7a7b3;
    font-size: 13px;
    padding: 14px 0;
    text-align: center;
}

.reel-dub-error {
    color: #ff8f94;
}
