/* Импортируем систему переменных */
@import url('_variables.css');
@import url('_gradients.css');
@import url('_components.css');
@import url('performance-optimizations.css');

html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background: var(--gray-gradient-hero);  
    min-height: 100vh;
    color: #fff;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    box-sizing: border-box;
}

/* Оранжевые кнопки для генерации и скачивания - как у aspect-btn.active */
.btn-orange-action {
    border-color: var(--vm-primary-orange);
    background: var(--vm-primary-orange);
    color: var(--vm-text-primary);
    box-shadow: var(--vm-shadow-glow-orange);
    font-weight: var(--vm-font-weight-semibold);
    padding: var(--vm-button-padding-y) var(--vm-button-padding-x);
    /* Оптимизация производительности */
    min-height: 44px;
    transform: translateZ(0);
    will-change: transform, opacity, background-color;
    backface-visibility: hidden;
    contain: layout style paint;
    transition: background-color 0.15s ease,
                border-color 0.15s ease,
                box-shadow 0.15s ease,
                transform 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-orange-action:hover:not(:disabled) {
    background: #ff5722;
    border-color: #ff5722;
    color: var(--vm-text-primary);
    box-shadow: 0 0 20px rgba(255, 107, 53, 0.6);
    transform: translate3d(0, -2px, 0);
}

.btn-orange-action:active:not(:disabled) {
    transform: translate3d(0, 0, 0);
    transition-duration: 0.05s;
}

.btn-orange-action:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: translateZ(0);
    transition: opacity 0.15s ease;
}

@keyframes spin {
    0% { transform: rotate3d(0, 0, 1, 0deg); }
    100% { transform: rotate3d(0, 0, 1, 360deg); }
}

.rotating {
    animation: spin 2s linear infinite;
    transform-origin: center center;
    will-change: transform;
    backface-visibility: hidden;
}

.table {
    --bs-table-bg: var(--bg-secondary);  
    --bs-table-color: var(--text-primary);
}

.card {
    background-color: var(--bg-card);  
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.worker-card {
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), 
                box-shadow 0.2s ease;
    will-change: transform;
    transform: translateZ(0);
}

.worker-card:hover {
    transform: translate3d(0, -5px, 0);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

a .worker-card {
    color: inherit;
}

a:hover .worker-card {
    color: inherit;
}

.modal-content {
    background-color: var(--bg-card);  
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-close {
    filter: invert(1);
}

/* Кнопка neon-green теперь использует .vm-button-glossy */
.btn-neon-green {
    color: var(--text-primary);
    padding: 0.5rem 1.5rem;
    font-weight: 600;
    position: relative;
    overflow: hidden;
}

/* Hover эффект наследуется от .vm-button-glossy:hover */

.btn-neon-green:active {
    transform: translate3d(0, 0, 0);
    transition-duration: 0.05s;
    box-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* Кнопка generate теперь использует .vm-button-glossy */
.btn-generate {
    color: var(--text-primary);
    padding: 0.75rem 2rem;
    font-weight: 600;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    justify-content: center;
}

/* Hover эффект наследуется от .vm-button-glossy:hover */
.btn-generate:hover:not(:disabled) {
    border-color: var(--gray-glossy-border);
    transform: translate3d(0, -2px, 0);
}

.btn-generate:active:not(:disabled) {
    transform: translate3d(0, 0, 0);
    transition-duration: 0.05s;
}

.btn-generate:disabled {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border-color: var(--gray-separator);
    cursor: not-allowed;
    opacity: 0.6;
    transform: translateZ(0);
    box-shadow: none;
    transition: opacity 0.15s ease;
}

.btn-finish-gray {
    background: var(--gray-danger);
    color: var(--text-primary);
    border: 1px solid var(--gray-danger);
    padding: 0.5rem 1.5rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--vm-transition);
    box-shadow: 
        0 4px 8px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-finish-gray:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    transform: translate3d(0, -2px, 0);
    box-shadow: 
        0 6px 12px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.btn-finish-gray:active {
    transform: translate3d(0, 0, 0);
    transition-duration: 0.05s;
}

.processing-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px;
    gap: 24px;
}

.processing-animation {
    position: relative;
    width: 80px;
    height: 80px;
}

.processing-card h4 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin: 0;
}

.processing-card p {
    color: var(--text-secondary);
    margin: 0;
    max-width: 400px;
    text-align: center;
}

.storyboard-page-layout {
    display: flex;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 80px;    width: calc(100vw - 80px);
    overflow: hidden;
    z-index: 1;
}

.storyboard-page-layout:has(+ .selected-images-bar) {
    padding-bottom: 144px;
}

.storyboard-dashboard {
    width: var(--storyboard-dashboard-width);
    min-width: 420px;
    max-width: 700px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    position: fixed;
    left: 80px; 
    top: 0;
    bottom: 0;
    transition: width 0.3s ease, transform 0.3s ease;
    z-index: 5;
}


.storyboard-dashboard.collapsed {
    width: var(--storyboard-dashboard-width);
    transform: translateX(calc(var(--storyboard-dashboard-width) * -1));
}

.storyboard-dashboard.collapsed .dashboard-content {
    opacity: 0;
    visibility: hidden;
}

.storyboard-dashboard-wrapper {
    width: var(--storyboard-dashboard-width);
    min-width: 420px;
    max-width: 700px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    position: fixed;
    left: 80px; 
    top: 0;
    bottom: 0;
    transition: width 0.3s ease, transform 0.3s ease;
    z-index: 5;
}

.storyboard-dashboard-wrapper.collapsed {
    width: var(--storyboard-dashboard-width);
    transform: translateX(calc(var(--storyboard-dashboard-width) * -1));
}

.storyboard-dashboard-wrapper.collapsed .dashboard-toggle {
    position: fixed;
    top: 20px;
    left: 20px;
    right: auto;
    transform: translateX(var(--storyboard-dashboard-width));
    z-index: 10;
}



.dashboard-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: var(--bg-secondary);
    border: 2px solid var(--nav-icon-color);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease, border-color 0.3s ease, opacity 0.3s ease, transform 0.3s ease, left 0.3s ease, position 0.3s ease;
    z-index: 6;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    color: #ffffff;
    font-weight: 500;
    overflow: hidden;
}



.dashboard-toggle:hover {
    background: var(--bg-primary);
    border-color: hsl(17, 100%, 64%);
    box-shadow: 0 4px 16px hsla(17, 100%, 74%, 0.25);
    transform: translateY(-1px);
}


.dashboard-toggle:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}


.storyboard-dashboard.collapsed .dashboard-toggle {
    position: fixed;
    top: 20px;
    left: 20px;
    right: auto;
    transform: translateX(var(--storyboard-dashboard-width));
    z-index: 10;
}



@supports not selector(:has(*)) {
    .dashboard-toggle {
        position: absolute;
        top: 20px;
        right: 20px;
    }
    
    body[data-dashboard-collapsed="true"] .dashboard-toggle {
        position: fixed;
        top: 20px;
        left: 20px;
        right: auto;
        transform: translateX(350px);
        z-index: 10;
    }
    
    
    
    body[data-dashboard-collapsed="true"] .storyboard-workspace {
        left: 80px;
    }
}

.dashboard-content {
    padding: 24px;
    width: 100%;
    overflow-y: auto;
}

.dashboard-resizer {
    position: absolute;
    right: -4px;
    top: 0;
    bottom: 0;
    width: 8px;
    cursor: col-resize;
    z-index: 10;
    background: transparent;
    transition: background 0.2s ease;
}

.dashboard-resizer:hover {
    background: var(--accent-primary);
    opacity: 0.5;
}

.dashboard-resizer.resizing {
    background: var(--accent-primary);
    opacity: 0.8;
}

.dashboard-resizer::before {
    content: '';
    position: absolute;
    left: 3px;
    right: 3px;
    top: 50%;
    height: 30px;
    transform: translateY(-50%);
    background: repeating-linear-gradient(
        0deg,
        var(--border-color),
        var(--border-color) 2px,
        transparent 2px,
        transparent 6px
    );
    opacity: 0;
    transition: opacity 0.2s ease;
}

.dashboard-resizer:hover::before {
    opacity: 1;
}

.storyboard-dashboard .form-control {
    background-color: var(--bg-secondary);
    color: #fff;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    transition: border-color 0.3s ease;
}

.storyboard-dashboard .form-control:hover {
    border-color: #ff6b35;
}

.storyboard-dashboard .form-control:focus {
    background-color: var(--bg-secondary);
    color: #fff;
    border-color: #ff6b35;
    box-shadow: none;
    outline: none;
}

.storyboard-dashboard .form-control::placeholder {
    color: var(--text-tertiary);
    opacity: 0.7;
}

.storyboard-dashboard .form-control:disabled {
    background-color: var(--bg-tertiary);
    opacity: 0.6;
    cursor: not-allowed;
}

/* .btn-primary в storyboard-dashboard использует .vm-button-glossy */
.storyboard-dashboard .btn-primary {
    color: var(--text-primary);
}

/* Hover эффект наследуется от .vm-button-glossy:hover */
.storyboard-dashboard .btn-primary:hover:not(:disabled) {
    border-color: var(--gray-glossy-border);
}

.storyboard-dashboard .btn-secondary {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--gray-separator);
    transition: var(--vm-transition);
}

.storyboard-dashboard .btn-secondary:hover {
    background-color: var(--bg-hover);
    border-color: var(--gray-separator);
    transform: translateY(-1px);
}

.dashboard-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 24px;
    color: var(--text-primary);
}

.scenario-textarea {
    min-height: 400px;
    resize: vertical;
}

.dashboard-actions {
    margin-top: 24px;
}

.storyboard-workspace {
    position: fixed;
    left: calc(80px + var(--storyboard-dashboard-width)); 
    right: 0;
    top: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-primary);
    transition: left 0.3s ease;
}

.storyboard-workspace-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    padding-bottom: 0;
}

.storyboard-workspace .history-section {
    flex-shrink: 0;
    height: 300px;
    overflow-y: auto; 
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.storyboard-page-layout:has(.storyboard-dashboard.collapsed) .storyboard-workspace {
    left: 80px;
}

.storyboard-page-layout:has(.storyboard-dashboard-wrapper.collapsed) .storyboard-workspace {
    left: 80px;
}

.full-scenario-section {
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--border-color);
    transition: all 0.3s ease;
}

.full-scenario-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px; 
    cursor: pointer;
    user-select: none;
}

.full-scenario-header:hover {
    background: var(--bg-hover);
}

.full-scenario-title {
    font-size: 1.1rem; 
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px; 
}


.download-button-text {
    margin-left: 4px;
    font-weight: 500;
}

.download-button-count {
    margin-left: 4px;
    font-size: 12px;
    opacity: 0.8;
    font-weight: 400;
}

.download-button.disabled .download-button-text,
.download-button.disabled .download-button-count {
    opacity: 0.6;
}

.download-button.enabled:hover .download-button-count,
.btn-primary.download-button:hover:not(:disabled) .download-button-count {
    opacity: 1;
    transform: scale(1.05);
}

.download-button.enabled:hover,
.btn-primary.download-button:hover:not(:disabled) {
    
}

.download-button:hover .vm-icon {
    transform: none;
}

.download-button {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 768px) {
    .download-button {
        width: 100%;
        justify-content: center;
        font-size: 14px;
        padding: 12px 16px;
        max-width: 300px;
    }
    
    .scenes-horizontal-scroll {
        padding: 16px;
        margin-bottom: 20px;
    }
}

@media (max-width: 1024px) and (min-width: 769px) {
    .download-button {
        font-size: 13px;
        padding: 10px 14px;
    }
    
    .scenes-horizontal-scroll {
        padding: 20px;
        margin-bottom: 16px;
    }

    .storyboard-workspace-content {
        padding: 18px;
    }
    
    .storyboard-workspace .history-section {
        height: 280px; 
    }
}

.download-button.loading .download-button-text::after {
    content: '...';
    animation: loading-dots 1.5s infinite;
    display: inline-block;
    width: 20px;
    text-align: left;
}

@keyframes loading-dots {
    0%, 20% { content: ''; }
    40% { content: '.'; }
    60% { content: '..'; }
    80%, 100% { content: '...'; }
}

@media (prefers-contrast: high) {
    .download-button.enabled {
        border: 2px solid currentColor;
    }
    
    .download-button.disabled {
        border: 2px solid #666;
    }
}

.download-button.enabled:active {
    transform: translateY(-1px) scale(1.08);
}

.download-button:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

.full-scenario-content {
    max-height: 150px; 
    overflow-y: auto;
    padding: 0 20px 16px; 
    transition: all 0.3s ease;
}

.full-scenario-section.collapsed .full-scenario-content {
    max-height: 0;
    padding-bottom: 0;
    overflow: hidden;
}

.full-scenario-section:not(.collapsed) .full-scenario-content {
    min-height: 80px;
}

.full-scenario-text {
    white-space: pre-wrap;
    line-height: 1.6;
    color: var(--text-secondary);
    padding-top: 8px;
    font-size: 0.95rem;
}

.full-scenario-content::-webkit-scrollbar {
    width: 8px;
}

.full-scenario-content::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

.full-scenario-content::-webkit-scrollbar-thumb {
    background: var(--gray-glossy);
    border-radius: 4px;
    opacity: 0.6;
}

.full-scenario-content::-webkit-scrollbar-thumb:hover {
    background: var(--gray-glossy-hover);
    opacity: 1;
}

.scenes-horizontal-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    padding: 24px 24px 24px 24px;
    margin-bottom: 24px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    scroll-behavior: smooth;
    position: relative;
    white-space: nowrap;

    background: 
        linear-gradient(to right, var(--bg-primary) 0%, transparent 50px),
        linear-gradient(to left, var(--bg-primary) 0%, transparent 50px);
    background-position: left center, right center;
    background-repeat: no-repeat;
    background-size: 50px 100%, 50px 100%;
    background-attachment: local, local;
}

.scenes-horizontal-scroll::-webkit-scrollbar {
    height: 6px;
}

.scenes-horizontal-scroll::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 3px;
    margin: 0 8px;
}

.scenes-horizontal-scroll::-webkit-scrollbar-thumb {
    background: var(--gray-glossy);
    border-radius: 3px;
    opacity: 0.7;
}

.scenes-horizontal-scroll::-webkit-scrollbar-thumb:hover {
    background: var(--gray-glossy-hover);
    opacity: 1;
}

