/* Veo 3.1 Video Generator - Styles */

:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a25;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent-primary: #6366f1;
    --accent-secondary: #a855f7;
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    --border-color: rgba(255, 255, 255, 0.08);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    background-image:
        radial-gradient(ellipse at top, rgba(99, 102, 241, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at bottom right, rgba(168, 85, 247, 0.08) 0%, transparent 50%);
}

.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 40px 24px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 48px;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 12px;
}

.logo-icon {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

.logo h1 {
    font-size: 1.75rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Main Content */
.main {
    flex: 1;
}

/* Form Styles */
.generate-form {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 32px;
    box-shadow: var(--shadow-md);
}

/* Mode Selector */
.mode-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 24px;
}

.mode-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

.mode-option:hover {
    border-color: var(--accent-primary);
}

.mode-option.active {
    border-color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.1);
}

.mode-option input[type="radio"] {
    display: none;
}

.mode-icon {
    font-size: 1.25rem;
}

.mode-option h3 {
    font-size: 0.9rem;
    margin: 0;
}

.mode-option p {
    font-size: 0.75rem;
    margin: 0;
    color: var(--text-secondary);
}

.mode-label {
    font-weight: 600;
    color: var(--text-primary);
}

.mode-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

textarea {
    width: 100%;
    padding: 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
    transition: var(--transition);
}

textarea::placeholder {
    color: var(--text-muted);
}

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

/* Image Input Tabs */
.image-input-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.tab-btn {
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.tab-btn:hover {
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.tab-btn.active {
    background: rgba(99, 102, 241, 0.15);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.tab-content {
    animation: fadeIn 0.2s ease;
}

/* URL Input */
.url-input-group {
    display: flex;
    gap: 8px;
}

.url-input {
    flex: 1;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: var(--transition);
}

.url-input::placeholder {
    color: var(--text-muted);
}

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

.load-url-btn {
    padding: 12px 20px;
    background: var(--accent-gradient);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.load-url-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.load-url-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.url-preview {
    margin-top: 12px;
    position: relative;
    display: inline-block;
}

.url-preview img {
    max-width: 100%;
    max-height: 180px;
    border-radius: var(--radius-md);
    object-fit: contain;
}

/* Upload Area */
.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
    background: var(--bg-tertiary);
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.05);
}

.upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.upload-icon {
    color: var(--text-muted);
}

.upload-area p {
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

.upload-link {
    color: var(--accent-primary);
    font-weight: 500;
    cursor: pointer;
}

.upload-hint {
    font-size: 0.8125rem !important;
    color: var(--text-muted) !important;
}

/* Preview */
.preview-container {
    position: relative;
    display: inline-block;
}

.preview-container img {
    max-width: 100%;
    max-height: 200px;
    border-radius: var(--radius-md);
    object-fit: contain;
}

.remove-image {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #ef4444;
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.remove-image:hover {
    background: #dc2626;
    transform: scale(1.1);
}

/* Generate Button */
.generate-btn {
    width: 100%;
    padding: 16px 32px;
    background: var(--accent-gradient);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.generate-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, transparent 100%);
    opacity: 0;
    transition: var(--transition);
}

.generate-btn:hover::before {
    opacity: 1;
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
}

.generate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.generate-btn .btn-icon {
    transition: var(--transition);
}

.generate-btn:hover .btn-icon {
    transform: translateX(4px);
}

/* Result Section */
.result-section {
    margin-top: 32px;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Progress */
.progress-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 48px 32px;
    text-align: center;
}

.progress-spinner {
    width: 64px;
    height: 64px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    margin: 0 auto 24px;
    animation: spin 1s linear infinite;
}

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

.progress-container h3 {
    font-size: 1.25rem;
    margin-bottom: 8px;
}

.progress-container p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.progress-bar {
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent-gradient);
    width: 0%;
    transition: width 0.5s ease;
    animation: progressPulse 2s ease-in-out infinite;
}

@keyframes progressPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

/* Video Container */
.video-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 32px;
    text-align: center;
}

.video-container h3 {
    font-size: 1.25rem;
    margin-bottom: 24px;
}

video {
    width: 100%;
    border-radius: var(--radius-lg);
    background: #000;
    max-height: 400px;
}

.video-actions {
    display: flex;
    gap: 16px;
    margin-top: 24px;
    flex-wrap: wrap;
}

.download-btn {
    flex: 1;
    min-width: 160px;
    padding: 14px 24px;
    background: var(--accent-gradient);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    transition: var(--transition);
}

.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
}

