/**
 * Video Generation Modal Styles
 * Cloned from music tab styling for consistency
 */

/* New overlay + layout */
.ri-video-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.65);
    z-index: 100000;
    padding: 24px;
}

.ri-video-modal {
    width: min(960px, 100%);
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 12px;
    background: var(--message-ai-bg);
    color: var(--message-ai-text);
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 24px;
}

.ri-video-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.ri-video-modal-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.ri-video-close-btn {
    border: none;
    background: transparent;
    color: var(--message-ai-text);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 6px;
    transition: background 0.2s ease;
}

.ri-video-close-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

.ri-video-main-tabs {
    display: flex;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 10px;
    padding: 4px;
    gap: 4px;
}

.ri-video-main-tab {
    flex: 1;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--message-ai-text);
    font-weight: 600;
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ri-video-main-tab:hover {
    background: rgba(255, 255, 255, 0.06);
}

.ri-video-main-tab.active {
    background: var(--button-bg);
    color: var(--button-text);
}

.ri-video-panel-wrapper {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.ri-video-panel {
    display: none;
}

.ri-video-panel.active {
    display: block;
}

.ri-video-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.ri-luma-config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 12px;
}

.ri-luma-config-grid .ri-video-field {
    margin: 0;
}

.ri-video-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ri-video-field-full {
    grid-column: 1 / -1;
}

.ri-video-field-inline {
    flex-direction: row;
    align-items: center;
    gap: 10px;
}

.ri-video-field label {
    font-size: 13px;
    font-weight: 600;
}

.ri-video-field textarea,
.ri-video-field input[type="text"],
.ri-video-field select,
.ri-video-field input[type="file"] {
    width: 100%;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--chat-input-bg);
    color: var(--message-ai-text);
    padding: 10px 12px;
    font-size: 14px;
}

.ri-video-field select[multiple] {
    min-height: 160px;
}

.ri-video-field textarea {
    resize: vertical;
    min-height: 100px;
}

.ri-video-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 8px;
}

.ri-video-pricing {
    background: rgba(59, 130, 246, 0.15);
    color: var(--message-ai-text);
    padding: 10px 14px;
    border-radius: 8px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.ri-video-alert {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 13px;
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
}

.ri-video-alert.is-success {
    background: rgba(34, 197, 94, 0.18);
    color: #bbf7d0;
}

.ri-video-alert.is-error {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
}

.ri-video-progress {
    margin-top: 10px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 10px;
    padding: 12px;
}

.ri-video-progress-head {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--description-text);
    margin-bottom: 6px;
}

.ri-video-progress-bar {
    height: 8px;
    border-radius: 999px;
    overflow: hidden;
    background: var(--border-color);
}

.ri-video-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6 0%, #06b6d4 100%);
    transition: width 0.3s ease;
}

/* Colorful Loading Animation for Video Generation */
.ri-video-loading-animation {
    margin-top: 16px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.ri-video-loading-animation .loading-prompt {
    font-size: 14px;
    font-weight: 500;
    color: var(--message-ai-text);
    text-align: center;
    max-width: 100%;
    word-wrap: break-word;
}

.ri-video-loading-animation .loading-status {
    font-size: 12px;
    color: var(--description-text);
    text-align: center;
}

.ri-video-loading-dots {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: center;
}

.ri-video-loading-dots .dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    animation: pulse-colors 2s ease-in-out infinite;
}

