/* Text Voice Video Maker — polished UI */

.tvv-tool {
    --tvv-line: rgba(148, 163, 184, .18);
    --tvv-glow: rgba(0, 174, 239, .22);
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
}

.tvv-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.tvv-hidden-select {
    display: none !important;
}

/* Author display:flex was overriding the HTML hidden attribute */
.tvv-tool [hidden] {
    display: none !important;
}

.tvv-hero {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding: 1.15rem 1.25rem;
    border-radius: 18px;
    border: 1px solid var(--tvv-line);
    background:
        radial-gradient(1200px 180px at 10% -40%, rgba(0, 174, 239, .22), transparent 55%),
        linear-gradient(145deg, rgba(15, 23, 41, .95), rgba(11, 22, 34, .88));
}

.tvv-hero-icon {
    flex-shrink: 0;
    width: 58px;
    height: 58px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    color: #7dd3fc;
    background: linear-gradient(145deg, rgba(0, 174, 239, .28), rgba(14, 165, 233, .08));
    border: 1px solid rgba(56, 189, 248, .35);
    box-shadow: 0 10px 30px rgba(0, 174, 239, .12);
}

.tvv-kicker {
    margin: 0 0 .25rem;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #38bdf8;
}

.tvv-hero-title {
    margin: 0 0 .35rem;
    font-size: 1.28rem;
    font-weight: 800;
    letter-spacing: -.02em;
    color: #f1f5f9;
}

.tvv-hero-sub {
    margin: 0;
    max-width: 40rem;
    color: #94a3b8;
    font-size: .92rem;
    line-height: 1.5;
}

.tvv-mode-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .65rem;
}

.tvv-mode-tab {
    display: flex;
    align-items: center;
    gap: .7rem;
    text-align: left;
    border: 1px solid var(--tvv-line);
    background: rgba(15, 23, 41, .55);
    color: #94a3b8;
    border-radius: 14px;
    padding: .75rem .9rem;
    cursor: pointer;
    transition: transform .15s ease, border-color .15s ease, background .15s ease, box-shadow .15s ease;
    min-width: 0;
}

.tvv-mode-tab:hover {
    transform: translateY(-1px);
    border-color: rgba(0, 174, 239, .35);
}

.tvv-mode-tab.active {
    color: #e0f2fe;
    border-color: rgba(0, 174, 239, .55);
    background: linear-gradient(145deg, rgba(0, 174, 239, .18), rgba(15, 23, 41, .7));
    box-shadow: 0 12px 28px rgba(0, 174, 239, .12);
}

.tvv-mode-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, .04);
    border: 1px solid rgba(148, 163, 184, .16);
    color: #7dd3fc;
    flex-shrink: 0;
}

.tvv-mode-tab.active .tvv-mode-icon {
    background: rgba(0, 174, 239, .2);
    border-color: rgba(56, 189, 248, .35);
}

.tvv-mode-text {
    display: flex;
    flex-direction: column;
    gap: .15rem;
    min-width: 0;
}

.tvv-mode-text strong {
    font-size: .98rem;
    color: inherit;
}

.tvv-mode-text small {
    color: #64748b;
    font-size: .8rem;
    line-height: 1.35;
}

.tvv-mode-tab.active .tvv-mode-text small {
    color: #94a3b8;
}

.tvv-layout {
    display: grid;
    grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
    gap: 1.25rem;
    align-items: start;
}

.tvv-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
}

.tvv-section {
    padding: 1rem 1.05rem;
    border-radius: 16px;
    border: 1px solid var(--tvv-line);
    background: rgba(15, 23, 41, .72);
    display: flex;
    flex-direction: column;
    gap: .7rem;
    min-width: 0;
    position: relative;
}

.tvv-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
}

.tvv-section-head h3 {
    margin: 0;
    font-size: .84rem;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: #cbd5e1;
}

.tvv-count-pill {
    font-size: .72rem;
    font-weight: 700;
    color: #7dd3fc;
    background: rgba(0, 174, 239, .12);
    border: 1px solid rgba(56, 189, 248, .25);
    border-radius: 999px;
    padding: .2rem .55rem;
}

.tvv-controls .form-group {
    margin-bottom: 0;
}

.tvv-textarea {
    min-height: 140px;
    resize: vertical;
    line-height: 1.55;
    border-radius: 12px !important;
    background: rgba(2, 6, 23, .45) !important;
    border-color: rgba(148, 163, 184, .22) !important;
}

.tvv-textarea:focus {
    border-color: rgba(0, 174, 239, .55) !important;
    box-shadow: 0 0 0 3px rgba(0, 174, 239, .12);
}

.tvv-voice-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: .65rem;
    align-items: stretch;
}

.tvv-gen-btn {
    width: 100%;
    white-space: nowrap;
    height: 44px;
}

.tvv-form-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: .75rem;
}