.scene-card-new {
    flex: 0 0 360px;
    width: 360px;
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.scene-card-new:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.scene-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px; 
}

.scene-title {
    font-size: 1.1rem; 
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px; 
}

.scene-duration {
    color: var(--text-secondary);
    font-size: 0.9rem; 
}

.scene-text-container {
    min-height: 60px;
    max-height: 120px;
    overflow-y: auto;
    margin-bottom: 12px;
    padding: 10px;
    background: var(--bg-primary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    cursor: grab;
    user-select: none;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    touch-action: pan-y;
}

.scene-text-container:active {
    cursor: grabbing;
}

.scene-text-container.active {
    cursor: grabbing;
    user-select: none;
}

@media (hover: none) and (pointer: coarse) {
    .scene-text-container {
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: y proximity;
    }
}

.scene-text {
    margin: 0;
    line-height: 1.5;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.scene-text-container::-webkit-scrollbar {
    width: 6px;
}

.scene-text-container::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 3px;
}

.scene-text-container::-webkit-scrollbar-thumb {
    background: var(--gray-glossy);
    border-radius: 3px;
    opacity: 0.6;
}

.scene-text-container::-webkit-scrollbar-thumb:hover {
    background: var(--gray-glossy-hover);
    opacity: 1;
}

.scene-images-section {
    display: flex;
    flex-direction: column;
    gap: 12px; 
    margin-bottom: 12px;
}

.scene-images-grid {
    display: flex;
    gap: 8px;
    width: 100%;
    overflow-x: auto;
    padding-bottom: 8px;
    cursor: grab;
    user-select: none;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    touch-action: pan-x;
}

.scene-images-grid:active {
    cursor: grabbing;
}

.scene-images-grid.active {
    cursor: grabbing;
    user-select: none;
}

@media (hover: none) and (pointer: coarse) {
    .scene-images-grid {
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x proximity;
    }
    
    .scene-image-item,
    .scene-image-add {
        scroll-snap-align: start;
    }
}

.scene-images-grid::-webkit-scrollbar {
    height: 6px;
}

.scene-images-grid::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 3px;
}

.scene-images-grid::-webkit-scrollbar-thumb {
    background: var(--gray-glossy);
    border-radius: 3px;
    opacity: 0.6;
}

.scene-images-grid::-webkit-scrollbar-thumb:hover {
    background: var(--gray-glossy-hover);
    opacity: 1;
}

.scene-image-item {
    position: relative;
    width: 80px;
    height: 80px;
    background: var(--bg-primary);
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    flex-shrink: 0;
}

.scene-image-add {
    position: relative;
    width: 80px;
    height: 80px;
    background: var(--bg-primary);
    border: 2px dashed var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
}

.scene-image-add:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background: rgba(107, 70, 193, 0.05);
}

.scene-image-add i {
    font-size: 1.5rem;
}

.modal-content {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.modal-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    border-radius: 12px 12px 0 0;
}

.modal-title {
    color: var(--text-primary);
    font-weight: 600;
}

.modal-body {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.modal-footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    border-radius: 0 0 12px 12px;
}

.modal .form-label {
    color: var(--text-primary);
    font-weight: 500;
}

.modal .form-control,
.modal .form-select {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}


.modal .btn-close {
    color: var(--text-secondary);
    opacity: 0.8;
}

.modal .btn-close:hover {
    color: var(--text-primary);
    opacity: 1;
}

.scene-image-item:hover {
    transform: scale(1.02); 
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.scene-image-item.selected {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(var(--accent-primary-rgb), 0.3); 
}

.scene-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-model-badge {
    position: absolute;
    top: 4px;
    left: 4px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 2px 4px; 
    border-radius: 3px;
    font-size: 0.6rem; 
    font-weight: 600;
    z-index: 1;
    line-height: 1.2;
}

.image-generating,
.image-failed,
.image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    /* Оптимизация для предотвращения мерцания */
    contain: layout style paint;
    will-change: opacity;
    backface-visibility: hidden;
}

.image-generating .spinner-border {
    width: 20px;
    height: 20px;
    border-width: 2px;
    /* GPU ускорение для анимации */
    transform: translateZ(0);
    will-change: transform;
}

.image-generating .bi-arrow-repeat {
    font-size: 1.2rem;
    /* Оптимизация анимации вращения */
    animation: spin-optimized 2s linear infinite;
    transform-origin: center center;
}

.image-generating {
    gap: 4px;
    font-size: 0.7rem;
}

.image-failed {
    color: var(--gray-glossy);
    font-size: 0.7rem;
}

.image-placeholder {
    color: var(--text-tertiary);
    font-size: 1.5rem;
}

.scene-prompts-section {
    margin-top: 12px; 
}

.prompts-toggle-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--gray-separator);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px; 
    padding: 8px 12px; 
    border-radius: 6px;
    transition: var(--vm-transition);
    width: 100%;
    text-align: left;
    font-size: 0.9rem; 
}

.prompts-toggle-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--gray-separator);
    transform: translateY(-1px);
}

.prompts-content {
    overflow: hidden;
    transition: all 0.3s ease;
}

.prompts-content.collapsed {
    max-height: 0;
}

.prompts-content.expanded {
    max-height: 300px; 
    margin-top: 12px; 
    overflow-y: auto;
}

.prompts-content::-webkit-scrollbar {
    width: 6px;
}

.prompts-content::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 3px;
}

.prompts-content::-webkit-scrollbar-thumb {
    background: var(--gray-glossy);
    border-radius: 3px;
    opacity: 0.6;
}

.prompts-content::-webkit-scrollbar-thumb:hover {
    background: var(--gray-glossy-hover);
    opacity: 1;
}

.prompt-item {
    padding: 12px; 
    background: var(--bg-primary);
    border-radius: 6px;
    margin-bottom: 8px;
    max-height: 120px; 
    overflow-y: auto; 
}

.prompt-item label {
    font-weight: 600;
    color: var(--text-primary);
    display: block;
    margin-bottom: 4px;
    font-size: 0.95rem; 
}

.prompt-item p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem; 
    line-height: 1.4;
}

.prompt-item::-webkit-scrollbar {
    width: 4px;
}

.prompt-item::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 2px;
}

.prompt-item::-webkit-scrollbar-thumb {
    background: var(--gray-glossy);
    border-radius: 2px;
    opacity: 0.6;
}

.prompt-item::-webkit-scrollbar-thumb:hover {
    background: var(--gray-glossy-hover);
    opacity: 1;
}

.settings-title {
    font-size: 0.9rem; 
    margin-bottom: 12px; 
    color: var(--text-primary);
}

.settings-controls {
    display: flex;
    flex-direction: column;
    gap: 10px; 
}

.setting-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.video-generation-progress {
    text-align: center;
}

.preview-container {
    width: 100%;
    max-width: 180px; 
    margin: 0 auto 16px; 
    border-radius: 8px;
    overflow: hidden;
}

.preview-video {
    width: 100%;
    height: auto;
}

.progress-info {
    margin-bottom: 8px;
}

.progress-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 4px;
    display: block;
}

.selected-images-bar.expanded {
    height: auto; 
    max-height: 70vh; 
    transform: translateY(0); 
}

.prompt-edit-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: flex-start; 
    justify-content: center;
    z-index: 10000; 
    padding: 60px 20px 120px; 
    overflow-y: auto; 
    box-sizing: border-box;
}

.prompt-edit-content {
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 24px;
    max-width: 600px;
    width: 100%;
    max-height: calc(100vh - 200px); 
    margin-top: 20px; 
    margin-bottom: 20px; 
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4); 
    box-sizing: border-box;
    z-index: 10001; 
}

.prompt-edit-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.prompt-edit-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.btn-close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s ease;
}

.btn-close-modal:hover {
    color: var(--text-primary);
}

.prompt-edit-image {
    width: 100%;
    max-height: 300px;
    object-fit: contain;
    border-radius: 8px;
    margin-bottom: 20px;
}

.prompt-textarea {
    width: 100%;
    min-height: 150px;
    resize: vertical;
    background-color: var(--bg-secondary);
    color: #fff;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.prompt-textarea:focus {
    background-color: var(--bg-secondary);
    color: #fff;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 0.25rem rgba(99, 102, 241, 0.25);
    outline: none;
}

@media (max-width: 768px) {
    .storyboard-page-layout {
        flex-direction: column;
        margin-top: 80px;
        width: 100%;
        overflow-y: auto;
        position: relative;
        left: 0px;
        height: auto;
    }

    .storyboard-workspace {
        position: relative;
        left: 0;
        top: 0;
        width: 100%;
        overflow-y: auto;
    }
    
    .storyboard-workspace-content {
        padding: 15px; 
    }
    
    .storyboard-workspace .history-section {
        height: 250px; 
    }

    .storyboard-dashboard {
        width: 100% !important;
        position: relative;
        height: auto;
        max-height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        left: 0px;
    }
    
    .storyboard-dashboard.collapsed {
        width: 0;
        height: auto;
    }

    .storyboard-dashboard-wrapper {
        width: 100% !important;
        position: relative;
        height: auto;
        max-height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        left: 0px;
    }
    
    .storyboard-dashboard-wrapper.collapsed {
        width: 0;
        height: auto;
    }
    
    .dashboard-toggle {
        position: fixed;
        left: auto;
        right: 10px;
        top: auto;
        bottom: 210px; 
        width: 35px;
        height: 35px;
        background: var(--bg-secondary);
        border: 2px solid var(--nav-icon-color);
        border-radius: 50%;
        transform: none;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
        color: #ffffff;
        font-weight: 500;
        overflow: hidden;
    }
    
    
    
    .dashboard-toggle:hover {
        background: var(--bg-primary);
        border-color: hsl(17, 100%, 64%);
        box-shadow: 0 4px 16px hsla(17, 100%, 74%, 0.25);
        transform: scale(1.05);
    }
    
    
    .dashboard-toggle:active {
        transform: scale(1);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    }
    
    .storyboard-dashboard.collapsed .dashboard-toggle {
        left: auto;
        right: 10px;
    }
    
    

    .storyboard-dashboard-wrapper.collapsed .dashboard-toggle {
        left: auto;
        right: 10px;
    }
    
    
    
    .scenes-horizontal-scroll {
        padding: 20px; 
    }
    
    .scene-card-new {
        flex: 0 0 360px; 
        width: 360px;
    }

    .selected-images-section {
        margin-top: 20px;
        padding: 15px;
    }

    .prompt-edit-modal {
        padding: 20px 10px 80px; 
        align-items: flex-start;
    }
    
    .prompt-edit-content {
        max-height: calc(100vh - 160px); 
        padding: 16px; 
    }
}

.status-queued {
    color: var(--accent-primary);
}

.status-running {
    color: #f59e0b;
}

.status-finished {
    color: var(--success);
}

.status-failed {
    color: var(--gray-glossy);
}

.status-cancelled {
    color: var(--text-secondary);
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: var(--text-secondary);
    padding: 40px;
}

.empty-state-icon {
    font-size: 4rem;
    color: var(--text-tertiary);
    margin-bottom: 24px;
}

.empty-state h3 {
    color: var(--text-primary);
    font-size: 1.5rem;
    margin-bottom: 12px;
}

.empty-state p {
    font-size: 1rem;
    margin-bottom: 8px;
}

.empty-state-hint {
    font-size: 0.9rem;
    color: var(--text-tertiary);
    margin-top: 24px;
}

.gallery-examples-container {
    margin-top: 40px;
    width: 1000px;
    height: 800px;
    min-width: 1000px;
    min-height: 800px;
    max-width: 1000px;
    max-height: 800px;
    background: var(--bg-secondary);
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.gallery-examples-container .media-gallery-container {
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.gallery-examples-container .media-gallery {
    height: 100%;
    overflow: hidden;
    padding: 0px;
}

.gallery-examples-container .media-gallery {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 15px;
    height: calc(100% - 40px);
    overflow: hidden;
    align-content: start;
    padding: 20px;
    grid-auto-flow: row;
}

.gallery-examples-container .gallery-item {
    height: 100%;
    overflow: hidden;
    border-radius: 8px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-card);
    min-height: 200px;
}

.gallery-examples-container .gallery-item[data-aspect="landscape16x9"] {
    grid-column: span 1;
    grid-row: span 1;
}

.gallery-examples-container .gallery-item[data-aspect="portrait9x16"] {
    grid-column: span 1;
    grid-row: span 1;
}

.gallery-examples-container .gallery-item[data-aspect="square"] {
    grid-column: span 1;
    grid-row: span 1;
}

.gallery-examples-container .gallery-item[data-aspect="landscape16x9"] .media-type-badge,
.gallery-examples-container .gallery-item[data-aspect="portrait9x16"] .media-type-badge,
.gallery-examples-container .gallery-item[data-aspect="square"] .media-type-badge {
    display: none;
}

.gallery-examples-container .media-card {
    height: 100%;
    width: 100%;
    overflow: hidden;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.2s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-examples-container .media-card:hover {
    transform: scale(1.02);
}

.gallery-examples-container .media-content {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 6px;
    display: block;
}

.gallery-examples-container .media-content-wrapper {
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 6px;
}

.gallery-examples-container .gallery-filters {
    display: none;
}

.gallery-examples-container .gallery-header {
    display: none;
}

.gallery-examples-container .gallery-title {
    display: none;
}

.gallery-examples-container .infinite-scroll-loader {
    display: none;
}

.gallery-examples-container .gallery-actions {
    display: none;
}

.gallery-examples-container .media-info,
.gallery-examples-container .media-overlay,
.gallery-examples-container .play-indicator,
.gallery-examples-container .video-duration,
.gallery-examples-container .media-type-badge,
.gallery-examples-container .video-play-hint {
    display: none;
}

.carousel-3d-container {
    margin-top: 40px;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 500px;
    position: relative;
    overflow: visible;
}

.carousel-3d {
    position: relative;
    width: 300px;
    height: 200px;
    transform-style: preserve-3d;
    animation: rotate-carousel 35s linear infinite;
}

@keyframes rotate-carousel {
    from {
        transform: perspective(1200px) rotateY(0deg);
    }
    to {
        transform: perspective(1200px) rotateY(360deg);
    }
}

.carousel-3d .carousel-item {
    position: absolute;
    width: 100%;
    height: 100%;
    transform-origin: center;
    transform-style: preserve-3d;
    transform: rotateY(calc(var(--i) * 45deg)) translateZ(380px);
}

.carousel-3d .carousel-item img {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.carousel-3d .carousel-item img:hover {
    box-shadow: 0 12px 32px rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}


@media (max-width: 768px) {
    .carousel-3d-container {
        height: 400px;
    }
    
    .carousel-3d {
        width: 240px;
        height: 160px;
    }
    
    .carousel-3d .carousel-item {
        transform: rotateY(calc(var(--i) * 45deg)) translateZ(280px);
    }
}

@media (max-width: 480px) {
    .carousel-3d-container {
        height: 350px;
    }
    
    .carousel-3d {
        width: 200px;
        height: 133px;
    }
    
    .carousel-3d .carousel-item {
        transform: rotateY(calc(var(--i) * 45deg)) translateZ(220px);
    }
}

.storyboard-history {
    padding: 20px;
    height: 100%;
    overflow-y: auto;
}

.history-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
}

.storyboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
}

@media (min-width: 1200px) {
    .storyboard-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }
}

