/* Standalone VidGen2 composer. Visually matches the shared "chat composer"
   look used across the product (.chat-container / .tv-maker-composer /
   .generate-btn etc.), but with its own scoped class names so it has zero
   structural coupling to that shared component or its tab-switch JS. */

.vg2-composer {
    width: min(980px, calc(100vw - 32px));
    margin: 0 auto 16px;
    border: 1px solid rgba(113, 137, 255, 0.28);
    border-radius: 26px;
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 24px 70px rgba(46, 33, 120, 0.16);
    padding: 18px 18px 16px;
    font-family: Outfit, sans-serif;
}
.vg2-composer * { box-sizing: border-box; }

.vg2-description-input {
    width: 100%;
    min-height: 120px;
    border: 0;
    border-radius: 18px;
    background: linear-gradient(180deg, #FFFFFF 0%, #FAFBFF 100%);
    color: #111827;
    font-size: 16px;
    line-height: 1.55;
    resize: vertical;
    box-shadow: none;
    padding: 14px 16px;
    font-family: inherit;
}
.vg2-description-input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(113, 137, 255, 0.12);
}
.vg2-description-input::placeholder { color: #9CA3AF; }

.vg2-word-count {
    margin-top: 4px;
    color: #94A3B8;
    font-size: 12px;
    text-align: right;
}

.vg2-media-preview-container { margin-top: 10px; }
.vg2-media-preview-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.vg2-media-preview-item {
    position: relative;
    width: 72px;
    height: 72px;
    border-radius: 12px;
    overflow: hidden;
    background: #F3F4F6;
    border: 1px solid #E5E7EB;
}
.vg2-media-preview-item img,
.vg2-media-preview-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.vg2-media-preview-audio {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #405DE6;
    background: linear-gradient(180deg, #FFFFFF 0%, #EEF2FF 100%);
}
.vg2-media-preview-audio svg {
    width: 28px;
    height: 28px;
}
.vg2-media-preview-type {
    position: absolute;
    left: 5px;
    bottom: 5px;
    border-radius: 999px;
    background: rgba(17, 24, 39, .74);
    color: #fff;
    font-size: 9px;
    font-weight: 600;
    line-height: 1;
    padding: 4px 6px;
    text-transform: capitalize;
}
.vg2-media-preview-item.is-uploading::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,.55);
    animation: vg2w-pulse 1.1s ease-in-out infinite;
}
@keyframes vg2w-pulse {
    0%, 100% { opacity: .35; }
    50% { opacity: .75; }
}
.vg2-media-preview-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: none;
    background: rgba(17,24,39,.7);
    color: #fff;
    font-size: 11px;
    line-height: 1;
    cursor: pointer;
}

.vg2-error-inline {
    background: #FEF2F2;
    border: 1px solid #FCA5A5;
    color: #B91C1C;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13px;
    margin-top: 12px;
}

