/**
 * 金牛故事系统 - 全局样式
 * 主色调: #C2B59B | #FFFFFF | #ADADAD
 * 图标风格: 扁平化单色线性图标 #C2B59B
 */

:root {
    --primary: #C2B59B;
    --primary-dark: #a8987a;
    --primary-light: #d9cfc0;
    --secondary: #FFFFFF;
    --tertiary: #ADADAD;
    --text-dark: #333333;
    --text-muted: #666666;
    --bg-light: #FAFAFA;
    --border-color: #E8E8E8;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --shadow-hover: 0 4px 20px rgba(0,0,0,0.12);
    --radius: 12px;
    --radius-sm: 8px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== 导航栏 ===== */
.navbar {
    background: var(--secondary);
    box-shadow: var(--shadow);
    padding: 0.75rem 0;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary) !important;
}

.navbar-brand svg {
    stroke: var(--primary);
}

.nav-link {
    color: var(--text-muted) !important;
    font-weight: 500;
    padding: 0.5rem 1rem !important;
    border-radius: var(--radius-sm);
    transition: all 0.3s ease;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary) !important;
    background: rgba(194, 181, 155, 0.1);
}

/* ===== 按钮 ===== */
.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    border-radius: var(--radius-sm);
    padding: 0.5rem 1.5rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-hover);
}

.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
    border-radius: var(--radius-sm);
}

.btn-outline-primary:hover {
    background: var(--primary);
    border-color: var(--primary);
}

/* ===== 卡片 ===== */
.card {
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    background: var(--secondary);
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem;
    font-weight: 600;
}

.card-body {
    padding: 1.5rem;
}

/* ===== 故事卡片 ===== */
.story-card {
    position: relative;
    cursor: pointer;
}

.story-card .cover-wrapper {
    position: relative;
    padding-top: 56.25%;
    overflow: hidden;
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
}

.story-card .cover-wrapper img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.story-card:hover .cover-wrapper img {
    transform: scale(1.05);
}

.story-card .story-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--tertiary);
}

/* ===== 章节树 ===== */
.chapter-tree {
    list-style: none;
    padding-left: 0;
}

.chapter-tree .chapter-item {
    padding: 1rem;
    margin-bottom: 0.5rem;
    background: var(--secondary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.chapter-tree .chapter-item:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow);
}

.chapter-tree .chapter-children {
    list-style: none;
    padding-left: 2rem;
    margin-top: 0.5rem;
    border-left: 2px solid var(--primary-light);
}

.chapter-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-chapter {
    background: rgba(194, 181, 155, 0.15);
    color: var(--primary-dark);
}

.badge-branch {
    background: rgba(173, 173, 173, 0.15);
    color: var(--text-muted);
}

/* ===== 流程图容器 ===== */
.flowchart-container {
    width: 100%;
    min-height: 600px;
    background: var(--secondary);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2rem;
    overflow: auto;
}

.flow-node {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--secondary);
    border: 2px solid var(--primary);
    border-radius: var(--radius);
    min-width: 160px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.flow-node:hover {
    background: rgba(194, 181, 155, 0.05);
    box-shadow: var(--shadow-hover);
}

.flow-node.root {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.flow-node.root .node-title {
    color: #fff;
}

.flow-node .node-icon {
    width: 40px;
    height: 40px;
    margin-bottom: 0.5rem;
    stroke: var(--primary);
}

.flow-node.root .node-icon {
    stroke: #fff;
}

.flow-node .node-title {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 0.9375rem;
}

.flow-node .node-desc {
    font-size: 0.75rem;
    color: var(--tertiary);
    margin-top: 0.25rem;
}

.flow-connector {
    width: 2px;
    height: 40px;
    background: var(--primary-light);
    margin: 0 auto;
}

.flow-branch-line {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 1rem;
}

/* ===== Cookie弹窗 ===== */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--secondary);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
    padding: 1.5rem;
    z-index: 9999;
    display: none;
}

.cookie-banner.show {
    display: block;
    animation: slideUp 0.4s ease;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

/* ===== 首页Hero ===== */
.hero-section {
    background: linear-gradient(135deg, #f8f6f3 0%, #fff 50%, #f5f2ee 100%);
    padding: 5rem 0;
    text-align: center;
}

.hero-section h1 {
    font-size: 3rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 1rem;
}

.hero-section h1 span {
    color: var(--primary);
}

.hero-section p {
    font-size: 1.25rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto 2rem;
}

/* ===== AI生成面板 ===== */
.ai-panel {
    background: linear-gradient(135deg, rgba(194,181,155,0.08), rgba(194,181,155,0.02));
    border: 1px solid var(--primary-light);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.ai-panel .ai-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    color: var(--primary-dark);
    font-weight: 600;
}

/* ===== 视频组合列表 ===== */
.composition-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--secondary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    margin-bottom: 0.75rem;
    transition: all 0.3s ease;
}

.composition-item:hover {
    border-color: var(--primary-light);
}

.composition-thumb {
    width: 120px;
    height: 68px;
    border-radius: var(--radius-sm);
    background: var(--bg-light);
    overflow: hidden;
    flex-shrink: 0;
}

.composition-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ===== 页脚 ===== */
.site-footer {
    background: var(--secondary);
    border-top: 1px solid var(--border-color);
    margin-top: auto;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.site-footer a {
    color: var(--primary);
    text-decoration: none;
}

.site-footer a:hover {
    text-decoration: underline;
}

/* ===== 表单 ===== */
.form-control, .form-select {
    border-radius: var(--radius-sm);
    border-color: var(--border-color);
    padding: 0.625rem 1rem;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(194, 181, 155, 0.25);
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .hero-section h1 {
        font-size: 2rem;
    }
    
    .flow-branch-line {
        flex-direction: column;
        align-items: center;
        gap: 0;
    }
    
    .composition-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .composition-thumb {
        width: 100%;
        height: 160px;
    }
}

/* ===== 扁平化线性图标样式 ===== */
.icon-linear {
    stroke: var(--primary);
    stroke-width: 1.5;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ===== 加载动画 ===== */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--primary-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== 分享页面 ===== */
.share-preview {
    max-width: 800px;
    margin: 2rem auto;
    background: var(--secondary);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.share-preview .video-wrapper {
    position: relative;
    padding-top: 56.25%;
    background: #000;
}

.share-preview .video-wrapper video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* ===== 脚本编辑器 ===== */
.script-editor {
    background: var(--secondary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    padding: 1rem;
}

.script-field label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.375rem;
}

/* ===== 状态标签 ===== */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.625rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-draft { background: #f0f0f0; color: #888; }
.status-active { background: rgba(194,181,155,0.15); color: var(--primary-dark); }
.status-completed { background: rgba(76,175,80,0.1); color: #4caf50; }
.status-processing { background: rgba(33,150,243,0.1); color: #2196f3; }