@media (min-width: 1600px) {
    .storyboard-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
}

@media (min-width: 2000px) {
    .storyboard-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

@media (min-width: 2400px) {
    .storyboard-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }
}

.storyboard-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.storyboard-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    border-color: var(--accent-primary);
}

.storyboard-card-clickable {
    padding: 10px;
    cursor: pointer;
}

.btn-delete-storyboard {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 107, 107, 0.2);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-danger);
    opacity: 0;
    transition: all 0.3s ease;
}

.storyboard-card:hover .btn-delete-storyboard {
    opacity: 1;
}

.btn-delete-storyboard:hover {
    background: var(--gray-danger);
    color: white;
    transform: scale(1.1);
}

.storyboard-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 6px;
}

.storyboard-card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    flex: 1;
    margin-right: 10px;
}

.storyboard-status {
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.storyboard-card-body {
    margin-bottom: 8px;
}

.storyboard-scenario {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    margin: 0;
}

.storyboard-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-tertiary);
}

.storyboard-date,
.storyboard-scenes {
    display: flex;
    align-items: center;
}

.spin {
    animation: spin 1s linear infinite;
}

.scene-selected-slot {
    height: 180px;
    width: 320px;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: visible;
    margin: 0 auto;
}

.scene-selected-slot.has-image {
    border-style: solid;
    border-color: var(--accent-primary);
    background: rgba(107, 70, 193, 0.05);
}

.scene-selected-slot:hover {
    border-color: var(--accent-primary);
    background: rgba(107, 70, 193, 0.08);
}

.slot-content {
    display: flex;
    flex-direction: column;
    height: 180px;
    position: relative;
}

.slot-image-preview {
    flex: 1;
    overflow: hidden;
    position: relative;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.slot-image-preview img {
    width: 320px;
    height: 180px;
    object-fit: contain;
    background: #2a2a35;
    border-radius: 8px;
}

.slot-video-preview {
    flex: 1;
    overflow: hidden;
    position: relative;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.slot-video-preview video {
    width: 320px;
    height: 180px;
    object-fit: contain;
    background: #2a2a35;
    border-radius: 8px;
}

.video-generation-overlay {
    position: absolute;
    bottom: 8px;
    left: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 6px 8px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 500;
}

.video-generation-overlay i {
    font-size: 0.9rem;
}

.video-generation-section {
    margin-top: auto;
    padding-top: 16px;
    max-width: 100%;
    overflow: hidden;
    min-height: 72px;
}

.video-generation-controls {
    align-items: center;
    padding: 0;
}

.video-generation-controls .btn {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    padding: 8px 16px;
    min-height: 40px;
}

/* Disable unwanted focus glow on scene action buttons */
.video-generation-controls .btn:focus,
.video-generation-controls .btn:focus-visible,
.scene-card-new .scene-images-section .btn:focus,
.scene-card-new .scene-images-section .btn:focus-visible {
    outline: none;
    box-shadow: none;
}

.scene-card-new .silver-gloss:focus,
.scene-card-new .silver-gloss:focus-visible {
    outline: none !important;
    box-shadow: none !important;
    border-color: inherit;
}

.scene-card-new .btn-gray-primary:focus,
.scene-card-new .btn-gray-primary:focus-visible {
    border-color: #5a5a5a;
}

.scene-card-new .btn-outline-gray-secondary:focus,
.scene-card-new .btn-outline-gray-secondary:focus-visible {
    border-color: #7a7a7a;
}

.video-generation-controls .btn.flex-grow-1 {
    flex: 1 1 auto;
    margin-right: 6px;
}

.video-generation-controls .btn-outline-secondary.px-3 {
    min-width: 48px;
    flex: 0 0 48px;
    padding: 8px 10px;
    font-size: 0.8rem;
    background-color: #00cc00;
    border-color: #00cc00;
    color: white;
}

.video-generation-controls .btn-outline-secondary.px-3:hover {
    background-color: #009900;
    border-color: #009900;
    color: white;
}

.video-generation-controls .btn-outline-secondary.flex-grow-1 {
    padding: 8px 16px;
    font-size: 0.85rem;
    background-color: #b3d9ff;
    border-color: #87ceeb;
    color: #4a90e2;
}

.video-generation-controls .btn-outline-secondary.flex-grow-1:hover {
    background-color: #b3d9ff;
    border-color: #87ceeb;
    color: #4a90e2;
}

.video-generation-controls .btn:disabled {
    cursor: not-allowed;
    opacity: 1; 
}

.video-generation-controls .btn:disabled:hover {
    cursor: not-allowed;
}

.video-generation-controls .btn-outline-secondary.px-3.opacity-50,
.video-generation-controls .btn-outline-secondary.px-3:disabled {
    background-color: #6c757d;
    border-color: #6c757d;
    color: #ffffff;
    opacity: 1;
    cursor: not-allowed;
}

.video-generation-controls .btn-outline-secondary.flex-grow-1:disabled {
    background-color: #6c757d;
    border-color: #6c757d;
    color: #ffffff;
    cursor: not-allowed;
}

/* .btn-primary в video-generation-controls использует .vm-button-glossy */
.video-generation-controls .btn-primary {
    color: var(--text-primary);
}

/* HOME PAGE FIXED LAYOUT */

.home-page-fixed-layout {
    position: fixed;
    top: 0;
    left: 80px;    width: calc(100vw - 80px);
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    z-index: 1;
}

.home-page-fixed-layout .home-content-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.home-page-fixed-layout .home-hero-section {
    position: relative;
    width: 100%;
    height: auto;
    display: flex;
    flex-direction: column;
}

.home-page-fixed-layout .home-ai-services-section {
    position: relative;
    width: 100%;
    background: var(--bg-primary);
    padding: 0;
}

.home-page-fixed-layout .home-gallery-section {
    position: relative;
    width: 100%;
    background: var(--bg-primary);
    padding: 12px 0 40px;
}

.home-page-fixed-layout .animated-hero-background {
    height: 300px;
    padding: 40px 20px 20px;
}

@media (max-width: 768px) {
    .home-page-fixed-layout {
        left: 0;
        width: 100vw;
        margin-left: 0;
        margin-top: 80px;
    }

        .home-page-fixed-layout .animated-hero-background {
            height: auto;
        }
}

/* TEXT GENERATION FIXED LAYOUT */

.text-generation-fixed-layout {
    position: fixed;
    top: 0;
    left: 80px;    width: calc(100vw - 80px);
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    z-index: 1;
}

.text-generation-fixed-layout .text-generation-content-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

.text-generation-fixed-layout .chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

@media (max-width: 768px) {
    .text-generation-fixed-layout {
        left: 0;
        width: 100vw;
        margin-left: 0;
    }
    
    .text-generation-fixed-layout .text-generation-content-container {
        padding-left: 80px;
    }
}

@media (max-width: 576px) {
    .text-generation-fixed-layout .text-generation-content-container {
        padding-left: 60px;
    }
}

/* ARCHIVE FIXED LAYOUT */

.archive-fixed-layout {
    position: fixed;
    top: 0;
    left: 80px;    width: calc(100vw - 80px);
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    z-index: 1;
}

.archive-fixed-layout .archive-content-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    box-sizing: border-box;
}

@media (max-width: 768px) {
    .archive-fixed-layout {
        left: 0;
        width: 100vw;
        margin-left: 0;
    }
    
    .archive-fixed-layout .archive-content-container {
        padding: 20px;
        padding-left: 100px;
    }
}

@media (max-width: 576px) {
    .archive-fixed-layout .archive-content-container {
        padding: 15px;
        padding-left: 75px;
    }
}

.video-generation-controls .btn-primary:hover {
    background: var(--gray-glossy-hover);
    border-color: var(--gray-glossy-border);
    color: var(--text-primary);
    transform: translateY(-2px);
    box-shadow: 
        0 6px 12px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.4),
        inset 0 -1px 0 rgba(0, 0, 0, 0.3);
}

.video-generation-controls .btn-secondary {
    background: var(--accent-primary);
    border: 1px solid var(--accent-primary);
    color: var(--text-primary);
    transition: var(--vm-transition);
}

.video-generation-controls .btn-secondary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: var(--text-primary);
    transform: translateY(-2px);
}

.video-settings-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--accent-primary);
    border-radius: 8px;
    padding: 16px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0.95;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.settings-header h6 {
    color: var(--text-primary);
    font-weight: 600;
}

.video-settings-panel .form-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 6px;
}

.video-settings-panel .form-select {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.video-settings-panel .form-select:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 0.2rem rgba(107, 70, 193, 0.25);
}

.steps-control {
    display: flex;
    align-items: center;
    gap: 12px;
}

.steps-control .form-range {
    flex: 1;
}

.steps-value {
    min-width: 30px;
    text-align: center;
    font-weight: 600;
    color: var(--accent-primary);
    background: var(--bg-primary);
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.slot-empty-state {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
    gap: 8px;
}

.slot-empty-state i {
    font-size: 4rem;
}

.slot-empty-state span {
    font-size: 1rem;
}

.preview-container {
    width: 100%;
    max-width: 320px;
    max-height: 180px;
    margin: 0 auto 16px;
    border-radius: 8px;
    overflow: hidden;
}

.preview-video {
    width: 100%;
    height: auto;
}

.video-generation-progress {
    text-align: center;
}

.generated-video-preview {
    text-align: center;
}

.video-actions {
    display: flex;
    gap: 6px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 0;
    padding: 0;
}

.video-actions .btn {
    font-size: 0.85rem;
    padding: 8px 16px;
    flex: 1 1 0;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.video-actions .btn:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.video-actions .btn-sm {
    font-size: 0.85rem;
    padding: 8px 16px;
}

/* .btn-primary в video-actions использует .vm-button-glossy */
.video-actions .btn-primary {
    color: var(--text-primary);
}

/* Hover эффект наследуется от .vm-button-glossy:hover */
.video-actions .btn-primary:hover {
    border-color: var(--gray-glossy-border);
}

.video-actions .btn-secondary {
    background: var(--accent-primary);
    border: 1px solid var(--accent-primary);
    color: var(--text-primary);
    transition: var(--vm-transition);
}

.video-actions .btn-secondary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    transform: translateY(-2px);
}

.video-actions .btn.me-2 {
    margin-right: 0;
} 

.scene-card-new {
    transition: all 1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    transform: translateZ(0); 
    will-change: transform, opacity; 
}

.scene-reordering {
    transform: scale(0.95) translateY(-10px);
    opacity: 0.7;
    z-index: 10;
    box-shadow: var(--vm-shadow-xl);
    border: 2px solid var(--accent-primary);
}

.scene-slide-left {
    transform: translateX(-120%);
    opacity: 0.3;
}

.scene-slide-right {
    transform: translateX(120%);
    opacity: 0.3;
}

.scene-reorder-dropdown {
    position: relative;
    margin-top: 8px;
}

.scene-reorder-select {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.scene-reorder-select-inline {
    width: auto;
    min-width: 40px;
    padding: 4px 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-left: 8px;
    margin-right: 4px;
    display: inline-block;
    vertical-align: middle;
}

.scene-reorder-select:hover,
.scene-reorder-select-inline:hover {
    border-color: var(--accent-primary);
    background: var(--bg-primary);
}

.scene-reorder-select:focus,
.scene-reorder-select-inline:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.scene-reorder-select:disabled,
.scene-reorder-select-inline:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.scene-reorder-loading {
    position: relative;
    pointer-events: none;
}

.scene-reorder-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid var(--accent-primary);
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.scene-reorder-button {
    background: var(--accent-primary);
    border: none;
    border-radius: 6px;
    color: white;
    padding: 6px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 8px;
    width: 100%;
}

.scene-reorder-button:hover:not(:disabled) {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.scene-reorder-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.scene-reorder-success {
    animation: reorderSuccess 2s ease-in-out;
}

@keyframes reorderSuccess {
    0% { 
        transform: scale(1);
        box-shadow: none; 
    }
    50% { 
        transform: scale(1.05);
        box-shadow: 0 0 20px rgba(0, 255, 136, 0.4);
        border-color: #00ff88;
    }
    100% { 
        transform: scale(1);
        box-shadow: none;
    }
}

.scene-reorder-error {
    animation: reorderError 1s ease-in-out;
}

@keyframes reorderError {
    0%, 100% { 
        transform: translateX(0);
        border-color: var(--border-color);
    }
    25% { 
        transform: translateX(-5px);
        border-color: var(--gray-danger);
    }
    75% { 
        transform: translateX(5px);
        border-color: var(--gray-danger);
    }
}

@media (max-width: 768px) {
    .scene-reorder-select {
        padding: 12px 16px;
        font-size: 16px; 
    }
    
    .scene-reorder-select-inline {
        padding: 6px 10px;
        font-size: 14px; 
        min-width: 45px;
        margin-left: 6px;
        margin-right: 3px;
    }
    
    .scene-reorder-button {
        padding: 12px;
        font-size: 14px;
        margin-top: 12px;
    }

    .scene-card-new {
        transition: all 0.5s ease-in-out;
    }
    
    .scene-reordering {
        transform: scale(0.98) translateY(-5px);
    }
    
    .scene-slide-left,
    .scene-slide-right {
        transform: translateX(100%);
    }
}

@media (prefers-contrast: high) {
    .scene-reorder-select {
        border-width: 2px;
    }
    
    .scene-reordering {
        border-width: 3px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .scene-card-new {
        transition: none;
    }
    
    .scene-reordering,
    .scene-slide-left,
    .scene-slide-right {
        transition: none;
        animation: none;
    }
    
    .scene-reorder-success,
    .scene-reorder-error {
        animation: none;
    }
}

.scene-delete-btn {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.scene-card-new:hover .scene-delete-btn {
    opacity: 1;
}

@media (hover: none) and (pointer: coarse) {
    .scene-delete-btn {
        opacity: 1;
    }
}

.scene-reorder-modern-container {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-left: 8px;
    margin-right: 4px;
}

.scene-reorder-btn-modern {
    
    height: 28px;
    min-width: 56px;
    padding: 0 12px;

    background: var(--nav-icon-color);
    border: 1px solid hsl(17, 100%, 70%);
    color: #ffffff;
    border-radius: 14px; 

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;

    cursor: pointer;
    user-select: none;
    position: relative;
    overflow: hidden;

    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    transform: translateZ(0); 
    will-change: transform, box-shadow, border-color;
}

.scene-reorder-btn-modern .reorder-icon {
    width: 14px;
    height: 14px;
    background: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M11 3l2 2-2 2M13 5H3M5 13l-2-2 2-2M3 11h10" stroke="%23ffffff" stroke-width="1.5" fill="none" stroke-linecap="round" stroke-linejoin="round"/></svg>') no-repeat center;
    background-size: contain;
    transition: transform 0.3s ease;
    display: inline-block;
    flex-shrink: 0;
}

.scene-reorder-btn-modern .chevron-icon {
    width: 12px;
    height: 8px;
    background: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 10"><path d="M2 2l6 6 6-6" stroke="%23ffffff" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"/></svg>') no-repeat center;
    background-size: contain;
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    display: inline-block;
    margin-left: 2px;
    flex-shrink: 0;
}

.scene-reorder-btn-modern:hover:not(:disabled) {
    border-color: hsl(17, 100%, 64%);
    background: var(--grad-orange-primary);
    transform: translateY(-1px) scale(1.015);
    box-shadow: 0 6px 16px hsla(17, 100%, 74%, 0.25);
    transition: all 0.25s ease-out;
}

.scene-reorder-btn-modern:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 6px hsla(17, 100%, 74%, 0.3);
}

.scene-reorder-btn-modern:focus-visible {
    outline: 2px solid var(--nav-icon-color);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px hsla(17, 100%, 74%, 0.15);
}

.scene-reorder-btn-modern.expanded {
    border-color: hsl(17, 100%, 64%);
    background: var(--grad-orange-hover);
    color: white;
    box-shadow: 0 4px 16px hsla(17, 100%, 74%, 0.35);
}

.scene-reorder-btn-modern.expanded .chevron-icon {
    transform: rotate(180deg);
}

.scene-reorder-btn-modern.loading {
    border-color: #4ade80;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, rgba(74, 222, 128, 0.08) 100%);
    box-shadow: 0 0 16px rgba(74, 222, 128, 0.25);
    /* Предотвращение мерцания при смене состояния */
    will-change: border-color, background, box-shadow;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    animation: adaptiveLoadingPulse 1.8s ease-in-out infinite;
}

@keyframes adaptiveLoadingPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.02); }
}

.scene-reorder-btn-modern.loading .reorder-icon.spinning {
    animation: vanGoghSpin 2s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
    transform-origin: center center;
    will-change: transform;
    backface-visibility: hidden;
}

.scene-reorder-btn-modern .loading-indicator {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(0, 255, 136, 0.4) 50%,
        transparent 100%
    );
    animation: loadingShimmer 1.5s ease-in-out infinite;
}

