/* Video Animation Page Styles */

/* Main Container */
.video-page-container {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
    padding: 20px;
    max-width: 1800px;
    margin: 0 auto;
    background: #000;
    min-height: calc(100vh - 200px);
}

/* Panel Styles */
.left-panel,
.middle-panel,
.right-panel {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 20px;
    overflow-y: auto;
    max-height: calc(100vh - 240px);
}

.left-panel h2,
.middle-panel h2,
.right-panel h2 {
    color: #ff9000;
    font-size: 1.5rem;
    margin-bottom: 15px;
    border-bottom: 2px solid #b20089;
    padding-bottom: 10px;
}

.panel-description {
    color: #999;
    font-size: 0.9rem;
    margin-bottom: 15px;
}

/* Selected Image Preview */
.selected-image-preview {
    width: 100%;
    margin-bottom: 20px;
    background: #000;
    border: 2px solid #333;
    border-radius: 8px;
    padding: 10px;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.selected-image-preview img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 4px;
}

#noImageMessage {
    color: #666;
    text-align: center;
    font-style: italic;
}

/* Upload Section */
.upload-section {
    margin-bottom: 20px;
}

.upload-button {
    display: inline-block;
    padding: 10px 20px;
    background: linear-gradient(135deg, #b20089, #ff9000);
    color: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    text-align: center;
    transition: transform 0.2s;
}

.upload-button:hover {
    transform: scale(1.05);
}

/* Form Styles */
.form-group {
    margin-bottom: 15px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.form-group label {
    display: block;
    color: #ff9000;
    font-weight: bold;
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 8px;
    background: #000;
    border: 1px solid #333;
    border-radius: 4px;
    color: #fff;
    font-size: 0.9rem;
}

.form-group small {
    display: block;
    color: #666;
    font-size: 0.8rem;
    margin-top: 3px;
}

/* LoRA Slot Styling */
.lora-slot {
    display: grid;
    grid-template-columns: auto auto 1fr auto auto;
    gap: 8px;
    align-items: center;
    padding: 8px;
    background: #0a0a0a;
    border: 1px solid #333;
    border-radius: 4px;
    margin-bottom: 8px;
}

.lora-slot input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.lora-slot label {
    color: #ff9000;
    font-size: 0.85rem;
    margin: 0;
    white-space: nowrap;
}

.lora-slot select {
    padding: 4px 8px;
    background: #000;
    border: 1px solid #444;
    border-radius: 4px;
    color: #fff;
    font-size: 0.85rem;
    min-width: 140px;
}

.lora-slot select option {
    background: #000;
    color: #fff;
}

.lora-slot input[type="number"] {
    width: 70px;
    padding: 4px 6px;
    background: #000;
    border: 1px solid #444;
    border-radius: 4px;
    color: #fff;
    font-size: 0.85rem;
}

.lora-slot:has(input[type="checkbox"]:not(:checked)) select,
.lora-slot:has(input[type="checkbox"]:not(:checked)) input[type="number"] {
    opacity: 0.4;
    pointer-events: none;
}

.generate-button {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #b20089, #ff9000);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s;
}

.generate-button:hover:not(:disabled) {
    transform: scale(1.02);
}

.generate-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Loading Indicator */
#loadingIndicator {
    text-align: center;
    padding: 20px;
    margin-top: 20px;
}

.loader {
    border: 5px solid #333;
    border-top: 5px solid #ff9000;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#loadingIndicator p {
    color: #ff9000;
    font-size: 0.9rem;
}

/* Error/Success Messages */
.error-message {
    padding: 12px;
    margin-top: 15px;
    border-radius: 6px;
    background: #ff0000;
    color: #fff;
    font-size: 0.9rem;
}

.success-message {
    padding: 12px;
    margin-top: 15px;
    border-radius: 6px;
    background: #00ff00;
    color: #000;
    font-weight: bold;
    font-size: 0.9rem;
}

/* Source Images Grid */
.source-images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}

.source-image-card {
    position: relative;
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 6px;
    overflow: hidden;
    transition: all 0.2s;
    background: #1a1a1a;
}

.source-image-card:hover {
    border-color: #ff9000;
    transform: translateY(-2px);
}

.source-image-card.selected {
    border-color: #00ff00;
}

.source-image-card img {
    width: 100%;
    height: auto;
    object-fit: contain;
    display: block;
    max-height: 300px;
}

.source-image-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.8);
    padding: 5px;
    text-align: center;
}

.video-count {
    color: #ff9000;
    font-size: 0.85rem;
    font-weight: bold;
}

.empty-message {
    color: #666;
    text-align: center;
    font-style: italic;
    padding: 40px 20px;
    grid-column: 1 / -1;
}

/* Video Cards */
.videos-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

.video-card {
    background: #000;
    border: 1px solid #333;
    border-radius: 6px;
    padding: 10px;
    cursor: move;
    transition: all 0.2s;
}