.new-video-btn {
    flex: 1;
    min-width: 160px;
    padding: 14px 24px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.new-video-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--text-muted);
}

/* Error Container */
.error-container {
    background: var(--bg-secondary);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-xl);
    padding: 48px 32px;
    text-align: center;
}

.error-icon {
    margin-bottom: 16px;
}

.error-container h3 {
    color: #ef4444;
    margin-bottom: 8px;
}

.error-container p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.retry-btn {
    padding: 14px 32px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.retry-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--text-muted);
}

/* Footer */
.footer {
    text-align: center;
    padding-top: 48px;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Model Selection Grid */
.model-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.model-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, rgba(30, 30, 45, 1) 100%);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.model-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--accent-gradient);
    opacity: 0;
    transition: opacity 0.2s ease;
}

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

.model-card:hover::before {
    opacity: 0.05;
}

.model-card:has(input:checked) {
    border-color: var(--accent-primary);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(168, 85, 247, 0.1) 100%);
    box-shadow: 0 0 0 1px var(--accent-primary), 0 4px 12px rgba(99, 102, 241, 0.2);
}

.model-card input {
    display: none;
}

.model-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-primary);
    white-space: nowrap;
    position: relative;
    z-index: 1;
}

.model-card:has(input:checked) .model-name {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.model-check {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: transparent;
    transition: all 0.2s ease;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.model-card:has(input:checked) .model-check {
    background: var(--accent-gradient);
    border-color: transparent;
    color: white;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

.model-card:has(input:checked) .model-check svg {
    width: 12px;
    height: 12px;
}

/* Results Grid */
.results-title {
    margin-bottom: 0;
    font-size: 1.25rem;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.results-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.export-btn {
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.8125rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
}

.export-btn:hover {
    border-color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.1);
}

.overall-progress-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
    width: 100%;
}

/* Controls Bar */
.controls-bar {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-bottom: 24px;
}

.control-btn {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-btn:hover {
    color: var(--text-primary);
    border-color: var(--text-muted);
    background: var(--bg-tertiary);
}

/* Logs Section */
.logs-section {
    margin-bottom: 32px;
    background: #0d0d12;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    animation: fadeIn 0.3s ease;
}

.logs-header {
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logs-header h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.clear-logs-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    cursor: pointer;
}

.clear-logs-btn:hover {
    color: var(--text-primary);
}

.logs-terminal {
    height: 200px;
    overflow-y: auto;
    padding: 16px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.8125rem;
    color: #a0a0a0;
}

.log-entry {
    margin-bottom: 4px;
    line-height: 1.4;
    word-break: break-all;
}

.log-entry.INFO {
    color: #94a3b8;
}

.log-entry.WARNING {
    color: #facc15;
}

.log-entry.ERROR {
    color: #ef4444;
}

/* Library Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: fadeIn 0.2s ease;
}

.modal-overlay[hidden] {
    display: none !important;
}

.modal-content {
    width: 100%;
    max-width: 600px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}

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

.close-modal-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 4px;
}

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

.library-list {
    padding: 16px;
    overflow-y: auto;
}

.library-item {
    padding: 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.library-item:hover {
    border-color: var(--accent-primary);
    transform: translateX(4px);
}

.library-item-content h4 {
    font-size: 0.9375rem;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.library-item-content p {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.library-item-meta {
    text-align: right;
}

.library-status-badge {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
}

.library-status-badge.completed {
    color: #22c55e;
    background: rgba(34, 197, 94, 0.1);
}

.library-status-badge.failed {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.result-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

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

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

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

.result-model-name {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 4px;
}

.result-prompt-preview {
    font-size: 0.8rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
}

.result-status {
    font-size: 0.7rem;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.status-pending {
    background: rgba(148, 163, 184, 0.2);
    color: var(--text-secondary);
}

.status-processing {
    background: rgba(99, 102, 241, 0.2);
    color: var(--accent-primary);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

.status-completed {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.status-failed {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.result-content {
    padding: 16px;
    min-height: 180px;
    display: flex;
    flex-direction: column;
}

.result-content video {
    width: 100%;
    border-radius: var(--radius-md);
    background: #000;
    max-height: 240px;
}

.video-container {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
}

.video-container video {
    width: 100%;
    display: block;
    max-height: 240px;
    object-fit: cover;
}

.video-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.video-container:hover .video-overlay {
    opacity: 0;
}

.play-hint {
    color: white;
    font-size: 0.85rem;
    background: rgba(0, 0, 0, 0.5);
    padding: 8px 16px;
    border-radius: 20px;
    backdrop-filter: blur(4px);
}

.result-loading {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.result-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    font-size: 0.875rem;
}

.result-duration {
    color: var(--text-secondary);
}

.result-download {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 500;
}

.result-download:hover {
    text-decoration: underline;
}

.result-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.analyze-btn {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.2s ease;
}

.analyze-btn:hover:not(:disabled) {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

.analyze-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.analysis-result {
    margin-top: 12px;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.analysis-loading {
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-align: center;
    padding: 8px;
}

.analysis-content {
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text-primary);
}

.analysis-content strong {
    color: var(--accent-primary);
}

.analysis-error {
    color: #ef4444;
    font-size: 0.85rem;
    padding: 12px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: var(--radius-md);
}

/* Analysis Log Entries */
.analysis-log {
    font-size: 0.8rem;
    color: var(--text-secondary);
    padding: 4px 0;
    border-left: 2px solid var(--accent-primary);
    padding-left: 8px;
    margin: 4px 0;
}

/* Collapsible Analysis Details */
.analysis-details {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.analysis-summary {
    padding: 12px 16px;
    background: var(--bg-tertiary);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
    user-select: none;
}

.analysis-summary:hover {
    background: var(--bg-secondary);
}

.toggle-hint {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.analysis-details[open] .toggle-hint {
    content: 'Click to collapse';
}

.analysis-details:not([open]) .toggle-hint::after {
    content: ' (expand)';
}

.summary-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.copy-analysis-btn {
    background: var(--accent-primary);
    color: white;
    border: none;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.2s ease;
}

.copy-analysis-btn:hover {
    background: var(--accent-secondary);
}

/* Analysis Content Formatting */
.analysis-details .analysis-content {
    padding: 16px;
    max-height: 400px;
    overflow-y: auto;
}

.analysis-h1 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--accent-primary);
    margin: 16px 0 8px 0;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border-color);
}

.analysis-h2 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 12px 0 6px 0;
}

.analysis-item {
    margin: 4px 0;
    padding-left: 8px;
}

.item-num {
    color: var(--accent-primary);
    font-weight: 600;
}

.analysis-content li {
    margin: 4px 0;
    padding-left: 16px;
    position: relative;
}

.analysis-content li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--accent-primary);
}