.scene-reorder-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 180px;
    max-width: 240px;
    
    background: var(--bg-primary);
    border: 1px solid var(--accent-primary);
    border-radius: 12px;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.15),
        0 0 20px rgba(99, 102, 241, 0.1);
    
    z-index: 1100; 
    padding: 8px 0;

    opacity: 0;
    transform: translateY(-10px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    pointer-events: none;
}

.scene-reorder-menu.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

.scene-reorder-option {
    width: 100%;
    padding: 8px 16px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
    
    display: flex;
    align-items: center;
    gap: 8px;
    
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.scene-reorder-option:hover {
    background: linear-gradient(90deg, 
        rgba(99, 102, 241, 0.1) 0%, 
        rgba(0, 255, 136, 0.05) 100%
    );
    color: var(--accent-primary);
}

.scene-reorder-option:active {
    background: rgba(99, 102, 241, 0.2);
}

.scene-reorder-option .scene-arrow {
    font-size: 14px;
    color: var(--accent-primary);
    transition: transform 0.2s ease;
}

.scene-reorder-option:hover .scene-arrow {
    transform: translateX(4px);
}

.scene-reorder-option .scene-info {
    flex: 1;
    font-size: 14px;
    line-height: 1.3;
}

.scene-reorder-option .scene-info small {
    display: block;
    font-size: 12px;
    opacity: 0.7;
    margin-top: 2px;
}

@keyframes vanGoghSpin {
    0% { 
        transform: rotate(0deg) scale(1);
    }
    25% { 
        transform: rotate(90deg) scale(1.1);
        filter: hue-rotate(45deg);
    }
    50% { 
        transform: rotate(180deg) scale(0.9);
        filter: hue-rotate(90deg);
    }
    75% { 
        transform: rotate(270deg) scale(1.1);
        filter: hue-rotate(135deg);
    }
    100% { 
        transform: rotate(360deg) scale(1);
        filter: hue-rotate(180deg);
    }
}

@keyframes loadingShimmer {
    0% { 
        transform: translateX(-100%);
    }
    100% { 
        transform: translateX(100%);
    }
}

@keyframes sceneSwapSlideOut {
    0% {
        transform: translateX(0) scale(1);
        opacity: 1;
        z-index: 1;
    }
    50% {
        transform: translateX(calc(-50%)) scale(0.95);
        opacity: 0.7;
        z-index: 10;
    }
    100% {
        transform: translateX(calc(-100%)) scale(0.9);
        opacity: 0.3;
        z-index: 1;
    }
}

@keyframes sceneSwapSlideIn {
    0% {
        transform: translateX(100%) scale(0.9);
        opacity: 0.3;
        z-index: 1;
    }
    50% {
        transform: translateX(50%) scale(0.95);
        opacity: 0.7;
        z-index: 10;
    }
    100% {
        transform: translateX(0) scale(1);
        opacity: 1;
        z-index: 1;
    }
}

.scene-swap-slide-out { 
    animation: sceneSwapSlideOut 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards; 
    will-change: transform, opacity;
    position: relative;
}

.scene-swap-slide-in { 
    animation: sceneSwapSlideIn 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards; 
    will-change: transform, opacity;
    position: relative;
}

.scene-swap-then-van-gogh {
    animation: 
        sceneSwapSlideOut 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards,
        vanGoghSceneMovement 2s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.6s forwards;
    will-change: transform, opacity, box-shadow, filter;
    position: relative;
    z-index: 100;
}

@keyframes vanGoghSceneMovement {
    
    0% {
        transform: scale(1) rotate(0deg);
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
        filter: brightness(1) saturate(1);
    }
    15% {
        transform: scale(1.05) rotate(2deg);
        box-shadow: 
            0 8px 24px rgba(99, 102, 241, 0.2),
            0 0 20px rgba(0, 255, 136, 0.1);
        filter: brightness(1.1) saturate(1.2);
    }

    30% {
        transform: scale(0.95) rotate(-1deg);
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
        filter: brightness(0.9) saturate(1.1);
    }

    45% {
        transform: scale(1.02) rotate(3deg) translateX(-10px);
        box-shadow: 
            0 12px 32px rgba(99, 102, 241, 0.25),
            0 0 30px rgba(0, 255, 136, 0.15);
        filter: brightness(1.15) saturate(1.3) hue-rotate(15deg);
    }
    60% {
        transform: scale(0.98) rotate(-2deg) translateX(15px) translateY(-5px);
        box-shadow: 
            0 16px 40px rgba(124, 58, 237, 0.3),
            0 0 40px rgba(0, 255, 136, 0.2);
        filter: brightness(1.2) saturate(1.4) hue-rotate(30deg);
    }
    75% {
        transform: scale(1.03) rotate(1deg) translateX(-8px) translateY(3px);
        box-shadow: 
            0 20px 48px rgba(99, 102, 241, 0.35),
            0 0 50px rgba(0, 255, 136, 0.25);
        filter: brightness(1.25) saturate(1.5) hue-rotate(45deg);
    }
    90% {
        transform: scale(1.01) rotate(-0.5deg) translateX(5px) translateY(-2px);
        box-shadow: 
            0 12px 32px rgba(99, 102, 241, 0.2),
            0 0 30px rgba(0, 255, 136, 0.15);
        filter: brightness(1.1) saturate(1.2) hue-rotate(20deg);
    }
    100% {
        transform: scale(1) rotate(0deg) translateX(0) translateY(0);
        box-shadow: 0 6px 16px rgba(99, 102, 241, 0.1);
        filter: brightness(1) saturate(1) hue-rotate(0deg);
    }
}

.van-gogh-reordering {
    animation: vanGoghSceneMovement 2s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    z-index: 100;
    position: relative;
}

@media (max-width: 768px) {
    .scene-reorder-btn-modern {
        height: 32px;
        min-width: 60px;
        padding: 0 14px;
    }
    
    .scene-reorder-menu {
        min-width: 200px;
        max-width: 280px;
        top: calc(100% + 12px);
    }
    
    .scene-reorder-option {
        padding: 12px 18px;
        font-size: 16px; 
    }
    
    .scene-reorder-option .scene-info small {
        font-size: 14px;
    }

    .van-gogh-reordering {
        animation-duration: 1.5s;
    }
    
    @keyframes vanGoghSceneMovement {
        45% { transform: scale(1.01) rotate(1deg) translateX(-5px); }
        60% { transform: scale(0.99) rotate(-1deg) translateX(8px) translateY(-2px); }
        75% { transform: scale(1.01) rotate(0.5deg) translateX(-3px) translateY(1px); }
    }
}

@media (prefers-contrast: high) {
    .scene-reorder-btn-modern {
        border-width: 2px;
    }
    
    .scene-reorder-btn-modern:focus-visible {
        outline: 3px solid var(--nav-icon-color);
        outline-offset: 2px;
    }
    
    .scene-reorder-menu {
        border-width: 2px;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    }
}

@media (prefers-reduced-motion: reduce) {
    .scene-reorder-btn-modern:hover:not(:disabled) {
        transform: none;
        transition: box-shadow 0.2s ease, border-color 0.2s ease;
    }
    
    .scene-reorder-btn-modern .chevron-icon {
        transition: transform 0.1s ease;
    }
    
    .scene-reorder-btn-modern,
    .scene-reorder-menu,
    .scene-reorder-option {
        transition: box-shadow 0.2s ease, border-color 0.2s ease;
    }
    
    .van-gogh-reordering,
    .scene-swap-slide-out,
    .scene-swap-slide-in,
    .scene-swap-then-van-gogh {
        animation: none;
        transform: none;
        box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
    }
    
    .scene-reorder-btn-modern.loading .reorder-icon.spinning {
        animation: none;
    }
    
    .loading-indicator,
    .adaptiveLoadingPulse {
        animation: none;
    }
}

.scene-reorder-menu[role="menu"] {
    outline: none;
}

.scene-reorder-option[role="menuitem"]:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: -2px;
    background: rgba(99, 102, 241, 0.15);
}

@media (prefers-color-scheme: dark) {
    .scene-reorder-btn-modern.loading {
        border-color: #4ade80; 
        box-shadow: 
            0 0 20px rgba(74, 222, 128, 0.3),
            0 4px 16px rgba(99, 102, 241, 0.2);
    }
}

.scene-reorder-btn-modern,
.scene-reorder-menu,
.scene-reorder-option,
.van-gogh-reordering {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

.scene-reorder-btn-modern.expanded,
.scene-reorder-btn-modern.loading,
.van-gogh-reordering {
    will-change: transform, box-shadow, filter;
}

.scene-reorder-btn-modern:not(.expanded):not(.loading),
.scene-card:not(.van-gogh-reordering) {
    will-change: auto;
}

.scene-card-new {
    transition: transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
    transform-origin: center center;
    backface-visibility: hidden;
}

.scene-card-new.flip-animating {
    animation: flipMovement var(--flip-duration) var(--flip-easing);
    animation-delay: var(--flip-delay);
    animation-fill-mode: forwards;
    z-index: 10;
    position: relative;
    will-change: transform, box-shadow;
}

@keyframes flipMovement {
    from { 
        transform: translate(var(--flip-x), var(--flip-y));
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    }
    to { 
        transform: translate(0, 0);
        box-shadow: none;
    }
}

@media (min-width: 769px) {
    .scene-card-new.flip-animating {
        animation: flipMovementEnhanced var(--flip-duration) var(--flip-easing);
        animation-delay: var(--flip-delay);
        animation-fill-mode: forwards;
    }
    
    @keyframes flipMovementEnhanced {
        0% { 
            transform: translate(var(--flip-x), var(--flip-y));
            box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
            z-index: 10;
        }
        50% {
            transform: translate(calc(var(--flip-x) * 0.5), calc(var(--flip-y) * 0.5));
            box-shadow: 0 12px 36px rgba(99, 102, 241, 0.4);
            z-index: 10;
        }
        100% { 
            transform: translate(0, 0);
            box-shadow: none;
            z-index: 1;
        }
    }
}

@media (max-width: 768px) {
    .scene-card-new {
        transition: transform 0.6s ease-out;
    }
    
    .scene-card-new.flip-animating {
        animation: flipMovementMobile var(--flip-duration) var(--flip-easing);
        animation-delay: var(--flip-delay);
    }
    
    @keyframes flipMovementMobile {
        from { 
            transform: translate(var(--flip-x), var(--flip-y));
        }
        to { 
            transform: translate(0, 0);
        }
    }
}

.scene-card-new.flip-animating {
    transform: translateZ(0);
    perspective: 1000px;
}

.scene-card-new.flip-animating.van-gogh-ready {
    animation: flipMovement var(--flip-duration) var(--flip-easing),
              vanGoghSceneMovement 2s cubic-bezier(0.25, 0.46, 0.45, 0.94) var(--van-gogh-delay);
    animation-fill-mode: forwards, forwards;
}

@media (prefers-reduced-motion: reduce) {
    .scene-card-new { 
        transition: none; 
    }
    
    .scene-card-new.flip-animating { 
        animation: none;
        transform: translate(0, 0);
        box-shadow: none;
        z-index: var(--z-base);
    }
    
    .flip-animating {
        
        transition: opacity 0.2s ease;
    }
}

.scene-card-new:nth-child(1).flip-animating { --flip-delay: 0ms; }
.scene-card-new:nth-child(2).flip-animating { --flip-delay: 100ms; }
.scene-card-new:nth-child(3).flip-animating { --flip-delay: 200ms; }
.scene-card-new:nth-child(4).flip-animating { --flip-delay: 300ms; }
.scene-card-new:nth-child(5).flip-animating { --flip-delay: 400ms; }
.scene-card-new:nth-child(6).flip-animating { --flip-delay: 500ms; }
.scene-card-new:nth-child(7).flip-animating { --flip-delay: 600ms; }
.scene-card-new:nth-child(8).flip-animating { --flip-delay: 700ms; }

.scene-card-new {
    --flip-x: 0px;
    --flip-y: 0px;
    --flip-duration: 800ms;
    --flip-easing: cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --flip-delay: 0ms;
    --van-gogh-delay: 200ms;
}

@media (max-width: 768px) {
    .scene-card-new {
        --flip-duration: 600ms;
        --flip-easing: ease-out;
    }
}

#scenes-container {
    position: relative;
    isolation: isolate;
}

