@import url('https://fonts.googleapis.com/css2?family=Ma+Shan+Zheng&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Long+Cang&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Zhi+Mang+Xing&display=swap');
@font-face {
    font-family: "liukaijianti";
    src: url("/static/fonts/liukaijianti.ttf") format("truetype");
}

/*
  全站通用样式 (common.css) - 红色文化主题版
*/

:root {
    /* --- 红色文化主题变量 --- */
    --theme-red: #C12C1F;       /* 经典中国红 */
    --theme-red-dark: #A4241B;  /* 深红色（悬停态） */
    --theme-gold: #D4AF37;      /* 辉煌金（点缀色） */
    --theme-bg: #F8F2E8;        /* 淡米色背景（宣纸感） */
    --theme-card-bg: #FFFFFF;   /* 卡片背景 */
    --theme-text: #333333;      /* 主要文字 */
    --theme-text-light: #555555;/* 次要文字 */
    --theme-border: #EAE1D3;    /* 边框色 */
}

/* --- 页面背景 --- */
.page-body {
    position: relative;
    background-color: var(--theme-bg);
    color: var(--theme-text);
    overflow-x: hidden;
}

/* 移除旧的背景图覆盖，保持简洁，home页会自带背景 */
.page-body::before, .page-body::after {
    display: none;
}

/* --- 页面过渡与加载器 (功能保持不变，仅微调颜色) --- */
#page-content {
    opacity: 0;
    transition: opacity 0.4s ease-in;
}
#page-content.is-loaded {
    opacity: 1;
}
.page-fade-out {
    opacity: 0 !important;
}
.page-loader {
    position: fixed;
    inset: 0;
    background-color: var(--theme-bg);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease-in-out;
}
.page-loader.is-visible {
    opacity: 1;
    pointer-events: auto;
}
.page-loader .spinner {
    width: 3rem;
    height: 3rem;
    border: 4px solid #fee2e2;
    border-top-color: var(--theme-red);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* --- 统一导航栏 --- */
.nav-bar {
    position: sticky;
    top: 0;
    z-index: 40;
    width: 100%;
    background-color: rgba(254, 242, 242, 0.8); /* 纯白半透明 */
    border-bottom: 1px solid var(--theme-gold); /* 金色底边 */
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(193, 44, 31, 0.05);
}
.nav-container {
    max-width: 80rem;
    margin: auto;
    padding: 0 1rem;
}
@media (min-width: 640px) { .nav-container { padding: 0 1.5rem; } }
@media (min-width: 1024px) { .nav-container { padding: 0 2rem; } }

.nav-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 4rem;
}
.nav-logo-section {
    display: flex;
    align-items: center;
}
.nav-logo-link {
    font-size: 2.25rem;
    font-weight: normal;
    color: var(--theme-red);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    font-family: 'Ma Shan Zheng', cursive;
}
.nav-logo-icon {
    width: 1.75rem;
    height: 1.75rem;
    color: var(--theme-red);
}

.nav-links-section {
    display: none;
}
@media (min-width: 768px) {
  .nav-links-section {
    display: flex;
    align-items: baseline;
    gap: 1rem;
  }
}
.nav-link {
    position: relative;
    color: var(--theme-text);
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 1.125rem;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.2s ease-in-out;
    font-family: "liukaijianti", sans-serif;
}
.nav-link:hover {
    color: var(--theme-red);
}
.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--theme-red);
    transform: scaleX(0);
    transform-origin: bottom right;
    transition: transform 0.3s ease-out;
}
.nav-link:hover::after {
    transform: scaleX(1);
    transform-origin: bottom left;
}
/* .nav-link-active {
    background-color: #FEF2F2;
    color: var(--theme-red);
    font-weight: 600;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
} */
/* 正在激活的导航（高亮）持续毛笔字 + 背景 */
.nav-link-active {
    background-color: #FEF2F2;
    color: var(--theme-red);
    font-weight: 600;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 1.5rem;

    font-family: "liukaijianti", sans-serif;
}
.nav-action-section {
    display: flex;
    align-items: center;
}
.nav-favorite-link {
    color: #9ca3af;
    margin-left: 1rem;
    transition: color 0.2s, transform 0.2s;
}
.nav-favorite-link:hover {
    color: var(--theme-red);
    transform: scale(1.1);
}

