﻿:root {
    --bg-color: #f3f4f6;
    --surface: #ffffff;
    --surface-hover: #f9fafb;
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --text-main: #111827;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Outfit', 'Noto Sans SC', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow-x: hidden;
}

/* Background animated gradient */
.bg-shapes {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 0;
    overflow: hidden;
    background: linear-gradient(135deg, #f3f4f6 0%, #e0e7ff 100%);
}

.shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.6;
    animation: float 20s infinite alternate;
}

.shape-1 { width: 50vw; height: 50vw; background: #c7d2fe; top: -10vw; left: -10vw; }
.shape-2 { width: 40vw; height: 40vw; background: #e0e7ff; bottom: -5vw; right: -5vw; animation-delay: -5s; }
.shape-3 { width: 30vw; height: 30vw; background: #ddd6fe; top: 30vh; left: 40vw; animation-delay: -10s; }

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(30px, 50px) scale(1.1); }
}

.main-wrapper {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 1200px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    min-height: 100vh;
    justify-content: center;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.logo-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-icon {
    width: 44px;
    height: 44px;
    color: var(--primary);
    background: white;
    padding: 6px;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    transform: scaleX(-1); /* 火苗水平翻转 */
}

.titles h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text-main);
    line-height: 1.2;
}

.titles p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.content-grid {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 2rem;
    align-items: stretch;
    height: calc(100vh - 12rem);
    min-height: 600px;
    max-height: 750px;
}

@media (max-width: 900px) {
    /* 移动端：整体改为顶部对齐，避免垂直居中把内容顶出屏幕/裁切 */
    body { align-items: flex-start; }
    .main-wrapper {
        justify-content: flex-start;
        min-height: auto;
        padding: 1.25rem;
    }

    .content-grid {
        grid-template-columns: 1fr;
        height: auto;
        min-height: auto;
        max-height: none;
    }

    /* 卡片高度随内容自适应，去掉裁切，避免固定高度把内容截断 */
    .card {
        height: auto;
        overflow: visible;
    }
    .form-section form {
        height: auto;
        overflow: visible;
        padding-right: 0;
    }

    /* 结果区：占位提示回到正常文档流，完整居中显示 */
    .result-section {
        height: auto;
        min-height: 220px;
    }
    .result-placeholder {
        position: static;
        transform: none;
        padding: 3rem 1rem;
    }
    .result-content {
        height: auto;
    }
    .results-list {
        overflow: visible;
        padding-right: 0;
    }
}

.card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.form-section form {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.label-text {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-main);
}

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

textarea, input[type="number"] {
    width: 100%;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.95rem;
    transition: var(--transition);
}

textarea {
    resize: vertical;
    min-height: 140px;
}

textarea:focus, input[type="number"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

/* 生成期间锁定输入框：置灰 + 禁止编辑 */
textarea:disabled, input:disabled {
    background: #f3f4f6;
    color: var(--text-muted);
    border-color: var(--border);
    cursor: not-allowed;
    opacity: 0.65;
    resize: none;
}

.number-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.number-input-wrapper input {
    padding-right: 3rem;
}

.number-input-wrapper .unit {
    position: absolute;
    right: 1rem;
    color: var(--text-muted);
    pointer-events: none;
}

.btn-primary {
    width: 100%;
    background: var(--primary);
    color: white;
    border: none;
    padding: 1rem;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(79, 70, 229, 0.3);
}

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

.btn-secondary {
    background: #eef2ff;
    color: var(--primary);
    border: 1px solid #c7d2fe;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-secondary:hover {
    background: #e0e7ff;
    border-color: #a5b4fc;
}

/* Loader spinner */
.spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s linear infinite;
}

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

.is-loading .btn-content {
    opacity: 0.7;
}

.is-loading .spinner {
    display: block;
}

.is-loading {
    pointer-events: none;
}

/* Result Area */
.result-section {
    position: relative;
    height: 100%;
}

.result-placeholder {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    width: 100%;
}

.placeholder-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.result-placeholder h3 {
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.result-placeholder p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.result-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.result-content.hidden {
    display: none;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.result-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
}

.results-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow-y: auto;
    flex-grow: 1;
    padding-right: 0.5rem;
}

.result-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
    transition: var(--transition);
}

.result-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

