/* ══════════════════════════════════════════════
   TikTok Video Generator Pro – Styles
   Format 9:16, mobile-first, TikTok-like UI
══════════════════════════════════════════════ */

/* ── Root ──────────────────────────────────── */
.ttvg-wrap {
    --pink:   #fe2c55;
    --cyan:   #25f4ee;
    --dark:   #0f0f0f;
    --panel:  #1a1a1a;
    --border: rgba(255,255,255,.1);
    --radius: 14px;

    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--dark);
    color: #fff;
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    gap: 28px;
    align-items: flex-start;
    flex-wrap: wrap;
    max-width: 960px;
    margin: 2rem auto;
    box-shadow: 0 16px 48px rgba(0,0,0,.6);
}

/* ── Phone frame (9:16 preview) ────────────── */
.ttvg-phone-frame {
    position: relative;
    flex: 0 0 auto;
    width: 270px;
}

.ttvg-screen {
    position: relative;
    width: 270px;
    height: 480px;            /* 270 × 16/9 = 480 */
    border-radius: 22px;
    overflow: hidden;
    background: #000;
    box-shadow: 0 0 0 3px #333, 0 0 0 5px #111;
}

.ttvg-canvas {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    display: block;
    object-fit: cover;
}

.ttvg-video-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

/* ── TikTok Chrome UI ──────────────────────── */
.ttvg-ui-top {
    position: absolute;
    top: 0; left: 0; right: 0;
    z-index: 10;
    padding: 14px 0 8px;
    text-align: center;
    background: linear-gradient(to bottom, rgba(0,0,0,.5), transparent);
}

.ttvg-ui-label {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .02em;
    border-bottom: 2px solid #fff;
    padding-bottom: 2px;
}

.ttvg-ui-sidebar {
    position: absolute;
    right: 8px;
    bottom: 90px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.ttvg-ui-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 22px;
    line-height: 1;
    cursor: default;
}
.ttvg-ui-action span {
    font-size: 9px;
    margin-top: 2px;
    opacity: .9;
}

.ttvg-spin { animation: ttvg-spin 3s linear infinite; display:block; }
@keyframes ttvg-spin { to { transform: rotate(360deg); } }

.ttvg-ui-bottom {
    position: absolute;
    bottom: 0; left: 0; right: 50px;
    z-index: 10;
    padding: 12px;
    background: linear-gradient(to top, rgba(0,0,0,.7), transparent);
}
.ttvg-ui-bottom strong { font-size: 13px; display: block; }
.ttvg-caption { font-size: 11px; margin: 4px 0 0; opacity: .85; line-height: 1.4; }

/* ── Progress ring ─────────────────────────── */
.ttvg-progress-ring {
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 52px;
    height: 52px;
    pointer-events: none;
}

.ttvg-ring-bar {
    transition: stroke-dashoffset .1s linear;
}

/* ── Loading ───────────────────────────────── */
.ttvg-loading {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,.65);
    gap: 10px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s;
}
.ttvg-loading.is-on { opacity: 1; pointer-events: auto; }

.ttvg-spinner {
    width: 38px; height: 38px;
    border: 4px solid rgba(255,255,255,.2);
    border-top-color: var(--pink);
    border-radius: 50%;
    animation: ttvg-spin .7s linear infinite;
}
.ttvg-loading-txt { font-size: 12px; opacity: .85; }

/* ── Controls panel ────────────────────────── */
.ttvg-controls {
    flex: 1;
    min-width: 260px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ttvg-panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
}

.ttvg-panel h4 {
    margin: 0 0 12px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .03em;
    opacity: .9;
}

/* ── Line editor ───────────────────────────── */
.ttvg-line-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.ttvg-line-text {
    flex: 1;
    min-width: 120px;
    background: rgba(255,255,255,.07);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: #fff;
    padding: 7px 10px;
    font-size: 13px;
    outline: none;
    transition: border-color .2s;
}
.ttvg-line-text:focus { border-color: var(--pink); }

.ttvg-line-color {
    width: 32px; height: 32px;
    border: none; border-radius: 6px;
    cursor: pointer; padding: 2px;
    background: transparent;
}

.ttvg-line-anim {
    background: rgba(255,255,255,.07);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: #fff;
    padding: 6px 8px;
    font-size: 12px;
    outline: none;
    cursor: pointer;
}

.ttvg-line-remove {
    background: none;
    border: none;
    color: rgba(255,100,100,.7);
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 4px;
    border-radius: 4px;
    transition: color .2s;
}
.ttvg-line-remove:hover { color: #ff6b6b; }

/* ── AI panel ──────────────────────────────── */
.ttvg-ai-prompt {
    width: 100%;
    box-sizing: border-box;
    background: rgba(255,255,255,.07);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: #fff;
    padding: 8px 10px;
    font-size: 13px;
    resize: vertical;
    outline: none;
    font-family: inherit;
    transition: border-color .2s;
}
.ttvg-ai-prompt:focus { border-color: var(--cyan); }

.ttvg-ai-row {
    display: flex;
    gap: 8px;
    margin: 10px 0;
    flex-wrap: wrap;
}

.ttvg-ai-row select {
    flex: 1;
    background: rgba(255,255,255,.07);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: #fff;
    padding: 7px 8px;
    font-size: 12px;
    outline: none;
    cursor: pointer;
    min-width: 90px;
}

.ttvg-ai-status {
    margin: 8px 0 0;
    font-size: 12px;
    opacity: .7;
    min-height: 18px;
}

/* ── Buttons ───────────────────────────────── */
.ttvg-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: 8px;
    border: none;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity .2s, transform .1s;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.ttvg-btn:active  { transform: scale(.97); }
.ttvg-btn:disabled { opacity: .4; cursor: not-allowed; }

.ttvg-btn-add-line { background: rgba(255,255,255,.08); color: #fff; width: 100%; justify-content: center; margin-top: 6px; }
.ttvg-btn-ai       { background: linear-gradient(135deg, var(--cyan), #6c63ff); color: #000; width: 100%; justify-content: center; font-weight: 800; }
.ttvg-btn-play     { background: var(--pink); color: #fff; }
.ttvg-btn-stop     { background: #333; color: #fff; }
.ttvg-btn-record   { background: linear-gradient(135deg, var(--pink), #ff6b35); color: #fff; }
.ttvg-btn-download { background: #25f4ee; color: #000; }

.ttvg-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.ttvg-actions .ttvg-btn { flex: 1; justify-content: center; }

.ttvg-hidden { display: none !important; }

/* ── Responsive ────────────────────────────── */
@media (max-width: 640px) {
    .ttvg-wrap { flex-direction: column; padding: 16px; align-items: center; }
    .ttvg-controls { width: 100%; }
}