@media (prefers-contrast: high) {
    .scene-card-new.flip-animating {
        border: 2px solid var(--accent-primary);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    }
}

@media (prefers-color-scheme: dark) {
    .scene-card-new.flip-animating {
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
    }
    
    @keyframes flipMovementEnhanced {
        50% {
            box-shadow: 0 12px 36px rgba(99, 102, 241, 0.5);
        }
    }
}

.scene-card-new.swipe-animating {
    z-index: 10;
    will-change: transform, box-shadow, z-index, filter;
    transform-origin: center center;
    backface-visibility: hidden;
    perspective: 1000px;
    
}

.scene-card-new.swipe-primary {
    z-index: calc(var(--z-base) * 10);
    filter: brightness(1.05);
}

.scene-card-new.swipe-secondary {
    z-index: calc(var(--z-base) * 8);
    filter: brightness(1.02);
}

@keyframes swipeMovement {
    0% {
        transform: translate(var(--flip-x, 0), var(--flip-y, 0)) scale(1);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        z-index: 5;
    }
    25% {
        transform: translate(calc(var(--flip-x, 0) * 0.75), calc(var(--flip-y, 0) * 0.75 - 8px)) scale(1.01);
        box-shadow: 0 6px 18px rgba(99, 102, 241, 0.15);
        z-index: 8;
    }
    50% {
        transform: translate(calc(var(--flip-x, 0) * 0.5), calc(var(--flip-y, 0) * 0.5 - 12px)) scale(1.02);
        box-shadow: 0 8px 24px rgba(99, 102, 241, 0.25);
        z-index: 10;
    }
    75% {
        transform: translate(calc(var(--flip-x, 0) * 0.25), calc(var(--flip-y, 0) * 0.25 - 8px)) scale(1.01);
        box-shadow: 0 6px 18px rgba(99, 102, 241, 0.15);
        z-index: 8;
    }
    100% {
        transform: translate(0, 0) scale(1);
        box-shadow: none;
        z-index: 1;
    }
}

@media (min-width: 769px) {
    .scene-card-new.swipe-animating {
        animation: swipeMovementEnhanced var(--flip-duration) cubic-bezier(0.25, 0.46, 0.45, 0.94) var(--flip-delay) forwards;
    }
    
    @keyframes swipeMovementEnhanced {
        0% {
            transform: translate(var(--flip-x, 0), var(--flip-y, 0)) scale(1) rotateZ(0deg);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
            z-index: 5;
        }
        20% {
            transform: translate(calc(var(--flip-x, 0) * 0.8), calc(var(--flip-y, 0) * 0.8 - 6px)) scale(1.005) rotateZ(calc(var(--flip-x, 0) * 0.002));
            box-shadow: 0 6px 16px rgba(99, 102, 241, 0.12);
            z-index: 7;
        }
        50% {
            transform: translate(calc(var(--flip-x, 0) * 0.5), calc(var(--flip-y, 0) * 0.5 - 14px)) scale(1.02) rotateZ(calc(var(--flip-x, 0) * 0.004));
            box-shadow: 0 12px 32px rgba(99, 102, 241, 0.3);
            z-index: 10;
        }
        80% {
            transform: translate(calc(var(--flip-x, 0) * 0.2), calc(var(--flip-y, 0) * 0.2 - 6px)) scale(1.005) rotateZ(calc(var(--flip-x, 0) * 0.002));
            box-shadow: 0 6px 16px rgba(99, 102, 241, 0.12);
            z-index: 7;
        }
        100% {
            transform: translate(0, 0) scale(1) rotateZ(0deg);
            box-shadow: none;
            z-index: 1;
        }
    }
}

@media (max-width: 768px) {
    .scene-card-new.swipe-animating {
        animation: swipeMovementMobile var(--flip-duration) ease-out var(--flip-delay) forwards;
    }
    
    @keyframes swipeMovementMobile {
        0% {
            transform: translate(var(--flip-x, 0), var(--flip-y, 0)) scale(1);
            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
        }
        50% {
            transform: translate(calc(var(--flip-x, 0) * 0.5), calc(var(--flip-y, 0) * 0.5 - 4px)) scale(1.01);
            box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
        }
        100% {
            transform: translate(0, 0) scale(1);
            box-shadow: none;
        }
    }
}

@media (prefers-reduced-motion: reduce) {
    .scene-card-new.swipe-animating {
        animation: swipeMovementReduced 0.2s ease-out forwards;
    }
    
    @keyframes swipeMovementReduced {
        0% { 
            transform: translate(var(--flip-x, 0), var(--flip-y, 0)); 
            opacity: 0.9; 
        }
        100% { 
            transform: translate(0, 0); 
            opacity: 1; 
        }
    }
}

.scene-card-new.card-enter-animating {
    transform-origin: center center;
    backface-visibility: hidden;
    will-change: transform, opacity;
}

.model-selector {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.model-option {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-secondary);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    overflow: hidden;
}

.model-option:hover {
    border-color: var(--accent-primary);
    background: var(--bg-primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
}

.model-option.selected {
    border-color: var(--accent-primary);
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.2);
}

.model-option.selected::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--accent-primary);
}

.model-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--bg-tertiary);
    margin-right: 12px;
    flex-shrink: 0;
}

.model-option.selected .model-icon {
    background: var(--accent-primary);
    color: white;
}

.model-icon i {
    font-size: 16px;
    color: var(--text-secondary);
}

.model-option.selected .model-icon i {
    color: white;
}

.model-info {
    flex: 1;
    min-width: 0;
}

.model-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 4px 0;
}

.model-description {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 0 0 2px 0;
    line-height: 1.3;
}

.model-resolution {
    font-size: 11px;
    color: var(--text-tertiary);
}

.model-radio {
    margin-left: 8px;
    flex-shrink: 0;
}

.model-radio input[type="radio"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-primary);
}

.model-info-panel {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    margin-top: 16px;
}

.model-info-panel h6 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 6px 0;
    display: flex;
    align-items: center;
}

.model-info-panel p {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 0 0 4px 0;
    line-height: 1.4;
}

.model-info-panel small {
    font-size: 11px;
    color: var(--text-tertiary);
}

.generation-header {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    padding: 20px;
    margin-bottom: 24px;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto 24px auto;
}

.generation-prompt h4 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 8px 0;
    display: flex;
    align-items: center;
}

.generation-prompt p {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
}

.image-results-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 20px;
}

.generation-progress-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    justify-items: center;
    align-items: start;
}

.image-generation-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    width: 100%;
    max-width: 580px;
}

.image-generation-card:hover {
    border-color: var(--accent-primary);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.1);
}

.generation-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-primary);
}

.generation-card-header h6 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.model-badge {
    font-size: 10px;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.model-badge.model-dalle {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.model-badge.model-flux {
    background: rgba(99, 102, 241, 0.1);
    color: #6366f1;
    border: 1px solid rgba(99, 102, 241, 0.2);
} */

.generation-preview {
    aspect-ratio: 1/1;
    position: relative;
    background: var(--bg-tertiary);
    overflow: hidden;
}

.generated-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.generation-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
    text-align: center;
    padding: 20px;
}

.generation-spinner {
    font-size: 24px;
    margin-bottom: 12px;
    color: var(--accent-primary);
}

.generation-placeholder p {
    font-size: 14px;
    margin: 0;
}

.generation-progress {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.generation-progress .progress {
    flex: 1;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
}

.progress-text {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 35px;
    text-align: right;
}

.image-results-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    justify-items: center;
    align-items: start;
}

/* Qwen: карта занимает обе колонки (визуально как 2 варианта) */
.image-results-grid .span-2 {
    grid-column: span 2;
}

/* Увеличенная ширина и центрирование для одиночной карты Qwen */
.image-generation-card.qwen-center,
.image-result-card.qwen-center {
    max-width: 1200px;
    width: 100%;
}

.image-result-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    width: 100%;
    max-width: 580px;
}

.image-result-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.15);
}

.result-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-primary);
}

.result-card-header h6 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.result-image-container {
    position: relative;
    aspect-ratio: 1/1;
    overflow: hidden;
}

.result-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.result-image-container:hover .result-image {
    transform: scale(1.05);
}

.image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.result-image-container:hover .image-overlay {
    opacity: 1;
}

.image-overlay .btn {
    padding: 8px;
    border-radius: 6px;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.image-overlay .btn:hover {
    background: white;
    transform: scale(1.1);
}

.result-info {
    padding: 12px 16px;
    font-size: 12px;
}

.result-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.result-actions {
    margin-top: 8px;
}

.generation-time {
    color: var(--text-tertiary);
}

.result-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    aspect-ratio: 16/9;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    text-align: center;
    padding: 20px;
}

.result-error i {
    font-size: 32px;
    color: var(--gray-glossy);
    margin-bottom: 12px;
}

.result-error p {
    font-size: 14px;
    margin: 0 0 16px 0;
}

.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1500; 
    padding: 20px;
}

.image-modal-content {
    background: var(--bg-primary);
    border-radius: 16px;
    max-width: 90vw;
    max-height: 90vh;
    height: auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.image-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.image-modal .modal-header h5 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.btn-close-modal {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.btn-close-modal:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.image-modal .modal-body {
    padding: 0;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.modal-image {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    background: var(--bg-tertiary);
    flex: 1;
    min-height: 200px;
}

.image-details {
    padding: 16px 24px;
    background: var(--bg-secondary);
    flex-shrink: 0;
}

@media (min-width: 1200px) {
    .image-details {
        padding: 20px 48px;
    }
}

.image-details p {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0 0 8px 0;
    line-height: 1.4;
}

.image-details strong {
    color: var(--text-primary);
    font-weight: 600;
}

.image-modal .modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
    flex-shrink: 0;
}

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

@media (max-width: 768px) {
    .generation-progress-section,
    .image-results-grid {
        grid-template-columns: 1fr;
        justify-items: stretch;
        max-width: 480px;
    }

    .image-generation-card,
    .image-result-card {
        max-width: 100%;
    }

    .image-results-container {
        padding: 0 10px;
    }

    .generation-header {
        padding: 16px;
        max-width: 480px;
    }
    
    .model-selector {
        gap: 6px;
    }
    
    .model-option {
        padding: 10px 12px;
    }
    
    .model-icon {
        width: 28px;
        height: 28px;
        margin-right: 10px;
    }
    
    .generation-prompt h4 {
        font-size: 16px;
    }
    
    .image-modal-content {
        max-width: 95vw;
        max-height: 90vh;
    }
    
    .image-modal .modal-header,
    .image-modal .modal-footer {
        padding: 16px 20px;
    }
    
    .image-details {
        padding: 12px 16px;
    }
    
    .image-details p {
        font-size: 12px;
        margin: 0 0 6px 0;
    }
    
    .modal-image {
        min-height: 150px;
    }
    
    .image-modal .modal-footer {
        gap: 8px;
    }
    
    .image-modal .modal-footer button {
        padding: 10px 16px;
        font-size: 13px;
    }
}

@media (max-height: 700px) {
    .image-modal-content {
        max-height: 95vh;
    }
    
    .image-details {
        padding: 10px 16px;
    }
    
    .image-modal .modal-header {
        padding: 14px 20px;
    }
    
    .image-modal .modal-footer {
        padding: 14px 20px;
    }
    
    .modal-image {
        min-height: 100px;
    }
}

@media (hover: none) and (pointer: coarse) {
    .image-overlay {
        opacity: 1;
        background: rgba(0, 0, 0, 0.5);
    }
    
    .model-option:hover {
        transform: none;
    }
    
    .result-image-container:hover .result-image {
        transform: none;
    }
}

@media (prefers-color-scheme: dark) {
    .model-badge.model-dalle {
        background: rgba(16, 185, 129, 0.15);
        color: #34d399;
    }
    
        .model-badge.model-flux {
        background: rgba(99, 102, 241, 0.15);
        color: #818cf8;
    } */
    
    .image-overlay .btn {
        background: rgba(255, 255, 255, 0.95);
        color: #1f2937;
    }
}

@media (prefers-contrast: high) {
    .model-option {
        border-width: 3px;
    }
    
    .model-option.selected {
        border-width: 3px;
        box-shadow: 0 0 0 2px var(--accent-primary);
    }
    
    .image-generation-card,
    .image-result-card {
        border-width: 2px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .model-option,
    .image-generation-card,
    .image-result-card,
    .result-image,
    .generated-image {
        transition: none;
    }
    
    .image-result-card:hover {
        transform: none;
    }
    
    .result-image-container:hover .result-image {
        transform: none;
    }
    
    .generation-spinner i {
        animation: none;
    }
}

.download-buttons-panel,
div.download-buttons-panel {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
}

.download-buttons-panel .download-button {
    margin: 0;
    flex-shrink: 0;
    white-space: nowrap;
}

@media (max-width: 1024px) and (min-width: 769px) {
    .download-buttons-panel,
    div.download-buttons-panel {
        gap: 30px;
        justify-content: flex-end;
    }
}

@media (max-width: 768px) {
    .download-buttons-panel,
    div.download-buttons-panel {
        flex-direction: column;
        gap: 25px;
        justify-content: center;
        align-items: center;
        width: 100%;
    }
}

.video-ready-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--gray-glossy);
    color: var(--text-primary);
    border: 1px solid var(--gray-glossy-border);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    box-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    z-index: 2;
}

.video-ready-badge:hover {
    transform: scale(1.1);
}

.btn-cancel-mini {
    background: var(--gray-danger);
    color: var(--text-primary);
    border: 1px solid var(--gray-danger);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    padding: 0;
    margin-left: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.btn-cancel-mini:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    transform: scale(1.1);
}

.scene-image-item.selected {
    border: 2px solid var(--accent-primary);
    box-shadow: 
        0 0 0 2px rgba(99, 102, 241, 0.3),
        0 4px 8px rgba(0, 0, 0, 0.3);
    transform: scale(1.02);
}

.scene-image-item.has-video {
    border-color: var(--gray-glossy-border);
}

.scene-image-item.selected.has-video {
    border-color: var(--accent-primary);
}

.slot-progress-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.9) 0%,
        rgba(0, 0, 0, 0.7) 50%,
        rgba(0, 0, 0, 0) 100%
    );
    padding: 12px;
    border-radius: 0 0 12px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