.ri-video-loading-dots .dot:nth-child(1) {
    animation-delay: 0s;
    background: linear-gradient(135deg, #f472b6, #ec4899);
}

.ri-video-loading-dots .dot:nth-child(2) {
    animation-delay: 0.2s;
    background: linear-gradient(135deg, #a78bfa, #8b5cf6);
}

.ri-video-loading-dots .dot:nth-child(3) {
    animation-delay: 0.4s;
    background: linear-gradient(135deg, #60a5fa, #3b82f6);
}

.ri-video-loading-dots .dot:nth-child(4) {
    animation-delay: 0.6s;
    background: linear-gradient(135deg, #34d399, #10b981);
}

.ri-video-loading-dots .dot:nth-child(5) {
    animation-delay: 0.8s;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
}

@keyframes pulse-colors {
    0%, 100% {
        transform: scale(1);
        opacity: 0.5;
    }
    50% {
        transform: scale(1.3);
        opacity: 1;
        box-shadow: 0 0 20px currentColor;
    }
}

/* Alternative spinner animation (can be used instead of dots) */
.ri-video-loading-spinner {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: conic-gradient(
        from 0deg,
        #f472b6,
        #a78bfa,
        #60a5fa,
        #34d399,
        #fbbf24,
        #f472b6
    );
    animation: spin 1.5s linear infinite;
    position: relative;
}

.ri-video-loading-spinner::before {
    content: '';
    position: absolute;
    inset: 4px;
    border-radius: 50%;
    background: var(--message-ai-bg);
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Chat progress styles */
.ri-video-progress-chat {
    margin-top: 12px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.ri-video-progress-chat .loading-prompt {
    font-size: 13px;
    font-weight: 500;
    color: var(--message-ai-text);
    text-align: center;
}

.ri-video-progress-chat .loading-status {
    font-size: 11px;
    color: var(--description-text);
}

.ri-video-orientation-group {
    display: flex;
    gap: 8px;
}

.ri-video-orientation-btn {
    flex: 1 1 120px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--chat-input-bg);
    color: var(--message-ai-text);
    padding: 10px 14px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
}

.ri-video-orientation-btn:hover {
    border-color: var(--button-bg);
}

.ri-video-orientation-btn.active {
    background: var(--button-bg);
    color: var(--button-text);
    border-color: transparent;
    box-shadow: 0 6px 18px rgba(59, 130, 246, 0.25);
}

.ri-video-pro-toggle {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 10px;
    border: 2px solid rgba(59, 130, 246, 0.25);
    background: rgba(59, 130, 246, 0.08);
    transition: all 0.25s ease;
}

.ri-video-pro-toggle.is-active {
    border-color: rgba(59, 130, 246, 0.55);
    background: rgba(59, 130, 246, 0.15);
    box-shadow: 0 10px 30px rgba(59, 130, 246, 0.25);
}

.ri-video-pro-input {
    display: block;
    width: 20px;
    height: 20px;
    appearance: none;
    background: var(--chat-input-bg);
    border: 2px solid var(--border-color);
    border-radius: 4px;
    position: relative;
    cursor: pointer;
    outline: none;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.ri-video-pro-input::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 6px;
    width: 6px;
    height: 10px;
    border: solid var(--button-text);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.ri-video-pro-input:checked {
    background: var(--button-bg);
    border-color: var(--button-bg);
}

.ri-video-pro-input:checked::after {
    opacity: 1;
}

.ri-video-pro-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
}

.ri-pro-title {
    font-weight: 700;
    color: var(--message-ai-text);
}

.ri-pro-description {
    font-size: 12px;
    opacity: 0.85;
    color: var(--message-ai-text);
}

.ri-luma-mode-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0 4px;
}

.luma-mode-btn {
    flex: 1 1 140px;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--chat-input-bg);
    color: var(--message-ai-text);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.luma-mode-btn:hover {
    border-color: var(--button-bg);
}

.luma-mode-btn.active {
    background: var(--button-bg);
    color: var(--button-text);
    border-color: transparent;
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.25);
}

.ri-luma-upload-card {
    border: 1px dashed var(--border-color);
    border-radius: 10px;
    padding: 14px;
    background: rgba(255, 255, 255, 0.02);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#luma-image-inputs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

#luma-image-inputs [hidden] {
    display: none !important;
}

.ri-luma-conditional[hidden] {
    display: none !important;
}

.ri-luma-upload-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
}

.ri-btn-secondary {
    border: 1px solid var(--border-color);
    background: var(--chat-input-bg);
    color: var(--message-ai-text);
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.ri-btn-secondary:hover {
    border-color: var(--button-bg);
}

.ri-btn-link {
    background: none;
    border: none;
    color: var(--button-bg);
    cursor: pointer;
    font-size: 12px;
    text-decoration: underline;
    padding: 0;
}

.ri-luma-upload-preview {
    min-height: 120px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.ri-luma-upload-preview img {
    max-width: 100%;
    max-height: 160px;
    border-radius: 8px;
}

.ri-luma-selection-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.ri-luma-selection-summary {
    margin-top: 10px;
}

.ri-luma-selection-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(15, 118, 110, 0.2);
    border-radius: 10px;
    border: 1px solid rgba(34, 197, 94, 0.25);
    color: var(--message-ai-text);
}

.ri-luma-selection-pill img {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 8px;
}

.ri-tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.ri-tag {
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.15);
    color: var(--button-text);
    font-size: 12px;
    font-weight: 600;
}

.ri-luma-selection-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.ri-luma-selection-card {
    padding: 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ri-luma-selection-card span {
    font-weight: 600;
}

.ri-luma-selection-card .ri-luma-selection-summary {
    margin-top: 0;
}

.ri-luma-selection-summary .ri-luma-selection-pill {
    background: rgba(59, 130, 246, 0.18);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.ri-video-without-audio .ri-video-field textarea {
    min-height: 120px;
}

.ri-video-without-audio .ri-video-footer {
    margin-top: 16px;
}

@media (max-width: 768px) {
    .ri-video-modal {
        padding: 18px;
    }

    .ri-video-orientation-group {
        flex-direction: column;
    }

    .ri-video-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .ri-video-pricing {
        width: 100%;
        justify-content: center;
    }
}

/* Compatibility: Ensure video overlay works with unified classes */
.ri-video-overlay.ri-unified-modal-overlay {
    /* Inherits all unified modal overlay styles */
}

.ri-video-modal.ri-unified-modal {
    /* Inherits all unified modal styles */
    padding: 0; /* Reset padding since body handles it */
}

.ri-video-modal-header.ri-unified-modal-header {
    /* Inherits unified header styles */
}

.ri-video-close-btn.ri-unified-modal-close {
    /* Inherits unified close button styles */
}

/* Video Tab Navigation */
.video-tab-navigation {
    display: flex;
    gap: 2px;
    background: var(--message-ai-bg);
    padding: 4px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.video-tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--message-ai-text);
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 14px;
}

.video-tab-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.video-tab-btn.active {
    background: var(--button-bg);
    color: var(--button-text);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.video-tab-btn svg {
    width: 16px;
    height: 16px;
}

/* Disabled tabs */
.video-tab-btn.is-disabled,
.video-tab-btn[disabled],
.video-tab-btn[aria-disabled="true"] {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(1);
    pointer-events: none;
}

/* Tab Content */
.video-tab-content {
    display: none;
}

.video-tab-content.active {
    display: block;
}

/* Info Box */
.info-box {
    background: var(--info-bg);
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 16px;
    border-left: 3px solid var(--button-bg);
}

.info-box strong {
    display: block;
    margin-bottom: 4px;
    color: var(--message-ai-text);
}

.info-box p {
    margin: 0;
    font-size: 13px;
    color: var(--description-text);
}

/* Multi-Image Upload Grid */
.image-upload-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.image-slot {
    position: relative;
}

.image-slot label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 13px;
    color: var(--message-ai-text);
}

.image-slot input[type="file"] {
    display: none;
}

.image-slot .upload-button {
    width: 100%;
    aspect-ratio: 1;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    background: var(--message-ai-bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.image-slot .upload-button:hover {
    border-color: var(--button-bg);
    background: rgba(255, 255, 255, 0.05);
}

.image-slot .upload-button svg {
    width: 24px;
    height: 24px;
    margin-bottom: 4px;
    color: var(--description-text);
}

.image-slot .upload-button span {
    font-size: 12px;
    color: var(--description-text);
}

.image-slot .preview {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 8px;
    overflow: hidden;
    z-index: 2;
}

.image-slot .preview.active {
    display: block;
}

.image-slot .preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-slot .remove-image {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    transition: background 0.3s ease;
}

.image-slot .remove-image:hover {
    background: rgba(255, 0, 0, 0.8);
}

/* Premium Feature Info Box */
.premium-info-box {
    background: var(--info-bg);
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 16px;
    border-left: 3px solid var(--button-bg);
}

.premium-info-box strong {
    display: block;
    margin-bottom: 4px;
    color: var(--message-ai-text);
}

.premium-info-box p {
    margin: 0;
    font-size: 13px;
    color: var(--description-text);
}

/* Video Selection */
.video-selection-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--message-ai-bg);
    border-radius: 6px;
    border: 1px solid var(--border-color);
    margin-top: 8px;
}

.video-selection-preview.hidden {
    display: none;
}

.video-thumbnail {
    width: 60px;
    height: 60px;
    border-radius: 4px;
    overflow: hidden;
    background: #333;
}

.video-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-info {
    flex: 1;
}

.video-title {
    font-weight: 500;
    color: var(--message-ai-text);
    margin-bottom: 4px;
}

.video-meta {
    font-size: 12px;
    color: var(--description-text);
}

/* Provider Badge in Gallery */
.provider-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

.provider-badge.sora {
    background: linear-gradient(135deg, #0ea5e9 0%, #3b82f6 100%);
}

.provider-badge.veo {
    background: linear-gradient(135deg, #8b5cf6 0%, #d946ef 100%);
}

.provider-badge.legacy {
    background: rgba(107, 114, 128, 0.8);
}

/* Model Selector Enhancement */
.model-selector {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.model-option {
    flex: 1;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    background: var(--message-ai-bg);
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.model-option:hover {
    border-color: var(--button-bg);
    background: rgba(255, 255, 255, 0.05);
}

.model-option.selected {
    border-color: var(--button-bg);
    background: var(--button-bg);
    color: var(--button-text);
}

.model-option .model-name {
    font-weight: 600;
    margin-bottom: 4px;
}

.model-option .model-cost {
    font-size: 12px;
    opacity: 0.8;
}

/* Footer Buttons */
.custom-music-footer .footer-buttons {
    display: flex;
    gap: 12px;
    align-items: center;
}

.custom-music-cancel,
.custom-music-generate {
    padding: 12px 24px;
    border-radius: 6px;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 100px;
}

.custom-music-cancel {
    background: var(--button-bg);
    color: var(--button-text);
    border: 1px solid var(--button-bg);
}

.custom-music-cancel:hover {
    background: var(--button-hover);
}

.custom-music-generate {
    background: var(--button-bg);
    color: var(--button-text);
    border: 1px solid var(--button-bg);
}

.custom-music-generate:hover {
    background: var(--button-hover);
}

/* Responsive */
@media (max-width: 768px) {
    .image-upload-grid {
        grid-template-columns: 1fr;
    }
    
    .model-selector {
        flex-direction: column;
    }
}

