/* AI Video Page Styles */

.video-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: var(--spacing-xl);
    margin-top: var(--spacing-lg);
    min-height: 600px;
}

/* Settings Panel */
.video-settings {
    background: var(--surface-1);
    border: 1px solid var(--hairline);
    border-radius: var(--rounded-lg);
    padding: var(--spacing-lg);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.video-field-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Model Select */
.video-model-select select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--hairline);
    border-radius: var(--rounded-md);
    background: var(--surface-2);
    color: var(--ink);
    font-size: 0.875rem;
    cursor: pointer;
    transition: border-color 0.2s;
}

.video-model-select select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-subtle);
}

.video-model-desc {
    font-size: 0.75rem;
    color: var(--ink-subtle);
    margin-top: 4px;
}

/* Mode Toggle */
.video-mode-toggle {
    display: flex;
    gap: 6px;
    background: var(--surface-2);
    padding: 4px;
    border-radius: var(--rounded-md);
}

.video-mode-btn {
    flex: 1;
    padding: 8px 12px;
    border: none;
    border-radius: var(--rounded-sm);
    background: transparent;
    color: var(--ink-muted);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.video-mode-btn:hover {
    color: var(--ink);
}

.video-mode-btn.active {
    background: var(--surface-1);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

/* Upload Zone */
.video-upload-group {
    animation: fadeIn 0.2s ease;
}

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

.video-upload-zone {
    border: 2px dashed var(--hairline);
    border-radius: var(--rounded-md);
    padding: var(--spacing-lg);
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--surface-2);
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.video-upload-zone:hover,
.video-upload-zone.drag-over {
    border-color: var(--primary);
    background: var(--primary-subtle);
}

.upload-emoji {
    font-size: 2rem;
    margin-bottom: 8px;
}

.video-upload-zone p {
    margin: 4px 0;
    font-size: 0.875rem;
    color: var(--ink-muted);
}

.upload-sub {
    font-size: 0.75rem !important;
    color: var(--ink-subtle) !important;
}

.video-upload-preview {
    display: none;
    position: relative;
    width: 100%;
}

.video-upload-preview img {
    width: 100%;
    max-height: 200px;
    object-fit: contain;
    border-radius: var(--rounded-sm);
}

.video-upload-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.video-upload-remove:hover {
    background: rgba(239,68,68,0.8);
}

/* Prompt Area */
.char-count {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--ink-subtle);
}

.video-prompt-area textarea {
    width: 100%;
    min-height: 100px;
    padding: 12px;
    border: 1px solid var(--hairline);
    border-radius: var(--rounded-md);
    background: var(--surface-2);
    color: var(--ink);
    font-size: 0.9375rem;
    line-height: 1.6;
    resize: vertical;
    font-family: inherit;
    transition: border-color 0.2s;
}

.video-prompt-area textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-subtle);
}

.video-prompt-area textarea::placeholder {
    color: var(--ink-muted);
}

/* Example Buttons */
.video-examples {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
    align-items: center;
}

.video-example-label {
    font-size: 0.75rem;
    color: var(--ink-subtle);
}

.video-example-btn {
    padding: 4px 10px;
    border: 1px solid var(--hairline);
    border-radius: 20px;
    background: var(--surface-1);
    color: var(--ink-muted);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.video-example-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-subtle);
}

/* Option Grid */
.video-option-grid {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.video-option-btn {
    padding: 8px 14px;
    border: 1px solid var(--hairline);
    border-radius: var(--rounded-sm);
    background: var(--surface-1);
    color: var(--ink-muted);
    font-size: 0.8125rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.video-option-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.video-option-btn.active {
    border-color: var(--primary);
    background: var(--primary-subtle);
    color: var(--primary);
    font-weight: 500;
}

/* Duration & Motion Tips */
.video-duration-tip,
.video-motion-tip {
    font-size: 0.75rem;
    color: var(--ink-subtle);
    margin-top: 4px;
    min-height: 18px;
}

.video-duration-tip.warning,
.video-motion-tip.warning {
    color: #f59e0b;
}

/* Switch */
.video-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.video-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.video-switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--surface-3);
    transition: 0.3s;
    border-radius: 24px;
}

.video-switch-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.video-switch input:checked + .video-switch-slider {
    background-color: var(--primary);
}

.video-switch input:checked + .video-switch-slider:before {
    transform: translateX(20px);
}

.video-switch-desc {
    font-size: 0.75rem;
    color: var(--ink-subtle);
    margin-top: 2px;
}

/* Credits Section */
.video-credits-section {
    background: var(--surface-2);
    border: 1px solid var(--hairline);
    border-radius: var(--rounded-md);
    padding: 12px;
}

.video-credits-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
}

.video-credits-label {
    font-size: 0.8125rem;
    color: var(--ink-muted);
}

.video-credits-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--ink);
}

.video-price-value {
    color: var(--primary);
}

.video-credits-tip {
    font-size: 0.75rem;
    color: var(--ink-subtle);
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--hairline);
}

.video-credits-tip.warning {
    color: #f59e0b;
}

.video-credits-tip.error {
    color: #ef4444;
}

/* Generate Button */
.video-generate-wrap {
    margin-top: auto;
    padding-top: var(--spacing-md);
}

.video-generate-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: var(--rounded-md);
    background: var(--primary);
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}