.result-error {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ef4444;
    text-align: center;
}

.result-actions {
    margin-top: 24px;
    text-align: center;
}

/* Responsive */
@media (max-width: 640px) {
    .container {
        padding: 24px 16px;
    }

    .generate-form {
        padding: 24px 20px;
    }

    .logo h1 {
        font-size: 1.5rem;
    }

    .video-actions {
        flex-direction: column;
    }

    .model-grid {
        grid-template-columns: 1fr;
    }

    .results-grid {
        grid-template-columns: 1fr;
    }
}

/* Aspect Ratio */
.aspect-ratio-group {
    margin-bottom: 24px;
    animation: fadeIn 0.3s ease;
}

.aspect-ratio-selector {
    display: flex;
    gap: 8px;
    background: var(--bg-tertiary);
    padding: 6px;
    border-radius: 20px;
    width: fit-content;
    border: 1px solid var(--border-color);
}

.ratio-option {
    padding: 8px 16px;
    border-radius: 16px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.ratio-option:hover {
    background: rgba(255, 255, 255, 0.05);
}

.ratio-option.active {
    background: var(--bg-secondary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
}

.ratio-option input {
    display: none;
}

.ratio-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.ratio-desc {
    font-size: 0.65rem;
    color: var(--text-secondary);
}

.ratio-option.active .ratio-label {
    color: var(--accent-primary);
}

/* Batch Inputs */
.batch-inputs-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 12px;
}

.batch-input-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.batch-prompt-input {
    flex: 1;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    resize: none;
    overflow-y: hidden;
    min-height: 48px;
    line-height: 1.5;
}

.batch-prompt-input.locked {
    opacity: 0.7;
    cursor: not-allowed;
    overflow-y: hidden;
    resize: none;
}

.batch-prompt-input::placeholder {
    color: var(--text-muted);
}

.add-prompt-btn {
    padding: 10px 16px;
    background: transparent;
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.875rem;
    cursor: pointer;
    width: 100%;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.add-prompt-btn:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.05);
}