.slot-progress-info span {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
}

.slot-progress-info .btn {
    font-size: 12px;
    padding: 4px 8px;
}

.model-badge.model-gpt {
    background-color: var(--accent-secondary);
    color: var(--text-primary);
}

.model-selector {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    padding: 12px 16px;
    transition: all 0.3s ease;
}

.model-selector:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
    outline: none;
}

.model-resolution-group {
    margin-top: 1rem;
    position: relative;
}

.resolution-selector {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    padding: 12px 16px;
    transition: all 0.3s ease;
}

.resolution-selector:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
    outline: none;
}

.model-resolution-group::before {
    content: "";
    position: absolute;
    top: -8px;
    left: 12px;
    width: 2px;
    height: 8px;
    background: var(--accent-primary);
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

.model-resolution-group:hover::before {
    opacity: 1;
}

.form-label i {
    color: var(--accent-primary);
    opacity: 0.8;
}

.model-selector option,
.resolution-selector option {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    padding: 8px;
}

.model-selector:disabled,
.resolution-selector:disabled {
    background-color: var(--bg-tertiary);
    color: var(--text-secondary);
    border-color: var(--gray-separator);
    cursor: not-allowed;
    opacity: 0.6;
}

.video-model-settings {
    margin-top: 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    background: var(--bg-secondary);
}

.video-model-settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    border-bottom: 1px solid transparent;
}

.video-model-settings-header:hover {
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
    border-bottom-color: var(--border-color);
}

.model-header-content {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 16px;
}

.current-model-display {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.current-model-value {
    display: flex;
    align-items: center;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
}

.current-model-description {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 400;
}

.video-model-settings-content {
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--bg-primary);
}

.video-model-settings-content.collapsed {
    max-height: 0;
    padding: 0 20px;
    border-top: none;
}

.video-model-settings-content.expanded {
    max-height: 1000px;
    padding: 24px 20px;
    border-top: 1px solid var(--border-color);
}

.model-selection-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.model-card {
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--bg-secondary);
    position: relative;
    overflow: hidden;
}

.model-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, transparent);
    transition: all 0.3s ease;
}

.model-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.model-card.active {
    border-color: var(--storyboard-border-active);
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--storyboard-bg-active) 100%);
    box-shadow: 0 4px 20px var(--storyboard-shadow-active);
}

.model-card.active::before {
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
}

.model-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.model-icon {
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.model-card:hover .model-icon {
    transform: scale(1.05);
}

.model-info h6 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
}

.model-info p {
    margin: 0;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.3;
}

.model-specs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.spec-badge {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.model-card.active .spec-badge {
    background: rgba(99, 102, 241, 0.1);
    color: var(--accent-primary);
}

.resolution-selection-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.resolution-title {
    margin: 0 0 16px 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
}

.resolution-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.resolution-card {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--bg-secondary);
    text-align: center;
}

.resolution-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-1px);
}

.resolution-card.active {
    border-color: var(--storyboard-border-active);
    background: var(--storyboard-bg-active);
    box-shadow: 0 2px 8px var(--storyboard-shadow-active);
}

.resolution-preview {
    margin-bottom: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 40px;
}

.resolution-rect {
    background: var(--nav-icon-color);
    border-radius: 2px;
    opacity: 0.8;
    transition: all 0.3s ease;
}

.resolution-card:hover .resolution-rect,
.resolution-card.active .resolution-rect {
    background: var(--nav-icon-color);
    opacity: 1;
    transform: scale(1.05);
}

.resolution-rect.aspect-16-9 { width: 32px; height: 18px; }
.resolution-rect.aspect-9-16 { width: 18px; height: 32px; }
.resolution-rect.aspect-1-1 { width: 24px; height: 24px; }
.resolution-rect.aspect-4-3 { width: 32px; height: 24px; }
.resolution-rect.aspect-3-4 { width: 24px; height: 32px; }

.resolution-info {
    font-size: 11px;
}

.resolution-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.resolution-specs {
    color: var(--text-secondary);
    font-weight: 400;
}

.video-model-settings[disabled] .video-model-settings-header {
    cursor: not-allowed;
    opacity: 0.6;
}

.video-model-settings[disabled] .model-card,
.video-model-settings[disabled] .resolution-card {
    cursor: not-allowed;
    opacity: 0.6;
    pointer-events: none;
}

.video-model-settings-header .vm-icon-expand {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.video-model-settings-content.expanded ~ .video-model-settings-header .vm-icon-expand {
    transform: rotate(180deg);
}

.model-card:focus-visible,
.resolution-card:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

.video-model-settings-header:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: -2px;
}

@media (max-width: 768px) {
    .model-selection-grid {
        grid-template-columns: 1fr;
    }
    
    .resolution-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .video-model-settings-header {
        padding: 12px 16px;
    }
    
    .video-model-settings-content.expanded {
        padding: 16px;
    }
    
    .model-card-header {
        gap: 8px;
    }
    
    .model-info h6 {
        font-size: 14px;
    }
    
    .model-info p {
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .resolution-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    
    .model-card {
        padding: 12px;
    }
    
    .resolution-card {
        padding: 8px;
    }
    
    .current-model-display {
        display: none; 
    }
}

.model-selector,
.resolution-selector,
.model-resolution-group {
    
    display: none;
}

:root {
    --storyboard-accent: #2d3748;      
    --storyboard-accent-light: #4a5568; 
    --storyboard-bg-active: rgba(45, 55, 72, 0.1);
    --storyboard-border-active: #718096;
    --storyboard-shadow-active: rgba(45, 55, 72, 0.2);
    --storyboard-hover-shadow: rgba(45, 55, 72, 0.15);
}

.model-selection-container {
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    background: var(--bg-secondary);
    position: relative;
    transition: var(--vm-transition);
}

.model-selection-container:hover {
    border-color: #ff6b35;
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.2);
}

.model-selection-simple {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min-content, 1fr));
    gap: 12px;
    margin: 0;
}

.model-card-simple {
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    cursor: pointer;
    transition: var(--vm-transition);
    min-width: min-content;
    white-space: nowrap;
    background: var(--bg-secondary);
    position: relative;
}

.model-card-simple:hover {
    border-color: #ff6b35;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.2);
}

.model-card-simple.active {
    border-color: #ff6b35;
    background: var(--storyboard-bg-active);
    box-shadow: 0 4px 20px rgba(255, 107, 53, 0.3);
}

.model-card-simple-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.model-card-simple-header img,
.model-card-simple-header .vm-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 6px;
}

.model-card-simple-header img {
    object-fit: contain;
}