.video-generate-btn:hover {
    background: var(--primary-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.video-generate-btn:disabled {
    background: var(--ink-muted);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.video-generate-tip {
    text-align: center;
    font-size: 0.75rem;
    color: var(--ink-subtle);
    margin-top: 8px;
}

/* Output Panel */
.video-output {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.video-result-canvas {
    background: var(--surface-1);
    border: 1px solid var(--hairline);
    border-radius: var(--rounded-lg);
    overflow: hidden;
}

.video-result-inner {
    position: relative;
    width: 100%;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Placeholder */
.video-placeholder {
    text-align: center;
    padding: var(--spacing-xl);
}

.video-placeholder .ph-icon {
    font-size: 4rem;
    margin-bottom: var(--spacing-md);
}

.video-placeholder .ph-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 8px;
}

.video-placeholder .ph-sub {
    font-size: 0.875rem;
    color: var(--ink-muted);
}

/* Loading */
.video-loading {
    display: none;
    text-align: center;
    padding: var(--spacing-xl);
}

.video-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--surface-3);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto var(--spacing-md);
}

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

.video-loading .ld-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 8px;
}

.video-loading .ld-sub {
    font-size: 0.875rem;
    color: var(--ink-muted);
    margin-bottom: 4px;
}

.video-loading .ld-progress {
    font-size: 0.75rem;
    color: var(--ink-subtle);
}

/* Result */
.video-result-display {
    display: none;
    width: 100%;
    padding: var(--spacing-md);
}

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

.video-result-actions {
    display: flex;
    gap: 8px;
    margin-top: var(--spacing-md);
    flex-wrap: wrap;
}

.video-action-btn {
    padding: 10px 16px;
    border: 1px solid var(--hairline);
    border-radius: var(--rounded-md);
    background: var(--surface-1);
    color: var(--ink);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    text-decoration: none;
}

.video-action-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.video-action-btn.primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

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

/* History */
.video-history {
    background: var(--surface-1);
    border: 1px solid var(--hairline);
    border-radius: var(--rounded-lg);
    padding: var(--spacing-lg);
}

.video-history-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
}

.video-history-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--ink);
}

.video-history-count {
    font-size: 0.75rem;
    color: var(--ink-subtle);
    margin-left: auto;
}

.video-history-delete-all {
    padding: 4px 10px;
    border: 1px solid rgba(239,68,68,0.3);
    border-radius: var(--rounded-sm);
    background: rgba(239,68,68,0.08);
    color: #ef4444;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.video-history-delete-all:hover {
    background: rgba(239,68,68,0.15);
}

.video-history-tip {
    font-size: 0.75rem;
    color: var(--ink-subtle);
    margin-bottom: var(--spacing-sm);
}

.video-history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.video-history-empty {
    text-align: center;
    padding: var(--spacing-lg);
    color: var(--ink-muted);
    font-size: 0.875rem;
}

.video-history-card {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: 10px;
    background: var(--surface-2);
    border: 1px solid var(--hairline);
    border-radius: var(--rounded-md);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.video-history-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.video-history-thumb {
    width: 80px;
    height: 50px;
    border-radius: var(--rounded-sm);
    overflow: hidden;
    flex-shrink: 0;
    background: var(--surface-3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-history-thumb video,
.video-history-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-history-thumb.broken {
    color: var(--ink-muted);
    font-size: 0.75rem;
}

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

.video-history-prompt {
    font-size: 0.8125rem;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.video-history-meta {
    font-size: 0.75rem;
    color: var(--ink-subtle);
    margin-top: 2px;
}

.video-history-delete {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 50%;
    background: rgba(239,68,68,0.1);
    color: #ef4444;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s;
}

.video-history-card:hover .video-history-delete {
    opacity: 1;
}

.video-history-delete:hover {
    background: rgba(239,68,68,0.2);
}

/* FAQ */
.video-faq {
    background: var(--surface-1);
    border: 1px solid var(--hairline);
    border-radius: var(--rounded-lg);
    padding: var(--spacing-lg);
}

.video-faq-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: var(--spacing-md);
}

.video-faq-item {
    border-bottom: 1px solid var(--hairline);
}

.video-faq-item:last-child {
    border-bottom: none;
}

.video-faq-q {
    width: 100%;
    padding: 12px 0;
    border: none;
    background: none;
    color: var(--ink);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: color 0.2s;
}

.video-faq-q:hover {
    color: var(--primary);
}

.video-faq-q::after {
    content: '+';
    font-size: 1.125rem;
    color: var(--ink-muted);
    transition: transform 0.2s;
}

.video-faq-item.open .video-faq-q::after {
    transform: rotate(45deg);
}

.video-faq-a {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.video-faq-item.open .video-faq-a {
    max-height: 200px;
}

.video-faq-a p {
    padding: 0 0 12px;
    font-size: 0.8125rem;
    color: var(--ink-muted);
    line-height: 1.6;
}

/* Responsive */
@media (max-width: 768px) {
    .video-layout {
        grid-template-columns: 1fr;
    }

    .video-mode-toggle {
        flex-wrap: wrap;
    }

    .video-mode-btn {
        flex: 1;
        min-width: 0;
    }

    .video-option-grid {
        flex-wrap: wrap;
    }

    .video-option-btn {
        flex: 1;
        min-width: 0;
        text-align: center;
    }

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

    .video-action-btn {
        justify-content: center;
    }
}