.video-card:hover {
    border-color: #ff9000;
    transform: translateY(-2px);
}

.video-thumbnail {
    width: 100%;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
    background: #1a1a1a;
    max-height: 400px;
}

.video-info {
    margin-top: 10px;
}

.video-prompt {
    color: #fff;
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.clickable-prompt {
    cursor: pointer;
    padding: 4px;
    border-radius: 3px;
    transition: background 0.2s;
}

.clickable-prompt:hover {
    background: #2a2a2a;
    color: #ff9000;
}

.video-loras {
    color: #b20089;
    font-size: 0.8rem;
    margin-top: 5px;
    padding: 4px;
    border-radius: 3px;
    background: #1a1a1a;
    border: 1px solid #333;
}

.clickable-loras {
    cursor: pointer;
    transition: all 0.2s;
}

.clickable-loras:hover {
    background: #2a2a2a;
    border-color: #b20089;
    transform: translateX(2px);
}

.video-loras strong {
    color: #ff9000;
}

.video-details {
    color: #999;
    font-size: 0.8rem;
}

.video-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.video-action-button {
    flex: 1;
    padding: 6px 12px;
    background: #333;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s;
}

.video-action-button:hover {
    background: #ff9000;
}

.video-action-button.delete-button:hover {
    background: #ff0000;
}

/* Frames Grid */
#framesSection {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #333;
}

.frames-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    margin-top: 15px;
}

/* Video Player Modal */
.video-modal-content {
    max-width: 90vw;
    max-height: 90vh;
    background: #000;
    border: 2px solid #ff9000;
}

.video-modal-content video {
    width: 100%;
    height: auto;
    max-height: 70vh;
}

.video-controls {
    display: flex;
    gap: 15px;
    padding: 15px;
    background: #1a1a1a;
    justify-content: center;
}