/* --- 页面主内容区 --- */
.main-container {
  max-width: 80rem;
  margin: auto;
  padding: 1.5rem 1rem;
}
@media (min-width: 640px) { .main-container { padding: 1.5rem; } }
@media (min-width: 1024px) { .main-container { padding: 1.5rem 2rem; } }

/* 内容卡片通用样式 */
.content-card {
    background-color: var(--theme-card-bg);
    border: 1px solid var(--theme-border);
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    padding: 1.5rem;
    position: relative;
    z-index: 1;
    overflow: hidden;
}




@media (min-width: 1024px) { .content-card { padding: 1.5rem; } }

.page-header-wrapper {
    text-align: start;
    margin-bottom: 2rem;
    /* border-bottom: 1px solid var(--theme-border); */
    padding-bottom: 1.5rem;
}

.page-subtitle {
    color: var(--theme-text-light);
    margin-top: 0.5rem;
    font-size: 1rem;
}


.page-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--theme-red);
    padding: 1.5rem;
    border-bottom: 1px solid var(--theme-border);
    margin: 0;
    font-family: "liukaijianti", sans-serif;
}

/* --- 模块/步骤卡片通用样式 (Beige Card) --- */
.module-card {
    background-color: #fffbf7; /* 米色背景 */
    border: 1px solid var(--theme-border);
    border-radius: 0.5rem;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
    transition: transform 0.3s, border-color 0.3s;
    height: 600px; /* 保底高度，可自动变高 */
}

.module-card:hover, .creation-step:hover {
    transform: translateY(-2px);
    border-color: #fca5a5;
}
/* 模块标题 (Standard Header) */
.step-header {
    display: flex;
    align-items: center;
    margin-bottom: 1.25rem;
    border-bottom: 2px solid #fce8e8;
    padding-bottom: 0.75rem;
}

.module-header {
    margin: 0; padding: 1rem 1.5rem; background: #fffbf7; border-bottom: 1px solid #fce8e8;
}
.module-title-text, .step-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--theme-red);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.module-icon { width: 1.5rem; height: 1.5rem; }

/* 导航栏中的登录/用户信息 */
.auth-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.auth-visitor-mode {
    text-align: center;
    margin-top: 12px;
}
.auth-visitor-mode a {
    color: #6b7280;
    font-size: 0.875rem;
    text-decoration: underline;
}
.auth-visitor-mode a:hover {
    color: var(--theme-text);
}

.nav-login-button {
    background: none;
    border: none;
    cursor: pointer;
    color: #6b7280;
    transition: color 0.2s, transform 0.2s;
    padding: 0.25rem;
}
.nav-login-button:hover {
    color: var(--theme-red);
    transform: scale(1.1);
}
.nav-login-icon {
    width: 1.75rem;
    height: 1.75rem;
}

.nav-user-info {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--theme-text);
}
.nav-logout-button {
    font-size: 0.75rem;
    font-weight: 500;
    color: #6b7280;
    text-decoration: underline;
    background: none;
    border: none;
    cursor: pointer;
}
.nav-logout-button:hover {
    color: var(--theme-red);
}

/* --- 登录/注册弹窗 (红色主题) --- */
.auth-modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    transition: opacity 0.3s ease;
}
.auth-modal-content {
    position: relative;
    background-color: #ffffff;
    padding: 2rem;
    border-radius: 0.75rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    width: 90%;
    max-width: 24rem;
    border-top: 4px solid var(--theme-red); /* 顶部红条 */
}
.auth-modal-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}
.auth-modal-close:hover {
    color: var(--theme-red);
}

.auth-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--theme-red);
    text-align: center;
    margin-bottom: 1.5rem;
}

.auth-input {
    width: 90%;
    padding: 0.75rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
    font-size: 1rem;
    transition: border-color 0.2s;
}
.auth-input:focus {
    outline: none;
    border-color: var(--theme-red);
    box-shadow: 0 0 0 3px rgba(193, 44, 31, 0.1);
}

.auth-button {
    width: 100%;
    padding: 0.75rem;
    border-radius: 0.375rem;
    border: none;
    background-color: var(--theme-red);
    color: #ffffff;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
}
.auth-button:hover {
    background-color: var(--theme-red-dark);
}

.auth-toggle {
    margin-top: 1rem;
    font-size: 0.875rem;
    color: #4b5563;
    text-align: center;
}
.auth-toggle a {
    color: var(--theme-red);
    font-weight: 500;
    text-decoration: none;
}
.auth-toggle a:hover {
    text-decoration: underline;
}

