/* ==============================================
   Anima WebUI - Preview Area (SD WebUI style)
   ============================================== */

.preview-area {
    width: 100%;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    overflow: visible;
}

/* ── Empty State ── */
.preview-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    opacity: 0.5;
}

.preview-empty-icon {
    animation: float 4s ease-in-out infinite;
}

.preview-empty-text {
    font-size: 0.95rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.8;
}

/* ── Loading State ── */
.preview-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    position: relative;
    width: 100%;
}

/* has-preview時はresult-stateと同じレイアウトに */
.preview-loading.has-preview {
    gap: 0;
    height: 100%;
}

.preview-loading-spinner {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.orbit-ring {
    width: 60px;
    height: 60px;
    border: 2px solid var(--border-subtle);
    border-radius: 50%;
    position: relative;
    animation: orbit-spin 2s linear infinite;
}

.orbit-dot {
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--gradient-accent);
    box-shadow: 0 0 12px var(--accent-glow-strong);
}

.preview-loading-text {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.preview-loading-elapsed {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* ── Result State ── */
.preview-result {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    height: 100%;
}

.result-image {
    max-width: 100%;
    max-height: calc(100vh - 320px);
    object-fit: contain;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    animation: fadeScaleIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    flex: 1;
    min-height: 0;
}

.result-info {
    display: none;
    gap: 16px;
    font-size: 0.78rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.result-seed::before {
    content: 'Seed: ';
    color: var(--text-muted);
}

.result-size::before {
    content: 'Size: ';
    color: var(--text-muted);
}

/* ── Live Preview ── */

/* プレビュー画像コンテナ */
.preview-live-container {
    display: flex;
    align-items: center;
    justify-content: center;
}

.live-preview-image {
    max-width: 100%;
    max-height: calc(100vh - 320px);
    object-fit: contain;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    flex: 1;
    min-height: 0;
}

/* 進捗オーバーレイ */
.preview-loading-overlay {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px;
    transition: all 0.3s ease;
}

/* プレビュー画像があるとき: 画像の下にグラデーションで被せる */
.preview-loading.has-preview .preview-loading-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent 0%, rgba(0, 0, 0, 0.7) 40%);
    padding: 40px 20px 16px;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

.preview-loading.has-preview .preview-loading-text,
.preview-loading.has-preview .preview-progress-text,
.preview-loading.has-preview .preview-loading-elapsed {
    color: rgba(255, 255, 255, 0.95);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.preview-loading.has-preview .preview-progress-bar {
    background: rgba(255, 255, 255, 0.2);
}

/* LIVEバッジ */
.live-preview-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    background: rgba(239, 68, 68, 0.85);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    border-radius: 4px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    animation: live-pulse 2s ease-in-out infinite;
    position: absolute;
    top: 8px;
    right: 8px;
}

.live-preview-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: white;
    animation: live-dot-pulse 1s ease-in-out infinite;
}

@keyframes live-pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

@keyframes live-dot-pulse {

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

    50% {
        opacity: 0.5;
        transform: scale(0.8);
    }
}