.remove-batch-btn {
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 50%;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.remove-batch-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

/* Logs Scroll Button */
.logs-scroll-btn {
    position: absolute;
    bottom: 16px;
    right: 24px;
    /* Account for scrollbar */
    background: var(--accent-primary);
    color: white;
    border: none;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 6px;
    z-index: 10;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 1;
    transform: translateY(0);
}

.logs-scroll-btn.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
}

.logs-scroll-btn:hover {
    background: var(--accent-secondary);
    transform: translateY(-2px);
}

/* ===== Page Tabs ===== */
.page-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    padding: 6px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    width: fit-content;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

.page-tab {
    padding: 10px 20px;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.page-tab::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--accent-gradient);
    opacity: 0;
    transition: opacity 0.25s ease;
    border-radius: var(--radius-md);
}

.page-tab:hover {
    color: var(--text-primary);
}

.page-tab:hover::before {
    opacity: 0.1;
}

.page-tab.active {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4), 0 2px 4px rgba(0, 0, 0, 0.2);
    transform: translateY(-1px);
}

.page-tab.active:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.5), 0 2px 4px rgba(0, 0, 0, 0.2);
}

.page-tab .tab-icon {
    font-size: 1rem;
    transition: transform 0.2s ease;
}

.page-tab:hover .tab-icon {
    transform: scale(1.1);
}

/* Page Content with Smooth Transitions */
.page-content {
    display: none;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.page-content.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
    animation: pageSlideIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes pageSlideIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== Viral Evaluation Styles ===== */
.eval-title {
    font-size: 1.5rem;
    margin-bottom: 8px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.eval-subtitle {
    color: var(--text-secondary);
    margin-bottom: 24px;
    font-size: 0.9375rem;
}

.required {
    color: #ef4444;
}

/* Video Input Tabs */
.video-input-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.video-tab-content {
    animation: fadeIn 0.2s ease;
}

.url-video-preview {
    margin-top: 12px;
    position: relative;
    display: inline-block;
    width: 100%;
}

.url-video-preview video {
    width: 100%;
    max-height: 200px;
    border-radius: var(--radius-md);
    background: #000;
}

.optional {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 0.8rem;
}

.video-upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
    background: var(--bg-tertiary);
    min-height: 120px;
}

.video-upload-area:hover {
    border-color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.05);
}

.video-upload-area .upload-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.video-preview-container {
    position: relative;
    display: inline-block;
    width: 100%;
}

.video-preview-container video {
    width: 100%;
    max-height: 200px;
    border-radius: var(--radius-md);
    background: #000;
}

.remove-video {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.9);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    font-size: 1rem;
}

.remove-video:hover {
    background: #dc2626;
    transform: scale(1.1);
}