.tvv-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: .65rem;
    padding: .85rem;
    border-radius: 16px;
    border: 1px solid rgba(0, 174, 239, .28);
    background: linear-gradient(145deg, rgba(0, 174, 239, .12), rgba(15, 23, 41, .75));
    position: sticky;
    bottom: .75rem;
    z-index: 4;
}

.tvv-btn-preview,
.tvv-btn-render {
    min-height: 46px;
    width: 100%;
    border-radius: 12px !important;
    font-weight: 800;
}

.tvv-drop {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    min-height: 120px;
    padding: 1.1rem;
    border-radius: 14px;
    border: 1.5px dashed rgba(56, 189, 248, .4);
    background:
        radial-gradient(circle at 50% 0%, rgba(0, 174, 239, .14), transparent 60%),
        rgba(2, 6, 23, .35);
    cursor: pointer;
    text-align: center;
    transition: border-color .15s, background .15s, transform .15s;
}

.tvv-drop:hover {
    border-color: rgba(56, 189, 248, .75);
    transform: translateY(-1px);
}

.tvv-drop input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.tvv-drop-icon { font-size: 1.5rem; }
.tvv-drop-title {
    font-weight: 700;
    color: #e2e8f0;
}
.tvv-drop-sub {
    font-size: .8rem;
    color: #64748b;
    max-width: 18rem;
}

.tvv-file-name {
    margin: 0;
    font-size: .85rem;
    color: #86efac;
    font-weight: 600;
}

.tvv-field-label {
    margin: .15rem 0 0;
    font-size: .78rem;
    font-weight: 700;
    color: #94a3b8;
}

.tvv-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
}

.tvv-chip-row-tight {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
}

.tvv-chip-row-tight .tvv-chip {
    justify-content: center;
    min-width: 0;
    text-align: center;
}

.tvv-chip {
    border: 1px solid rgba(148, 163, 184, .22);
    background: rgba(2, 6, 23, .35);
    color: #94a3b8;
    border-radius: 999px;
    padding: .42rem .8rem;
    font-size: .8rem;
    font-weight: 700;
    cursor: pointer;
    transition: .15s ease;
}

.tvv-chip:hover {
    border-color: rgba(0, 174, 239, .4);
    color: #e2e8f0;
}

.tvv-chip.active {
    color: #e0f2fe;
    border-color: rgba(0, 174, 239, .55);
    background: rgba(0, 174, 239, .18);
    box-shadow: 0 0 0 1px rgba(0, 174, 239, .12);
}

.tvv-theme-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: .5rem;
}

.tvv-theme-swatch {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .4rem;
    padding: .55rem .35rem;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, .18);
    background: rgba(2, 6, 23, .3);
    color: #94a3b8;
    font-size: .72rem;
    font-weight: 700;
    cursor: pointer;
    transition: .15s ease;
}

.tvv-theme-swatch:hover,
.tvv-theme-swatch.active {
    border-color: rgba(0, 174, 239, .5);
    color: #e2e8f0;
}

.tvv-theme-swatch.active {
    background: rgba(0, 174, 239, .12);
}

.tvv-swatch {
    width: 100%;
    height: 28px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, .12);
}