.model-icon-simple {
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.model-card-simple:hover .model-icon-simple,
.model-card-simple.active .model-icon-simple {
    color: var(--storyboard-accent);
}

.model-info-simple {
    flex: 1;
}

.model-name-simple {
    margin: 0 0 4px 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.model-description-simple {
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.resolution-selection-simple {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 8px;
}

.resolution-card-simple {
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: var(--vm-transition);
    background: var(--bg-secondary);
    text-align: center;
}

.resolution-card-simple:hover {
    border-color: var(--storyboard-border-active);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--storyboard-hover-shadow);
}

.resolution-card-simple.active {
    border-color: var(--storyboard-border-active);
    background: var(--storyboard-bg-active);
    box-shadow: 0 2px 8px var(--storyboard-shadow-active);
}

.resolution-preview-simple {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 40px;
    margin-bottom: 8px;
}

.resolution-rect-simple {
    background: var(--nav-icon-color);
    border-radius: 3px;
    opacity: 0.8;
    transition: all 0.3s ease;
}

.resolution-rect-simple.aspect-16-9 {
    width: 36px;
    height: 20px;
}

.resolution-rect-simple.aspect-9-16 {
    width: 20px;
    height: 36px;
}

.resolution-rect-simple.aspect-1-1 {
    width: 28px;
    height: 28px;
}

.resolution-rect-simple.aspect-4-3 {
    width: 36px;
    height: 24px;
}

.resolution-rect-simple.aspect-3-4 {
    width: 24px;
    height: 36px;
}

.resolution-card-simple:hover .resolution-rect-simple,
.resolution-card-simple.active .resolution-rect-simple {
    background: var(--nav-icon-color);
    opacity: 1;
}

.resolution-info-simple {
    text-align: center;
}

.resolution-name-simple {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.resolution-specs-simple {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.model-card-simple:focus-visible,
.resolution-card-simple:focus-visible {
    outline: 2px solid var(--storyboard-accent);
    outline-offset: 2px;
}

.model-card-simple[disabled],
.resolution-card-simple[disabled],
.model-card-simple.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
    position: relative;
    filter: grayscale(40%) brightness(0.8);
}

.model-card-simple.disabled::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 8px,
        rgba(255, 255, 255, 0.03) 8px,
        rgba(255, 255, 255, 0.03) 16px
    );
    border-radius: 8px;
    pointer-events: none;
}

.model-card-simple.disabled .model-description-simple {
    color: #ffa500;
    font-weight: 500;
    opacity: 0.9;
}

@media (max-width: 768px) {
    .model-selection-container {
        padding: 12px;
    }
    
    .model-selection-simple {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .resolution-selection-simple {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
}

@media (max-width: 480px) {
    .model-selection-container {
        padding: 8px;
    }
    
    .model-card-simple {
        padding: 12px;
    }
    
    .resolution-card-simple {
        padding: 8px;
    }
    
    .resolution-selection-simple {
        grid-template-columns: 1fr;
    }
}

.settings-display {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.settings-display .badge {
    font-size: 0.8rem;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 500;
}

.settings-display .badge.bg-secondary {
    background-color: #1a1a1a;
    color: var(--text-primary);
    border: 1px solid #333333;
    font-size: 0.8rem;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.3s ease;
}
.settings-display .badge.bg-secondary:hover {
    background-color: #2a2a2a;
    border-color: #ff6b35;
}

.scene-modal-unified .form-label.text-center.d-block {
    text-align: center;
    margin-bottom: 0.75rem;
    font-weight: 500;
    color: var(--text-primary);
}

.scene-modal-unified .settings-display {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.settings-display .badge.bg-secondary {
    background-color: #1a1a1a;
    color: var(--text-primary);
    border: 1px solid #333333;
    font-size: 0.8rem;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.3s ease;
}
.settings-display .badge.bg-secondary:hover {
    background-color: #2a2a2a;
    border-color: #ff6b35;
}

.settings-display .badge.bg-info {
    background-color: #1a1a1a;
    color: var(--text-primary);
    border: 1px solid #333333;
    font-size: 0.8rem;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.3s ease;
}
.settings-display .badge.bg-info:hover {
    background-color: #2a2a2a;
    border-color: #ff6b35;
}

.modal {
    z-index: 10000; 
}

.modal-backdrop {
    z-index: 9990; 
}

.modal.fade.show {
    z-index: var(--z-overlay);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.modal-dialog-centered {
    display: flex;
    align-items: center;
    min-height: calc(100vh - 2rem);
    margin: 1rem auto;
}

.modal-content {
    position: relative;
    z-index: calc(var(--z-overlay) + 10);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.video-prompt-edit-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center; 
    justify-content: center;
    z-index: 10000;
    padding: 20px;
    overflow-y: auto;
    box-sizing: border-box;
}

.video-prompt-edit-modal .modal-dialog {
    margin: 0;
    max-width: 600px;
    width: 100%;
    z-index: 10001; 
    transform: translateY(-4rem); 
}

.video-prompt-edit-modal .modal-content {
    max-height: calc(100vh - 40px); 
    overflow-y: auto;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.8); 
    border: none;
    border-radius: 12px;
    position: relative;
    z-index: 10002; 
    background: var(--bg-primary);
}

.video-prompt-edit-modal .modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 20px 24px;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}

.video-prompt-edit-modal .modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.video-prompt-edit-modal .modal-body {
    padding: 24px;
    max-height: calc(60vh); 
    overflow-y: auto;
}

.video-prompt-edit-modal .modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 16px 24px;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
}

.video-prompt-edit-modal .btn-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s ease;
    opacity: 1;
}

.video-prompt-edit-modal .btn-close:hover {
    color: var(--text-primary);
    opacity: 1;
}

/* Специфичные стили для формы в модальном окне */
body .video-prompt-edit-modal .form-control {
    background-color: var(--bg-secondary);
    border: 2px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 8px;
    transition: var(--vm-transition);
}

body .video-prompt-edit-modal .form-control:focus {
    background-color: var(--bg-secondary);
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 0.25rem rgba(99, 102, 241, 0.25);
    outline: none;
    color: var(--text-primary);
}

body .video-prompt-edit-modal .form-label {
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 8px;
}

.video-prompt-edit-modal .settings-display {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.video-prompt-edit-modal .settings-display .badge {
    font-size: 0.8rem;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 500;
}

@media (max-width: 768px) {
    .video-prompt-edit-modal {
        padding: 15px; 
        align-items: center; 
    }
    
    .video-prompt-edit-modal .modal-dialog {
        transform: translateY(-2.5rem); 
    }
    
    .video-prompt-edit-modal .modal-dialog {
        max-width: 95%;
        margin: 0 auto;
    }
    
    .video-prompt-edit-modal .modal-content {
        max-height: calc(100vh - 30px); 
        border-radius: 8px;
    }
    
    .video-prompt-edit-modal .modal-header,
    .video-prompt-edit-modal .modal-body,
    .video-prompt-edit-modal .modal-footer {
        padding: 16px;
    }
    
    .video-prompt-edit-modal .modal-body {
        max-height: calc(70vh); 
    }
}

@media (max-width: 480px) {
    .video-prompt-edit-modal {
        padding: 10px; 
    }
    
    .video-prompt-edit-modal .modal-dialog {
        transform: translateY(-1.5rem); 
    }
    
    .video-prompt-edit-modal .modal-dialog {
        max-width: 98%;
    }
    
    .video-prompt-edit-modal .modal-content {
        max-height: calc(100vh - 100px);
    }
    
    .video-prompt-edit-modal .modal-body {
        max-height: calc(40vh);
    }
}

.settings-display .badge.bg-info {
    background-color: #1a1a1a;
    color: var(--text-primary);
    border: 1px solid #333333;
    font-size: 0.8rem;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.3s ease;
}
.settings-display .badge.bg-info:hover {
    background-color: #2a2a2a;
    border-color: #ff6b35;
}

.collapsible-section {
    transition: var(--vm-transition);
    overflow: hidden;
    margin-top: 2px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    cursor: pointer;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: var(--vm-transition);
    margin-bottom: 8px;
}

.section-header:hover {
    background: var(--bg-hover);
    border-color: var(--storyboard-border-active);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--storyboard-hover-shadow);
}

.section-header .form-label {
    margin: 0;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-toggle-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--vm-transition);
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.section-toggle-btn:hover {
    color: var(--text-primary);
    background: var(--bg-primary);
    transform: scale(1.1);
}

.model-section-header {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 16px;
    cursor: pointer;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: var(--vm-transition);
    margin-bottom: 8px;
    margin-top: 20px;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
    width: 100%;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.model-section-header:hover {
    background: var(--bg-hover);
    border-color: #ff6b35;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
}

.model-section-header.expanded {
    background: var(--bg-hover);
    border-color: #ff6b35;
}

/* Fix for Chromium button rendering issues */
button.model-section-header {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    outline: none;
    box-sizing: border-box;
}

button.model-section-header:focus {
    outline: none;
}

button.model-section-header:active {
    transform: translateY(0);
}

.section-toggle-btn i {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.section-toggle-btn.expanded i {
    transform: rotate(180deg);
}

.model-toggle-unified {
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    cursor: pointer;
    transition: var(--vm-transition);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 2px;
    width: 100%;
}

.model-toggle-unified:hover {
    border-color: #ff6b35;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
}

.section-content {
    transform-origin: top;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    position: relative;
    z-index: 1;
    margin-top: 4px;
}

.section-content.collapsed {
    transform: scaleY(0);
    opacity: 0;
    pointer-events: none;
    height: 0;
    min-height: 0;
}

.section-content.expanded {
    transform: scaleY(1);
    opacity: 1;
    pointer-events: auto;
    height: auto;
    z-index: 100;
    overflow: visible;
    padding: 4px 0;
}

.model-selection-collapsed,
.resolution-selection-collapsed {
    background: var(--grad-gray-primary);
    border: 1px solid #5a5a5a;
    color: #ffffff;
    padding: 16px 20px;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    font-size: 1rem;
    position: relative;
    overflow: hidden;
    transition: var(--vm-transition);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    margin: 8px 0;
    cursor: pointer;
}

.model-selection-collapsed::before,
.resolution-selection-collapsed::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--grad-shine);
    transition: left 0.5s ease;
    animation: silverShineLoop 3s ease-in-out infinite;
}

@keyframes silverShineLoop {
    0%, 80% {
        left: -100%;
    }
    20%, 60% {
        left: 100%;
    }
}

.model-selection-collapsed:hover,
.resolution-selection-collapsed:hover {
    background: var(--grad-gray-hover);
    border-color: #6a6a6a;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    transform: translateY(-2px);
}

.model-selection-collapsed:hover::before,
.resolution-selection-collapsed:hover::before {
    left: 100%;
}

.collapsed-value {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.collapsed-value .vm-icon {
    font-size: 1.2rem;
    opacity: 0.9;
}

.collapsed-model-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.collapsed-model-name {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.collapsed-model-description {
    font-size: 0.85rem;
    opacity: 0.8;
    font-weight: 400;
}

.collapsed-resolution-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.collapsed-resolution-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.collapsed-resolution-rect {
    background: var(--nav-icon-color);
    border-radius: 2px;
    opacity: 0.9;
    transition: all 0.3s ease;
}

.collapsed-resolution-rect.aspect-16-9 {
    width: 24px;
    height: 14px;
}

.collapsed-resolution-rect.aspect-9-16 {
    width: 14px;
    height: 24px;
}

.collapsed-resolution-rect.aspect-1-1 {
    width: 20px;
    height: 20px;
}

.collapsed-resolution-rect.aspect-4-3 {
    width: 24px;
    height: 18px;
}

.collapsed-resolution-rect.aspect-3-4 {
    width: 18px;
    height: 24px;
}

.model-selection-collapsed:hover .collapsed-resolution-rect,
.resolution-selection-collapsed:hover .collapsed-resolution-rect {
    background: var(--nav-icon-color);
    opacity: 1;
    transform: scale(1.1);
}

.collapsed-resolution-name {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.2;
}

.collapsed-resolution-specs {
    font-size: 0.8rem;
    opacity: 0.8;
    font-weight: 400;
}

@media (max-width: 768px) {
    .section-header {
        padding: 10px 14px;
    }
    
    .model-selection-collapsed,
    .resolution-selection-collapsed {
        padding: 14px 16px;
        font-size: 0.95rem;
    }
    
    .collapsed-model-name {
        font-size: 1rem;
    }
    
    .collapsed-model-description {
        font-size: 0.8rem;
    }
    
    .collapsed-value {
        gap: 8px;
    }
    
    .collapsed-value .vm-icon {
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    .section-header {
        padding: 8px 12px;
    }
    
    .model-selection-collapsed,
    .resolution-selection-collapsed {
        padding: 12px 14px;
        font-size: 0.9rem;
    }
    
    .collapsed-model-info {
        gap: 2px;
    }
    
    .collapsed-resolution-info {
        gap: 8px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .section-content,
    .section-header,
    .section-toggle-btn,
    .model-selection-collapsed,
    .resolution-selection-collapsed {
        transition: none;
        animation: none;
    }
    
    .model-selection-collapsed::before,
    .resolution-selection-collapsed::before {
        animation: none;
    }
    
    .section-toggle-btn.expanded i {
        transform: none;
    }
}

@media (prefers-contrast: high) {
    .section-header {
        border-width: 2px;
    }
    
    .model-selection-collapsed,
    .resolution-selection-collapsed {
        border-width: 2px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }
}

.modal {
    z-index: 10000; 
}

.modal-backdrop {
    z-index: 9990; 
}

.modal.fade.show {
    z-index: var(--z-overlay);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.modal-dialog-centered {
    display: flex;
    align-items: center;
    min-height: calc(100vh - 2rem);
    margin: 1rem auto;
}

.modal-content {
    position: relative;
    z-index: calc(var(--z-overlay) + 10);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.video-prompt-edit-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center; 
    justify-content: center;
    z-index: 10000;
    padding: 20px;
    overflow-y: auto;
    box-sizing: border-box;
}

.video-prompt-edit-modal .modal-dialog {
    margin: 0;
    max-width: 600px;
    width: 100%;
    z-index: 10001; 
    transform: translateY(-4rem); 
}

.video-prompt-edit-modal .modal-content {
    max-height: calc(100vh - 40px); 
    overflow-y: auto;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.8); 
    border: none;
    border-radius: 12px;
    position: relative;
    z-index: 10002; 
    background: var(--bg-primary);
}

.video-prompt-edit-modal .modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 20px 24px;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}

.video-prompt-edit-modal .modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.video-prompt-edit-modal .modal-body {
    padding: 24px;
    max-height: calc(60vh); 
    overflow-y: auto;
}

.video-prompt-edit-modal .modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 16px 24px;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
}

.video-prompt-edit-modal .btn-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s ease;
    opacity: 1;
}

.video-prompt-edit-modal .btn-close:hover {
    color: var(--text-primary);
    opacity: 1;
}

.video-prompt-edit-modal .settings-display {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.video-prompt-edit-modal .settings-display .badge {
    font-size: 0.8rem;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 500;
}

@media (max-width: 768px) {
    .video-prompt-edit-modal {
        padding: 15px; 
        align-items: center; 
    }
    
    .video-prompt-edit-modal .modal-dialog {
        transform: translateY(-2.5rem); 
    }
    
    .video-prompt-edit-modal .modal-dialog {
        max-width: 95%;
        margin: 0 auto;
    }
    
    .video-prompt-edit-modal .modal-content {
        max-height: calc(100vh - 30px); 
        border-radius: 8px;
    }
    
    .video-prompt-edit-modal .modal-header,
    .video-prompt-edit-modal .modal-body,
    .video-prompt-edit-modal .modal-footer {
        padding: 16px;
    }
    
    .video-prompt-edit-modal .modal-body {
        max-height: calc(70vh); 
    }
}

@media (max-width: 480px) {
    .video-prompt-edit-modal {
        padding: 10px; 
    }
    
    .video-prompt-edit-modal .modal-dialog {
        transform: translateY(-1.5rem); 
    }
    
    .video-prompt-edit-modal .modal-dialog {
        max-width: 98%;
    }
    
    .video-prompt-edit-modal .modal-content {
        max-height: calc(100vh - 100px);
    }
    
    .video-prompt-edit-modal .modal-body {
        max-height: calc(40vh);
    }
}



.scene-modal-unified {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center; 
    justify-content: center;
    z-index: 100000;
    padding: 20px 5%;
    overflow-y: auto;
    box-sizing: border-box;
}

.scene-modal-unified .modal-dialog {
    margin: 0 auto;
    max-width: 600px;
    width: 90%;
    z-index: 100001; 
    transform: translateY(-4rem); 
}

/* Более специфичный селектор для переопределения Bootstrap */
.scene-modal-unified .modal-dialog.modal-dialog-centered {
    margin: 0 auto;
    width: 90%;
    max-width: 600px;
    display: flex;
    align-items: center;
    min-height: calc(100% - 1rem);
    justify-content: center;
    z-index: 100001;
}

.scene-modal-unified .modal-content {
    max-height: calc(100vh - 40px); 
    overflow-y: auto;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.8); 
    border: none;
    border-radius: 12px;
    position: relative;
    z-index: 100002; 
    background: var(--bg-primary);
}

.scene-modal-unified .modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 20px 24px;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}

.scene-modal-unified .modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.scene-modal-unified .modal-body {
    padding: 24px;
    max-height: calc(60vh); 
    overflow-y: auto;
}

.scene-modal-unified .modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 16px 24px;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
}

.scene-modal-unified .btn-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s ease;
    opacity: 1;
}

.scene-modal-unified .btn-close:hover {
    color: var(--text-primary);
    opacity: 1;
}

.scene-modal-unified .form-control {
    background-color: var(--bg-secondary);
    border: 2px solid #333333;
    color: var(--text-primary);
    border-radius: 8px;
    transition: border-color 0.3s ease;
}

.scene-modal-unified .form-control:hover {
    border-color: #ff6b35;
}

.scene-modal-unified .form-control:focus {
    background-color: var(--bg-secondary);
    border-color: #ff6b35;
    box-shadow: none;
    outline: none;
    color: var(--text-primary);
}

.scene-modal-unified .form-label {
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 8px;
}

.scene-modal-unified .settings-display {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
    justify-content: center;
}

.scene-modal-unified .settings-display .badge {
    font-size: 0.8rem;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 500;
}

@media (max-width: 768px) {
    .scene-modal-unified {
        padding: 15px; 
        align-items: center; 
    }
    
    .scene-modal-unified .modal-dialog {
        transform: translateY(-2.5rem); 
        max-width: 95%;
        margin: 0 auto;
    }
    
    .scene-modal-unified .modal-content {
        max-height: calc(100vh - 30px); 
        border-radius: 8px;
    }
    
    .scene-modal-unified .modal-header,
    .scene-modal-unified .modal-body,
    .scene-modal-unified .modal-footer {
        padding: 16px;
    }
    
    .scene-modal-unified .modal-body {
        max-height: calc(70vh); 
    }
}

@media (max-width: 480px) {
    .scene-modal-unified {
        padding: 10px; 
    }
    
    .scene-modal-unified .modal-dialog {
        transform: translateY(-1.5rem); 
        max-width: 98%;
    }
    
    .scene-modal-unified .modal-content {
        max-height: calc(100vh - 100px);
    }
    
    .scene-modal-unified .modal-body {
        max-height: calc(40vh);
    }
}

.flip-number {
    display: inline-block;
    font-size: 2.5rem;
    font-weight: 700;
    transition: transform 0.6s ease;
    perspective: 1000px;
    will-change: transform;
}

.flip-number.flip {
    transform: rotateX(360deg);
}

.slot-image-controls {
    position: absolute;
    bottom: 8px;
    right: 8px;
    display: flex;
    gap: 8px;
    z-index: 10;
}