.auth-error {
    background-color: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fca5a5;
    padding: 0.75rem 1rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 1rem;
    text-align: center;
}

.hidden {
    display: none;
}

/* --- (新增) AI 导游样式 --- */
.ai-guide-mascot {
    position: fixed;
    width: 160px;  /* 宽度加大 */
    height: 240px; /* 高度加大，形成立牌比例 */
    bottom: 0;     /* 贴底站立 */
    right: 2rem;
    cursor: pointer;
    z-index: 999;  /* 确保在最上层 */
    
    /* 移除默认的圆形样式 */
    border-radius: 0; 
    background-color: transparent;
    box-shadow: none;
    overflow: visible;
    
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); /* 弹性动画 */
    
    /* 居中图片 */
    display: flex; 
    align-items: flex-end; 
    justify-content: center;
}

.ai-guide-mascot:hover {
    transform: scale(1.05) translateY(-5px);
}

.ai-guide-image {
    width: 100%;
    height: 100%;
    object-fit: contain; /* 保持图片比例完整显示 */
    object-position: bottom center; /* 底部对齐 */
    pointer-events: none;
    /* 给图片轮廓添加投影，制造立体立牌感 */
    filter: drop-shadow(2px 4px 8px rgba(0,0,0,0.4)); 
}

/* 立牌下的名字标签 */
.ai-guide-mascot::after {
    content: "红小韵 AI";
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    
    background: rgba(193, 44, 31, 0.9); /* 红色背景 */
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    white-space: nowrap;
    pointer-events: none;
    opacity: 0.9;
    transition: opacity 0.3s;
}

/* AI 导游对话气泡 (模态框) */
.ai-guide-modal {
    position: fixed;
    bottom: 250px; /* 位于立牌上方 */
    right: 3rem;   /* 与立牌对齐 */
    width: 100%;
    max-width: 320px;
    background-color: var(--theme-card-bg);
    border: 2px solid var(--theme-red); /* 加粗边框 */
    border-radius: 0.75rem;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    /* 增加一个小箭头指向立牌 */
}
.ai-guide-modal::after {
    content: '';
    position: absolute;
    bottom: -10px;
    right: 40px;
    border-width: 10px 10px 0;
    border-style: solid;
    border-color: var(--theme-red) transparent;
    display: block;
    width: 0;
}

.guide-header {
    background-color: var(--theme-red);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 0.6rem 0.6rem 0 0;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.guide-close {
    background: none;
    border: none;
    color: #fce8e8;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}
.guide-messages {
    padding: 1rem;
    max-height: 300px;
    overflow-y: auto;
    border-bottom: 1px solid var(--theme-border);
    background-color: #fff;
}
.guide-message {
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    line-height: 1.5;
}
/* Markdown 样式微调 */
.guide-message p { margin-bottom: 0.5em; }
.guide-message strong { color: var(--theme-red); font-weight: 700; }
.guide-message ul { list-style-type: disc; padding-left: 1.2em; margin-bottom: 0.5em; }

.guide-response {
    background-color: #fef2f2;
    padding: 0.75rem;
    border-radius: 0.5rem;
    color: var(--theme-text);
}
.guide-question-button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.5rem;
    border: 1px solid #fee2e2;
    background-color: #FFFBF7;
    color: var(--theme-red);
    border-radius: 0.375rem;
    transition: background-color 0.2s;
    cursor: pointer;
    font-size: 0.85rem;
}
.guide-question-button:hover {
    background-color: #fee2e2;
}
.guide-input-area {
    padding: 0.75rem;
    background-color: #f9fafb;
    border-radius: 0 0 0.75rem 0.75rem;
    display: flex;
    gap: 0.5rem;
}
.guide-input {
    flex-grow: 1;
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 0.9rem;
}
.guide-input:focus {
    outline: none;
    border-color: var(--theme-red);
}
.guide-send-button {
    background-color: var(--theme-red);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
}
.guide-action-link {
    display: block;
    margin-top: 0.5rem;
    padding: 0.5rem;
    background-color: var(--theme-gold);
    color: white;
    border-radius: 0.375rem;
    text-align: center;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: background-color 0.2s;
}
.guide-action-link:hover {
    background-color: #b89628; /* 深金色 */
}