/* Bottom controls row — mirrors .box-btn / .options / .option from the shared composer */
.vg2-box-btn {
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.vg2-options {
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.vg2-option {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 42px;
    padding: 0 12px;
    border-radius: 10px;
    font-size: 14px;
    color: #0E0F26;
    cursor: pointer;
    background: #FFFFFF;
    border: 1px solid #E3E6EF;
    transition: all .18s ease;
}

.vg2-media-upload-control {
    gap: 7px;
    background: linear-gradient(180deg, #FFFFFF 0%, #F8FAFF 100%);
    box-shadow: 0 1px 2px rgba(16, 24, 40, .05);
}
.vg2-media-upload-control:hover {
    border-color: #BFC7FF;
    background: #F7F5FF;
    color: #5b3df5;
}

.vg2-character-select-control {
    gap: 7px;
    background: linear-gradient(180deg, #FFFFFF 0%, #F8FAFF 100%);
    box-shadow: 0 1px 2px rgba(16, 24, 40, .05);
}
.vg2-character-select-control:hover {
    border-color: #BFC7FF;
    background: #F7F5FF;
    color: #5b3df5;
}
.vg2-character-list {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.vg2-character-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    max-width: 210px;
    min-height: 42px;
    border: 1px solid #BFDBFE;
    background: #EFF6FF;
    color: #1E3A8A;
    border-radius: 12px;
    padding: 5px 8px 5px 5px;
}
.vg2-character-chip img {
    width: 28px;
    height: 28px;
    border-radius: 9px;
    object-fit: cover;
    flex: 0 0 28px;
    background: #DBEAFE;
}
.vg2-character-chip span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    font-weight: 600;
}
.vg2-character-chip button {
    border: 0;
    background: transparent;
    color: #1E3A8A;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
}
.vg2-character-chip button:hover {
    background: rgba(30, 58, 138, 0.12);
}

.vg2-aspect-ratio-control {
    padding: 3px;
    gap: 2px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    cursor: default;
}
.vg2-aspect-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    color: #64748B;
    background: transparent;
    cursor: pointer;
}
.vg2-aspect-toggle.is-active {
    color: #0E0F26;
    background: #F1F5F9;
}
.vg2-aspect-toggle svg { width: 22px; height: 22px; pointer-events: none; }
.vg2-aspect-toggle rect { stroke: currentColor; stroke-width: 1.8; }

.vg2-generate-btn {
    border-radius: 10px;
    background: linear-gradient(135deg, #405DE6 -0.74%, #833AB4 99.26%);
    color: #FCFCFF;
    border: none;
    padding: 11px 24px;
    font-size: 15px;
    font-weight: 600;
    font-family: Outfit, sans-serif;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 4px 14px rgba(131, 58, 180, 0.25);
    letter-spacing: 0.2px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}
.vg2-generate-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #3750d1 -0.74%, #7230a3 99.26%);
    box-shadow: 0 6px 20px rgba(131, 58, 180, 0.35);
    transform: translateY(-1px);
}
.vg2-generate-btn:disabled {
    opacity: .6;
    cursor: not-allowed;
    transform: none;
}

body.vg2-template-modal-open {
    overflow: hidden;
}

.vg2-template-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10040;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(8, 10, 16, .78);
    backdrop-filter: blur(8px);
}

.vg2-template-modal {
    position: relative;
    display: grid;
    grid-template-columns: minmax(320px, 0.85fr) minmax(400px, 1fr);
    gap: 32px;
    width: min(1040px, calc(100vw - 32px));
    max-height: min(88vh, 760px);
    overflow: hidden;
    border: 2px solid #303034;
    border-radius: 34px;
    background: #1D1D1F;
    color: #F8FAFC;
    box-shadow: 0 28px 90px rgba(0, 0, 0, .44);
    padding: 28px 26px 26px 34px;
}

.vg2-template-modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 2;
    width: 34px;
    height: 34px;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 999px;
    background: rgba(255, 255, 255, .08);
    color: #F8FAFC;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.vg2-template-preview {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 500px;
    padding: 6px 0 0;
    text-align: center;
}

.vg2-template-preview .vg2-template-visual {
    width: 100%;
    max-width: 360px;
    height: auto;
    object-fit: contain;
    margin: auto auto 10px;
    filter: drop-shadow(0 24px 48px rgba(0, 0, 0, .38));
}

.vg2-template-hero-title {
    margin: 0 auto;
    color: #FFFFFF;
    font-size: clamp(24px, 2.7vw, 34px);
    font-weight: 650;
    line-height: 1.1;
    max-width: 420px;
}

.vg2-template-hero-title span {
    color: #8B3DFF;
}

.vg2-template-hero-subtitle {
    margin: 12px auto 20px;
    color: #A6ACB7;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.35;
    max-width: 360px;
}

.vg2-template-details {
    min-width: 0;
    overflow-y: auto;
    padding: 0 12px 2px 0;
}

.vg2-template-prompt {
    width: 100%;
    min-height: 112px;
    max-height: 260px;
    resize: vertical;
    border: 0;
    border-radius: 16px;
    background: #303033;
    color: #F8FAFC;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.55;
    padding: 14px 16px;
    outline: none;
}

.vg2-template-prompt::placeholder {
    color: #A8AFBA;
}

.vg2-template-prompt:focus {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, .08);
}

.vg2-template-count {
    margin-top: 5px;
    color: #8F98A8;
    font-size: 12px;
    text-align: right;
}

.vg2-template-section {
    margin-top: 20px;
}

.vg2-template-section--first {
    margin-top: 4px;
}

.vg2-template-section-title {
    display: block;
    margin-bottom: 10px;
    color: #A7ADB8;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
}

.vg2-template-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.vg2-template-upload-card {
    width: 100%;
    min-height: 88px;
    border: 0;
    border-radius: 16px;
    background: #303033;
    color: #F8FAFC;
    padding: 16px 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 18px;
    text-align: left;
}

.vg2-template-upload-card:hover {
    background: #36363A;
}

.vg2-template-upload-card.is-dragover {
    background: #3A3346;
    box-shadow: 0 0 0 3px rgba(139, 61, 255, .22);
}

.vg2-template-upload-card strong {
    display: block;
    color: #FFFFFF;
    font-size: 15px;
    font-weight: 650;
    line-height: 1.2;
}

.vg2-template-upload-card small {
    display: block;
    margin-top: 6px;
    color: #AAB0BC;
    font-size: 13px;
    font-weight: 500;
}

.vg2-template-upload-icon {
    width: 56px;
    height: 56px;
    border-radius: 15px;
    background: #D6B6FF;
    color: #8738F5;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 56px;
    box-shadow: -7px 8px 0 #8338EC;
}