.slot-image-controls .btn {
    background: rgba(42, 42, 53, 0.9);
    border: none;
    color: white;
    padding: 6px 10px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.slot-image-controls .btn:hover {
    background: rgba(42, 42, 53, 1);
    transform: scale(1.1);
    box-shadow: var(--vm-shadow-md);
}

.slot-image-controls .btn i {
    font-size: 16px;
}

.download-actions-compact {
    position: relative;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-top: 20px;
    z-index: 10;
}

.btn-click-here {
    background: var(--nav-icon-color);
    color: #000000;
    border: none;
    border-radius: 8px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn-click-here:hover {
    background: hsl(17, 100%, 68%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.btn-click-here:active {
    transform: translateY(0);
}

.click-here-text {
    font-size: 14px;
    font-weight: 500;
}

.btn-click-here .vm-icon-expand {
    transition: transform 0.3s ease;
}

.btn-click-here .vm-icon-expand.rotated {
    transform: rotate(180deg);
}

.download-menu {
    position: absolute;
    top: 0;
    right: 160px;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    min-width: auto;
    max-width: none;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateX(50px) translateY(0);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    backdrop-filter: none;
    padding: 0;
    display: flex;
    flex-direction: row;
    gap: 12px;
    align-items: center;
    justify-content: flex-end;
}

.download-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateX(0) translateY(0);
}

.download-menu-button {
    background: var(--nav-icon-color);
    color: #000000;
    border: none;
    border-radius: 8px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    margin: 0;
    white-space: nowrap;
}

.download-menu-button:hover:not(:disabled) {
    background: hsl(17, 100%, 68%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.download-menu-button:active:not(:disabled) {
    transform: translateY(0);
}

.download-menu-button:disabled,
.download-menu-button.disabled {
    background: #666666;
    color: #000000;
    cursor: not-allowed;
    opacity: 0.6;
}

.download-menu-button .download-button-text {
    flex: 1;
    margin-left: 4px;
    font-weight: 500;
}

.download-menu-button .download-button-count {
    margin-left: 4px;
    font-size: 12px;
    opacity: 0.8;
    font-weight: 400;
}

.download-menu-button:hover:not(:disabled) .download-button-count {
    opacity: 1;
    transform: scale(1.05);
}

@media (max-width: 768px) {
    .download-actions-compact {
        justify-content: center;
        margin-top: 16px;
    }
    
    .download-menu {
        top: 100%;
        right: 0;
        transform: translateX(0) translateY(-10px);
        min-width: 300px;
        max-width: 90vw;
        margin-right: 0;
        margin-top: 8px;
        flex-direction: column;
        gap: 12px;
    }
    
    .download-menu.open {
        transform: translateX(0) translateY(0);
    }
    
    .download-menu-button {
        font-size: 14px;
        padding: 14px 18px;
        min-height: 52px;
        flex: none;
        width: 100%;
    }
}

@media (max-width: 1024px) and (min-width: 769px) {
    .download-menu {
        right: 140px;
    }
    
    .download-menu-button {
        font-size: 13px;
        padding: 10px 14px;
    }
}

.success-message {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    border: 1px solid #45a049;
    border-radius: 12px;
    padding: 30px;
    text-align: center;
    margin: 20px 0;
    color: white;
    box-shadow: 0 8px 32px rgba(76, 175, 80, 0.3);
}

.success-icon {
    font-size: 48px;
    color: white;
    margin-bottom: 16px;
    display: block;
}

.success-message h3 {
    margin: 0 0 12px 0;
    font-size: 24px;
    font-weight: 600;
}

.success-message p {
    margin: 0;
    font-size: 16px;
    opacity: 0.9;
    line-height: 1.5;
}

.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0.9;
        transform: translateY(-3px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.error-page-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    width: 100%;
    padding: 2rem;
}

/* Стили для состояния проверки авторизации */
.auth-checking-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
    width: 100%;
    padding: 2rem;
}

.auth-checking-content {
    text-align: center;
    padding: 3rem;
}

.auth-checking-content .spinner-border {
    width: 3rem;
    height: 3rem;
    border-width: 0.3rem;
}

.auth-checking-content p {
    margin-top: 1.5rem;
    font-size: 1.1rem;
    color: #6c757d;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.6;
    }
    50% {
        opacity: 1;
    }
}

.error-content {
    text-align: center;
    max-width: 500px;
}

.error-content .error-icon {
    font-size: 4rem;
    color: #ffc107;
    display: block;
    margin-bottom: 1.5rem;
}

.error-content h2 {
    color: white;
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.error-content p {
    color: #9ca3af;
    font-size: 1.1rem;
    margin-bottom: 2rem;
    line-height: 1.6;
}

.error-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.error-actions .btn {
    min-width: 160px;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

.error-actions .btn-primary {
    background: var(--grad-orange-dark);
    border: none;
    color: white;
    font-weight: 500;
}

.error-actions .btn-primary:hover {
    background: var(--grad-orange-dark);
}

.error-actions .btn-outline-secondary {
    background: transparent;
    border: 1px solid #4b5563;
    color: #9ca3af;
}

.error-actions .btn-outline-secondary:hover {
    background: rgba(75, 85, 99, 0.2);
    color: white;
    border-color: #6b7280;
}

.scene-modal-unified .badge-style-select {
    background-color: #1a1a1a;
    border: 2px solid #333333;
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.8rem;
    font-weight: 500;
    padding: 6px 36px 6px 12px;
    appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg fill="%23ffffff" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 14px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.scene-modal-unified .badge-style-select:focus {
    background-color: #ff6b35;
    border-color: #ff6b35;
    background-image: url('data:image/svg+xml;utf8,<svg fill="%23ffffff" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>');
    box-shadow: 0 0 0 0.25rem rgba(255, 107, 53, 0.25);
    outline: none;
    color: white;
}
.scene-modal-unified .badge-style-select:hover {
    background-color: #2a2a2a;
    border-color: #ff6b35;
}

.scene-modal-unified .badge-style-select option {
    background-color: #1a1a1a;
    color: var(--text-primary);
    padding: 8px 12px;
    border: none;
}

.scene-modal-unified .badge-style-select option:hover,
.scene-modal-unified .badge-style-select option:focus,
.scene-modal-unified .badge-style-select option:checked {
    background-color: #ff6b35;
    color: white;
}

.badge.bg-gray-neutral {
    background-color: #1a1a1a;
    color: var(--text-primary);
    font-size: 0.8rem;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 500;
    border: 1px solid #333333;
    transition: all 0.3s ease;
}
.badge.bg-gray-neutral:hover {
    background-color: #2a2a2a;
    border-color: #ff6b35;
    color: var(--text-primary);
}
.badge.bg-gray-neutral.active {
    background-color: #ff6b35;
    border-color: #ff6b35;
    color: white;
}

:root {
    --dropdown-bg-dark: #1a1a1a;
    --dropdown-text-light: #ffffff;
    --dropdown-border-dark: #333333;
    --dropdown-hover-accent: #ff6b35;
    --dropdown-focus-shadow: rgba(255, 107, 53, 0.25);
}

.scene-modal-unified .modal-dialog .modal-content .modal-body select#video-model-select.form-select.badge-style-select {
    background-color: var(--dropdown-bg-dark);
    background-image: url('data:image/svg+xml;utf8,<svg fill="%23ffffff" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 14px;
    border: 2px solid var(--dropdown-border-dark);
    border-radius: 6px;
    color: var(--dropdown-text-light);
    font-size: 0.8rem;
    font-weight: 500;
    padding: 6px 36px 6px 12px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    transition: all 0.3s ease;
    cursor: pointer;
}

.scene-modal-unified .modal-dialog .modal-content .modal-body select#video-model-select.form-select.badge-style-select:focus {
    background-color: var(--dropdown-hover-accent);
    border-color: var(--dropdown-hover-accent);
    color: var(--dropdown-text-light);
    box-shadow: 0 0 0 0.25rem var(--dropdown-focus-shadow);
    outline: none;
}

.scene-modal-unified .modal-dialog .modal-content .modal-body select#video-model-select.form-select.badge-style-select:hover {
    background-color: #2a2a2a;
    border-color: var(--dropdown-hover-accent);
    color: var(--dropdown-text-light);
}

.scene-modal-unified .modal-dialog .modal-content .modal-body select#video-model-select.form-select.badge-style-select option {
    background-color: var(--dropdown-bg-dark);
    color: var(--dropdown-text-light);
    padding: 8px 12px;
    border: none;
}

/* Центрирование секции выбора модели видео */
.scene-modal-unified .mb-3:has(select#video-model-select) {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.scene-modal-unified .mb-3:has(select#video-model-select) .form-label {
    width: 100%;
    text-align: center;
    margin-bottom: 12px;
}

.scene-modal-unified .mb-3:has(select#video-model-select) select#video-model-select {
    width: 100%;
    margin: 0;
    text-align: center;
    text-align-last: center;
}

/* Альтернативное решение для браузеров, не поддерживающих :has */
@supports not selector(:has(*)) {
    .scene-modal-unified .modal-body .mb-3 .form-label[for="video-model-select"] {
        text-align: center;
        width: 100%;
        display: block;
    }
    
    .scene-modal-unified .modal-body .mb-3:nth-child(2) {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .scene-modal-unified .modal-body .mb-3:nth-child(2) select#video-model-select {
        width: 100%;
        margin: 0;
        text-align: center;
        text-align-last: center;
    }
}

/* Общие стили для выровненных селектов в модальном окне */
.scene-modal-unified select.form-select.w-100 {
    width: 100%;
    margin: 0;
    display: block;
    text-align: center;
    text-align-last: center;
}

/* Лейблы для селектов */
.scene-modal-unified .form-label {
    display: block;
    width: 100%;
}

/* Дополнительное центрирование для контейнеров с селектами */
.scene-modal-unified .modal-body .mb-3 {
    display: flex;
    flex-direction: column;
    width: 100%;
}

/* Мобильные стили для центрированных селектов */
@media (max-width: 768px) {
    .scene-modal-unified select.form-select.w-100,
    .scene-modal-unified select#video-model-select {
        max-width: 95%;
        width: 95%;
        font-size: 0.85rem;
    }
    
    .scene-modal-unified .form-label {
        font-size: 0.9rem;
        margin-bottom: 10px;
    }
}

@media (max-width: 480px) {
    .scene-modal-unified select.form-select.w-100,
    .scene-modal-unified select#video-model-select {
        max-width: 100%;
        width: 100%;
        font-size: 0.8rem;
        padding: 8px 32px 8px 10px;
    }
    
    .scene-modal-unified .form-label {
        font-size: 0.85rem;
        margin-bottom: 8px;
    }
}

body .scene-modal-unified .modal-dialog .modal-content .modal-body div.mb-3 select#video-model-select.form-select.badge-style-select {
    width: 100%;
    margin: 0;
    display: block;
    text-align: center;
    text-align-last: center;
}

body .scene-modal-unified .modal-dialog .modal-content .modal-body div.mb-3:has(select#video-model-select) {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.scene-modal-unified .modal-dialog .modal-content .modal-body select#video-model-select.form-select.badge-style-select {
    width: 100%;
    margin: 0;
    display: block;
    text-align: center;
    text-align-last: center;
}

.scene-modal-unified .modal-dialog .modal-content .modal-body .form-label[for="video-model-select"] {
    text-align: center;
    display: block;
    width: 100%;
    margin-bottom: 12px;
}

/* Приоритетное центрирование контейнера */
.scene-modal-unified .modal-dialog .modal-content .modal-body .mb-3:has(.form-label[for="video-model-select"]) {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
}

@supports (-webkit-appearance: none) {
    .scene-modal-unified select.badge-style-select {
        background-color: var(--dropdown-bg-dark);
        color: var(--dropdown-text-light);
    }
    
    .scene-modal-unified select.badge-style-select option {
        background-color: var(--dropdown-bg-dark);
        color: var(--dropdown-text-light);
    }
}

@-moz-document url-prefix() {
    .scene-modal-unified .badge-style-select {
        background-color: var(--dropdown-bg-dark);
        color: var(--dropdown-text-light);
        padding-right: 30px;
        background-position: right 8px center;
        background-size: 12px;
    }
    
    .scene-modal-unified .badge-style-select option {
        background-color: var(--dropdown-bg-dark);
        color: var(--dropdown-text-light);
    }
}

select#video-model-select {
    background-color: var(--dropdown-bg-dark);
    color: var(--dropdown-text-light);
    border: 2px solid var(--dropdown-border-dark);
}

select#video-model-select:focus {
    background-color: var(--dropdown-hover-accent);
    border-color: var(--dropdown-hover-accent);
    color: var(--dropdown-text-light);
    box-shadow: 0 0 0 0.25rem var(--dropdown-focus-shadow);
}

select#video-model-select:hover {
    background-color: #2a2a2a;
    border-color: var(--dropdown-hover-accent);
}

:root {
    --select-bg: #1a1a1a;
    --select-text: #ffffff;
    --select-border: #333333;
    --select-hover-bg: #2a2a2a;
    --select-focus-bg: #ff6b35;
}

body .scene-modal-unified .badge-style-select {
    background-color: var(--select-bg);
    color: var(--select-text);
    border: 2px solid var(--select-border);
    border-radius: 6px;
    padding: 6px 36px 6px 12px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg fill="%23ffffff" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 14px;
    transition: all 0.3s ease;
}

body .scene-modal-unified .badge-style-select:hover {
    background-color: var(--select-hover-bg);
    border-color: var(--select-focus-bg);
}

body .scene-modal-unified .badge-style-select:focus {
    background-color: var(--select-focus-bg);
    border-color: var(--select-focus-bg);
    box-shadow: 0 0 0 0.25rem rgba(255, 107, 53, 0.25);
    outline: none;
}

body .scene-modal-unified .badge-style-select option {
    background-color: var(--select-bg);
    color: var(--select-text);
    padding: 8px 12px;
    border: none;
}

body .scene-modal-unified .badge-style-select option:checked {
    background-color: var(--select-focus-bg);
    color: white;
}

body .scene-modal-unified .badge-style-select option:hover {
    background-color: var(--select-hover-bg);
}

@media screen {
    .scene-modal-unified select.badge-style-select,
    .scene-modal-unified #video-model-select {
        background: var(--select-bg);
        color: var(--select-text);
    }
    
    .scene-modal-unified select.badge-style-select option,
    .scene-modal-unified #video-model-select option {
        background: var(--select-bg);
        color: var(--select-text);
    }
}

@supports (-webkit-appearance: none) {
    .scene-modal-unified .badge-style-select {
        background: var(--select-bg);
        color: var(--select-text);
    }
}

@-moz-document url-prefix() {
    .scene-modal-unified .badge-style-select {
        background-color: var(--select-bg);
        color: var(--select-text);
    }
    
    .scene-modal-unified .badge-style-select option {
        background-color: var(--select-bg);
        color: var(--select-text);
    }
}

/* Image overlay click handling - allow clicks through overlay to image */
.result-image-container .image-overlay {
    pointer-events: none;
}

.result-image-container .image-overlay .btn {
    pointer-events: auto;
}

/* Duration buttons grid styles for GPT mode selection */
.duration-buttons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min-content, 1fr));
    gap: 8px;
    width: 100%;
    margin-bottom: 8px;
}

.duration-buttons-grid .btn-orange {
    white-space: nowrap;
    min-width: min-content;
}


/* Адаптивные стили для узких экранов */
@media (max-width: 768px) {
    .duration-buttons-grid {
        grid-template-columns: 1fr;
        gap: 6px;
    }
    
}

@media (max-width: 480px) {
    .storyboard-dashboard {
        --storyboard-dashboard-width: 100%;
        min-width: 100%;
        max-width: 100%;
    }

    .storyboard-dashboard-wrapper {
        min-width: 100%;
        max-width: 100%;
    }
}