.download-button,
.extract-button {
    padding: 10px 20px;
    background: linear-gradient(135deg, #b20089, #ff9000);
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: transform 0.2s;
}

.download-button:hover,
.extract-button:hover {
    transform: scale(1.05);
}

/* Frame Extractor Modal */
.frame-extractor-content {
    max-width: 800px;
    background: #1a1a1a;
    border: 2px solid #ff9000;
    padding: 20px;
}

.frame-extractor-content h3 {
    color: #ff9000;
    margin-bottom: 15px;
}

.frame-extractor-content video {
    width: 100%;
    height: auto;
    margin-bottom: 15px;
}

.frame-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.frame-controls label {
    color: #fff;
    font-weight: bold;
}

.frame-controls input {
    flex: 1;
    padding: 8px;
    background: #000;
    border: 1px solid #333;
    border-radius: 4px;
    color: #fff;
}

.extract-frame-button {
    padding: 10px 20px;
    background: linear-gradient(135deg, #b20089, #ff9000);
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    white-space: nowrap;
}

.extract-frame-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Timeline Container */
.timeline-container {
    background: #1a1a1a;
    border: 2px solid #333;
    border-radius: 8px;
    padding: 20px;
    margin: 20px;
    max-width: 1800px;
    margin-left: auto;
    margin-right: auto;
}

.timeline-container h2 {
    color: #ff9000;
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.timeline-description {
    color: #999;
    font-size: 0.9rem;
    margin-bottom: 15px;
}

/* Timeline Controls */
.timeline-controls {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.timeline-button {
    padding: 10px 20px;
    background: #333;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.2s;
}

.timeline-button:hover {
    background: #ff9000;
}

.export-button {
    background: linear-gradient(135deg, #b20089, #ff9000) !important;
    font-size: 1.05rem;
}

.export-button:hover {
    background: linear-gradient(135deg, #ff9000, #b20089) !important;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(178, 0, 137, 0.4);
}

.feeds-dropdown {
    padding: 10px;
    background: #000;
    color: #fff;
    border: 1px solid #333;
    border-radius: 6px;
    cursor: pointer;
    flex: 1;
    max-width: 300px;
}

/* Timeline Drop Zone */
.timeline-drop-zone {
    min-height: 150px;
    background: #000;
    border: 2px dashed #333;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    gap: 15px;
    overflow-x: auto;
    align-items: center;
}

.timeline-drop-zone.drag-over {
    border-color: #ff9000;
    background: #1a1a1a;
}

.drop-hint {
    color: #666;
    text-align: center;
    width: 100%;
    font-style: italic;
}

/* Timeline Video Cards */
.timeline-video-card {
    position: relative;
    min-width: 160px;
    height: 140px;
    border: 2px solid #333;
    border-radius: 6px;
    overflow: visible;
    cursor: move;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
}

.timeline-video-card:hover {
    border-color: #ff9000;
    transform: scale(1.05);
    z-index: 10;
}

.timeline-video-card.dragging {
    opacity: 0.4;
    transform: scale(0.95) rotate(2deg);
    cursor: grabbing;
}

.timeline-video-card.drag-over-target {
    border-color: #00ff00;
    background: rgba(0, 255, 0, 0.1);
    transform: scale(1.08);
}

.timeline-video-card.insert-before::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, #b20089, #ff9000);
    border-radius: 2px;
    box-shadow: 0 0 10px rgba(178, 0, 137, 0.5);
    animation: pulse 0.5s ease-in-out infinite;
}

.timeline-video-card.insert-after::after {
    content: '';
    position: absolute;
    right: -8px;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, #b20089, #ff9000);
    border-radius: 2px;
    box-shadow: 0 0 10px rgba(178, 0, 137, 0.5);
    animation: pulse 0.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scaleY(1); }
    50% { opacity: 0.7; transform: scaleY(0.95); }
}

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

.timeline-video-number {
    position: absolute;
    top: 5px;
    left: 5px;
    background: rgba(178, 0, 137, 0.9);
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 0.9rem;
    z-index: 2;
}

.timeline-trim-indicator {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(255, 144, 0, 0.95);
    color: #fff;
    padding: 3px 6px;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: bold;
    z-index: 2;
}

/* Timeline Action Buttons */
.timeline-card-actions {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    gap: 2px;
    padding: 4px;
    background: rgba(0, 0, 0, 0.9);
    opacity: 0;
    transition: opacity 0.2s;
}

.timeline-video-card:hover .timeline-card-actions {
    opacity: 1;
}

.timeline-action-button {
    flex: 1;
    background: rgba(51, 51, 51, 0.95);
    color: #fff;
    border: none;
    border-radius: 3px;
    padding: 6px 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
}

.timeline-action-button:hover {
    transform: scale(1.1);
}

.trim-button:hover {
    background: #ff9000;
}

.copy-button:hover {
    background: #00ff00;
    color: #000;
}

.paste-button:hover {
    background: #b20089;
}

/* Frame adjust buttons */
.frame-adjust-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    background: rgba(51, 51, 51, 0.9);
    color: #fff;
    border: 1px solid #666;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: bold;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.frame-adjust-btn:hover {
    background: linear-gradient(135deg, #b20089, #ff9000);
    border-color: #ff9000;
    transform: scale(1.1);
}

.frame-adjust-btn:active {
    transform: scale(0.95);
}

.timeline-remove-button {
    background: rgba(255, 0, 0, 0.95);
    color: #fff;
    border: none;
    border-radius: 3px;
    padding: 6px 8px;
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    font-weight: bold;
    transition: all 0.2s;
}

.timeline-remove-button:hover {
    background: #ff0000;
    transform: scale(1.1);
}

/* Timeline Player Progress */
#timelineProgress {
    color: #ff9000;
    font-size: 1.1rem;
    font-weight: bold;
    text-align: center;
    margin-top: 10px;
}

/* Trim Modal */
.trim-modal-content {
    max-width: 800px;
    background: #1a1a1a;
    border: 2px solid #ff9000;
    padding: 25px;
    border-radius: 8px;
}

.trim-modal-content h3 {
    color: #ff9000;
    margin-bottom: 15px;
    font-size: 1.4rem;
}

.trim-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin: 20px 0;
}

.trim-controls .form-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.trim-controls label {
    color: #fff;
    font-weight: bold;
    min-width: 150px;
}

.trim-controls input {
    flex: 1;
    padding: 8px;
    background: #000;
    border: 1px solid #333;
    border-radius: 4px;
    color: #fff;
    font-size: 0.95rem;
}

/* Mobile Responsiveness */
@media (max-width: 1200px) {
    .video-page-container {
        grid-template-columns: 1fr 1fr;
    }

    .left-panel {
        grid-column: 1 / -1;
    }
}

@media (max-width: 768px) {
    .video-page-container {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .timeline-controls {
        flex-direction: column;
    }

    .feeds-dropdown {
        max-width: 100%;
    }
}

/* Animate Button on Main Gallery */
.animate-button {
    position: absolute;
    bottom: 45px;
    left: 10px;
    padding: 6px 12px;
    background: linear-gradient(135deg, #b20089, #ff9000);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 10;
}

.image-container:hover .animate-button {
    opacity: 1;
}

.animate-button:hover {
    transform: scale(1.05);
    box-shadow: 0 0 10px rgba(178, 0, 137, 0.5);
}

/* AnimateV2 button positioned to the right of Animate button */
.animatev2-button {
    left: 110px; /* Position to the right of the first button */
    background: linear-gradient(135deg, #ff9000, #b20089) !important; /* Reverse gradient for distinction */
}

.animatev2-button:hover {
    box-shadow: 0 0 10px rgba(255, 144, 0, 0.5);
}

/* Video controls - no custom styling, let browser handle naturally */