/* Model Select Dropdown */
.model-select {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

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

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

.eval-btn {
    margin-top: 8px;
}

/* Evaluation Results */
.eval-results {
    margin-top: 32px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    overflow: hidden;
    animation: fadeIn 0.5s ease;
}

.eval-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.eval-results-header h3 {
    font-size: 1.125rem;
    margin: 0;
}

.results-actions {
    display: flex;
    gap: 8px;
}

.action-btn {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.8125rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
}

.action-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.export-btn {
    color: var(--primary);
    border-color: var(--primary-light, #818cf8);
    background: rgba(99, 102, 241, 0.05);
}

.export-btn:hover {
    background: rgba(99, 102, 241, 0.1) !important;
    border-color: var(--primary) !important;
    color: var(--primary-dark, #4338ca) !important;
}

.copy-btn {
    /* Legacy support or specific overrides */
}

.copy-btn.copied {
    background: rgba(34, 197, 94, 0.1);
    border-color: #22c55e;
    color: #22c55e;
}

.eval-results-content {
    padding: 24px;
    max-height: 600px;
    overflow-y: auto;
}

/* Markdown Content Styling */
.eval-results-content h1,
.eval-results-content h2,
.eval-results-content h3 {
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    color: var(--text-primary);
}

.eval-results-content h1:first-child,
.eval-results-content h2:first-child,
.eval-results-content h3:first-child {
    margin-top: 0;
}

.eval-results-content p {
    margin-bottom: 1em;
    color: var(--text-secondary);
    line-height: 1.7;
}

.eval-results-content strong {
    color: var(--text-primary);
}

.eval-results-content ul,
.eval-results-content ol {
    margin-bottom: 1em;
    padding-left: 1.5em;
}

.eval-results-content li {
    margin-bottom: 0.5em;
    color: var(--text-secondary);
}

.eval-results-content code {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'SF Mono', 'Consolas', monospace;
    font-size: 0.875em;
}

.eval-results-content pre {
    background: var(--bg-tertiary);
    padding: 16px;
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin-bottom: 1em;
}

.eval-results-content pre code {
    padding: 0;
    background: none;
}

/* Score Cards */
.score-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 16px;
}

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

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

.score-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
}

.score-badge.viral {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.score-badge.average {
    background: rgba(234, 179, 8, 0.15);
    color: #eab308;
}

.score-badge.flop {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.score-value {
    font-size: 2rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.score-label {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Loading State */
.eval-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 48px;
    text-align: center;
}

.eval-loading .progress-spinner {
    margin-bottom: 16px;
}

.eval-loading p {
    color: var(--text-secondary);
}

/* Collapsible Prompt Section */
.prompt-details {
    margin-top: 16px;
    padding: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.prompt-summary {
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    padding: 8px;
    list-style: none;
    transition: color 0.2s ease;
}

.prompt-summary::-webkit-details-marker {
    display: none;
}

.prompt-summary::before {
    content: '▶ ';
    font-size: 0.75rem;
    margin-right: 6px;
    transition: transform 0.2s ease;
    display: inline-block;
}

.prompt-details[open] .prompt-summary::before {
    transform: rotate(90deg);
}

.prompt-summary:hover {
    color: var(--text-primary);
}

.prompt-content {
    margin-top: 12px;
    padding: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: 'SF Mono', 'Consolas', monospace;
    font-size: 0.8rem;
    line-height: 1.6;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 400px;
    overflow-y: auto;
}

/* System Prompt Card */
.system-prompt-card {
    margin-bottom: 24px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(168, 85, 247, 0.05) 100%);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.system-prompt-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    cursor: pointer;
    list-style: none;
    transition: background 0.2s ease;
}

.system-prompt-header::-webkit-details-marker {
    display: none;
}

.system-prompt-header:hover {
    background: rgba(99, 102, 241, 0.1);
}

.system-prompt-icon {
    font-size: 1.25rem;
}

.system-prompt-title {
    flex: 1;
    font-weight: 600;
    color: var(--text-primary);
}

.system-prompt-badge {
    font-size: 0.75rem;
    padding: 4px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.system-prompt-card[open] .system-prompt-badge {
    background: rgba(99, 102, 241, 0.15);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.system-prompt-card[open] .system-prompt-badge::before {
    content: 'Expanded';
}

.system-prompt-card:not([open]) .system-prompt-badge::before {
    content: 'Click to expand';
}

.system-prompt-badge {
    font-size: 0;
}

.system-prompt-body {
    padding: 0 20px 20px;
}

.system-prompt-text {
    padding: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: 'SF Mono', 'Consolas', monospace;
    font-size: 0.8rem;
    line-height: 1.7;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 500px;
    overflow-y: auto;
    margin: 0;
}