.result-badge {
    display: inline-block;
    background: #eef2ff;
    color: var(--primary);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.result-text {
    white-space: pre-wrap;
    font-size: 0.95rem;
    color: var(--text-main);
}

/* ============================================================
   工作流执行动效 (Workflow Running Loader)
   ============================================================ */
.workflow-loader {
    position: absolute;
    inset: 0;
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 1.75rem;
    color: var(--text-main);
    background:
        radial-gradient(130% 80% at 50% -12%, rgba(79, 70, 229, 0.14), transparent 60%),
        linear-gradient(160deg, #ffffff 0%, #eef1fb 55%, #f5f3ff 100%);
    z-index: 5;
    font-family: 'Outfit', 'Noto Sans SC', sans-serif;
}
.workflow-loader.hidden { display: none; }

/* 旋转辉光 */
.wf-glow {
    position: absolute;
    inset: -45%;
    z-index: 0;
    background: conic-gradient(from 0deg,
        transparent 0 18%,
        rgba(99, 102, 241, 0.35) 32%,
        rgba(139, 92, 246, 0.32) 50%,
        transparent 66% 100%);
    filter: blur(42px);
    opacity: 0.4;
    animation: wf-rotate 7s linear infinite;
}
@keyframes wf-rotate { to { transform: rotate(360deg); } }

/* 科技网格 */
.wf-grid {
    position: absolute;
    inset: 0;
    z-index: 0;
    background-image:
        linear-gradient(rgba(79, 70, 229, 0.07) 1px, transparent 1px),
        linear-gradient(90deg, rgba(79, 70, 229, 0.07) 1px, transparent 1px);
    background-size: 26px 26px;
    -webkit-mask-image: radial-gradient(125% 90% at 50% 40%, #000 42%, transparent 85%);
    mask-image: radial-gradient(125% 90% at 50% 40%, #000 42%, transparent 85%);
    animation: wf-griddrift 6s linear infinite;
}
@keyframes wf-griddrift { to { background-position: 0 26px, 26px 0; } }

/* 扫描光带 */
.wf-scan {
    position: absolute;
    left: 0; right: 0; top: 0;
    height: 40%;
    z-index: 1;
    background: linear-gradient(180deg, rgba(79, 70, 229, 0.09), transparent);
    animation: wf-scanmove 3.2s ease-in-out infinite;
    pointer-events: none;
}
@keyframes wf-scanmove {
    0%   { transform: translateY(-40%); opacity: 0; }
    30%  { opacity: 1; }
    100% { transform: translateY(260%); opacity: 0; }
}

.wf-header, .wf-track, .wf-footer { position: relative; z-index: 2; }

.wf-header { margin-bottom: 1.1rem; }
.wf-header-title {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 0.55rem;
}
.wf-header-title::before {
    content: "";
    width: 9px; height: 9px;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 12px rgba(79, 70, 229, 0.7);
    animation: wf-blink 1.2s infinite;
}
@keyframes wf-blink { 50% { opacity: 0.25; } }
.wf-header-sub {
    font-size: 0.7rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-top: 3px;
}

.wf-track {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0;
}

.wf-node {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0.85rem 0;
    position: relative;
    opacity: 0.4;
    transition: opacity 0.45s ease;
}
/* 节点间连线：只落在两个图标之间的空隙里，不侵入下方图标 */
.wf-node::before {
    content: "";
    position: absolute;
    left: 19px;
    top: calc(50% + 24px);
    width: 2px;
    height: calc(100% - 48px);
    background: rgba(17, 24, 39, 0.10);
    transition: background 0.4s ease;
}
.wf-node:last-child::before { display: none; }
.wf-node.is-done::before {
    background: linear-gradient(#4f46e5, #7c3aed);
    box-shadow: 0 0 8px rgba(79, 70, 229, 0.45);
}

.wf-node-icon {
    width: 40px; height: 40px;
    flex-shrink: 0;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    border: 1px solid var(--border);
    color: #9ca3af;
    transition: var(--transition);
}
.wf-node-icon svg { width: 20px; height: 20px; }

.wf-node-body { display: flex; flex-direction: column; }
.wf-node-title { font-size: 0.95rem; font-weight: 600; color: var(--text-main); }
.wf-node-sub {
    font-size: 0.68rem;
    color: var(--text-muted);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.wf-node-status {
    margin-left: auto;
    width: 22px; height: 22px;
    flex-shrink: 0;
    position: relative;
}

/* 进行中 */
.wf-node.is-active { opacity: 1; }
.wf-node.is-active .wf-node-icon {
    color: #fff;
    border-color: var(--primary);
    background: var(--primary);
    animation: wf-pulse 1.5s infinite;
}
@keyframes wf-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.55); }
    70%  { box-shadow: 0 0 0 12px rgba(99, 102, 241, 0); }
    100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
}
.wf-node.is-active .wf-node-status::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid rgba(79, 70, 229, 0.25);
    border-top-color: var(--primary);
    animation: spin 0.8s linear infinite;
}

/* 已完成 */
.wf-node.is-done { opacity: 1; }
.wf-node.is-done .wf-node-icon {
    color: var(--primary);
    border-color: rgba(79, 70, 229, 0.4);
    background: rgba(79, 70, 229, 0.10);
}
.wf-node.is-done .wf-node-status::after {
    content: "✓";
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #16a34a;
    font-size: 0.95rem;
    font-weight: 700;
}

.wf-footer { margin-top: 1.1rem; }
.wf-progressbar {
    height: 4px;
    border-radius: 4px;
    background: rgba(17, 24, 39, 0.08);
    overflow: hidden;
}
.wf-progressbar span {
    display: block;
    height: 100%;
    width: 0%;
    border-radius: 4px;
    background: linear-gradient(90deg, #4f46e5, #7c3aed);
    box-shadow: 0 0 10px rgba(79, 70, 229, 0.45);
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.wf-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.6rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}
.wf-elapsed { font-variant-numeric: tabular-nums; color: var(--primary); }
.wf-hint { margin-top: 0.35rem; font-size: 0.72rem; color: #9ca3af; }

@media (max-width: 900px) {
    .workflow-loader {
        position: relative;
        min-height: 520px;
    }
}