.vg2-template-upload-icon svg {
    width: 27px;
    height: 27px;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.vg2-template-media-list,
.vg2-template-character-list {
    margin-top: 12px;
}

.vg2-template-details .vg2-aspect-ratio-control {
    width: fit-content;
    min-height: 46px;
    background: #303033;
    border: 0;
    border-radius: 14px;
    padding: 5px;
}

.vg2-template-details .vg2-aspect-toggle {
    color: #CBD5E1;
    width: 44px;
    height: 34px;
}

.vg2-template-details .vg2-aspect-toggle.is-active {
    color: #FFFFFF;
    background: rgba(255, 255, 255, .12);
}

.vg2-template-dropdown {
    position: relative;
    width: min(220px, 100%);
}

.vg2-template-dropdown-btn {
    width: 100%;
    min-height: 46px;
    border: 0;
    border-radius: 14px;
    background: #303033;
    color: #F8FAFC;
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
}

.vg2-template-dropdown-icon {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 24px;
    color: #CBD5E1;
}

.vg2-template-dropdown-icon svg,
.vg2-template-dropdown-item svg {
    width: 22px;
    height: 22px;
}

.vg2-template-dropdown-icon rect,
.vg2-template-dropdown-item rect {
    stroke: currentColor;
    stroke-width: 1.8;
}

.vg2-template-dropdown-caret {
    margin-left: auto;
    width: 9px;
    height: 9px;
    border-right: 2px solid #CBD5E1;
    border-bottom: 2px solid #CBD5E1;
    transform: rotate(45deg) translateY(-2px);
}

.vg2-template-dropdown-menu {
    position: absolute;
    z-index: 10090;
    left: 0;
    top: calc(100% + 8px);
    min-width: 100%;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 14px;
    background: #28282B;
    box-shadow: 0 16px 40px rgba(0, 0, 0, .36);
    padding: 6px;
}

.vg2-template-dropdown-item {
    width: 100%;
    min-height: 40px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #D8DEE9;
    padding: 0 10px;
    display: flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    text-align: left;
}

.vg2-template-dropdown-item:hover,
.vg2-template-dropdown-item.is-active {
    background: rgba(255, 255, 255, .10);
    color: #FFFFFF;
}

.vg2-template-details .vg2-character-chip {
    background: #252E3C;
    border-color: rgba(147, 197, 253, .26);
    color: #DBEAFE;
}

.vg2-template-optional {
    display: inline-flex;
    margin-left: 8px;
    padding: 4px 10px;
    border-radius: 999px;
    background: #3A3A3D;
    color: #AAB0BC;
    font-size: 12px;
    font-weight: 500;
    vertical-align: middle;
}

.vg2-template-character-card {
    min-width: 176px;
    min-height: 64px;
    border: 0;
    border-radius: 16px;
    background: #303033;
    color: #F8FAFC;
    padding: 11px 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 650;
    cursor: pointer;
}

.vg2-template-character-card:hover {
    background: #36363A;
}

.vg2-template-character-icon {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    background: #E5E7EB;
    color: #303033;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    line-height: 1;
}

.vg2-template-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 26px;
}

.vg2-template-footer .vg2-generate-btn {
    width: 100%;
    min-height: 50px;
    justify-content: center;
    border-radius: 16px;
    font-size: 15px;
    font-weight: 650;
}

.vg2-template-secondary {
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 10px;
    background: transparent;
    color: #F8FAFC;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.vg2-template-secondary:hover {
    background: rgba(255, 255, 255, .08);
}

@media (max-width: 600px) {
    .vg2-composer { padding: 14px; }
    .vg2-box-btn { flex-direction: column; align-items: stretch; }
    .vg2-generate-btn { justify-content: center; }
    .vg2-template-modal-backdrop { padding: 12px; align-items: stretch; }
    .vg2-template-modal {
        grid-template-columns: 1fr;
        gap: 16px;
        width: 100%;
        max-height: calc(100vh - 24px);
        overflow-y: auto;
        padding: 14px;
    }
    .vg2-template-preview { min-height: auto; }
    .vg2-template-preview .vg2-template-visual {
        max-width: min(300px, 82vw);
        margin-top: 8px;
    }
    .vg2-template-hero-title { font-size: 26px; }
    .vg2-template-hero-subtitle { font-size: 14px; margin-bottom: 12px; }
    .vg2-template-section-title { font-size: 14px; }
    .vg2-template-upload-card { min-height: 92px; padding: 16px; }
    .vg2-template-upload-icon { width: 54px; height: 54px; flex-basis: 54px; }
    .vg2-template-upload-card strong { font-size: 15px; }
    .vg2-template-upload-card small { font-size: 13px; }
    .vg2-template-details { overflow: visible; padding-right: 0; }
    .vg2-template-footer { flex-direction: column-reverse; }
    .vg2-template-footer .vg2-generate-btn { width: 100%; justify-content: center; font-size: 15px; }
}