.tvv-swatch-aurora { background: linear-gradient(135deg, #0b1220, #0f766e, #38bdf8); }
.tvv-swatch-midnight { background: linear-gradient(135deg, #020617, #1e1b4b, #a78bfa); }
.tvv-swatch-sunset { background: linear-gradient(135deg, #1c0b0b, #9a3412, #fb923c); }
.tvv-swatch-clean { background: linear-gradient(135deg, #f8fafc, #cbd5e1, #0284c7); }

.tvv-btn-render {
    box-shadow: 0 10px 28px rgba(0, 174, 239, .22);
}

.tvv-gen-btn,
.tvv-btn-preview,
.tvv-btn-render {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
}

.tvv-status {
    min-height: 1.25rem;
    margin: 0;
    font-size: .86rem;
    color: #94a3b8;
    padding: 0 .15rem;
}

.tvv-status.is-error { color: #fca5a5; }
.tvv-status.is-ok { color: #86efac; }

.tvv-preview-pane {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: .75rem;
    position: sticky;
    /* Clear sticky site header (72px) + optional ad strip + breathing room */
    top: calc(72px + 3.25rem);
    z-index: 5;
    max-height: calc(100vh - 72px - 4.5rem);
    overflow: auto;
    padding-bottom: .25rem;
    scrollbar-width: thin;
}

.tvv-stage-card {
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, .2);
    background: #020617;
    box-shadow:
        0 24px 60px rgba(2, 6, 23, .55),
        0 0 0 1px rgba(0, 174, 239, .06);
    flex-shrink: 0;
}

.tvv-stage-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .45rem .5rem;
    padding: .7rem .95rem;
    font-size: .8rem;
    font-weight: 700;
    color: #cbd5e1;
    background: linear-gradient(90deg, rgba(15, 23, 41, .95), rgba(11, 22, 34, .9));
    border-bottom: 1px solid rgba(148, 163, 184, .14);
    min-height: 48px;
}

.tvv-live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 0 rgba(34, 197, 94, .6);
    animation: tvvPulse 1.6s ease-out infinite;
    flex-shrink: 0;
}

@keyframes tvvPulse {
    0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, .55); }
    70% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.tvv-stage-bar-spacer { flex: 1; min-width: .5rem; }

.tvv-quality-badge {
    font-size: .72rem;
    font-weight: 800;
    color: #7dd3fc;
    background: rgba(0, 174, 239, .14);
    border: 1px solid rgba(56, 189, 248, .28);
    border-radius: 999px;
    padding: .18rem .55rem;
    white-space: nowrap;
}

.tvv-stage-wrap {
    position: relative;
    background: #020617;
    overflow: hidden;
    width: 100%;
    aspect-ratio: 16 / 9;
    min-height: 200px;
}

.tvv-canvas {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    vertical-align: top;
    background: #020617;
}

.tvv-stage-glow {
    pointer-events: none;
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 18% 18%, rgba(56, 189, 248, .16), transparent 42%),
        radial-gradient(circle at 82% 72%, rgba(168, 85, 247, .12), transparent 40%);
    mix-blend-mode: screen;
}

.tvv-audio-dock {
    padding: .75rem .85rem .9rem;
    background: rgba(15, 23, 41, .92);
    border-top: 1px solid rgba(148, 163, 184, .12);
}

.tvv-audio {
    width: 100%;
    border-radius: 10px;
    height: 36px;
}

.tvv-slides-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
}

.tvv-slides-hint {
    font-size: .78rem;
    color: #64748b;
}

.tvv-slide-tabs {
    display: flex;
    flex-wrap: nowrap;
    gap: .45rem;
    overflow-x: auto;
    padding: .15rem 0 .35rem;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}

.tvv-slide-tab {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    flex: 0 0 auto;
    max-width: 9.5rem;
    min-height: 2.35rem;
    padding: .35rem .65rem .35rem .4rem;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, .25);
    background: rgba(2, 6, 23, .45);
    color: #94a3b8;
    font-weight: 700;
    cursor: pointer;
    transition: border-color .15s, background .15s, color .15s;
}

.tvv-slide-tab:hover {
    border-color: rgba(0, 174, 239, .4);
    color: #e2e8f0;
}

.tvv-slide-tab.active {
    color: #e0f2fe;
    border-color: rgba(0, 174, 239, .55);
    background: rgba(0, 174, 239, .2);
}

.tvv-slide-tab-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.45rem;
    height: 1.45rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, .08);
    font-size: .75rem;
    font-weight: 800;
    flex-shrink: 0;
}

.tvv-slide-tab.active .tvv-slide-tab-num {
    background: rgba(0, 174, 239, .35);
    color: #e0f2fe;
}

.tvv-slide-tab-name {
    font-size: .78rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 6.5rem;
}

.tvv-slide-editor {
    display: flex;
    flex-direction: column;
    gap: .75rem;
    padding: .85rem;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, .16);
    background: rgba(2, 6, 23, .28);
}

.tvv-slide-nav {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: .45rem;
}

.tvv-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    min-height: 2.35rem;
    padding: .4rem .55rem;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, .25);
    background: rgba(15, 23, 41, .65);
    color: #cbd5e1;
    font-size: .8rem;
    font-weight: 700;
    cursor: pointer;
    transition: border-color .15s, background .15s, color .15s;
}

.tvv-nav-btn:hover:not(:disabled) {
    border-color: rgba(0, 174, 239, .45);
    color: #e0f2fe;
    background: rgba(0, 174, 239, .1);
}

.tvv-nav-btn:disabled {
    opacity: .4;
    cursor: not-allowed;
}

.tvv-nav-btn-danger {
    color: #fca5a5;
    border-color: rgba(248, 113, 113, .35);
}

.tvv-nav-btn-danger:hover:not(:disabled) {
    border-color: rgba(248, 113, 113, .6);
    background: rgba(248, 113, 113, .1);
    color: #fecaca;
}

.tvv-danger {
    color: #fca5a5 !important;
    border-color: rgba(248, 113, 113, .35) !important;
}

.tvv-unlimited-tag {
    display: inline-block;
    margin-left: .35rem;
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: #86efac;
    background: rgba(34, 197, 94, .12);
    border: 1px solid rgba(34, 197, 94, .28);
    border-radius: 999px;
    padding: .1rem .4rem;
    vertical-align: middle;
}


@media (max-width: 1100px) {
    .tvv-layout {
        grid-template-columns: 1fr;
    }

    .tvv-preview-pane {
        position: static;
        max-height: none;
        overflow: visible;
        order: -1;
    }

    .tvv-actions {
        position: static;
    }
}

@media (max-width: 640px) {
    .tvv-mode-tabs { grid-template-columns: 1fr; }
    .tvv-theme-row { grid-template-columns: repeat(2, 1fr); }
    .tvv-hero { flex-direction: column; }
    .tvv-mode-text small { display: none; }
}
