﻿/* 全局样式 - 枫叶工坊 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', 'Segoe UI', Roboto, 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', 'Android Emoji', 'EmojiOne Color', system-ui, sans-serif;
}

/* 配色变量 */
:root {
    --bg: #f8fafc;
    --card-bg: rgba(255,255,255,0.9);
    --text: #1e293b;
    --text-light: #64748b;
    --border: rgba(0,0,0,0.08);
    --primary: #3b82f6;
    --accent: #8b5cf6;
    --shadow: 0 10px 25px -5px rgba(0,0,0,0.05);
    --card-hover: rgba(139,92,246,0.1);
    --nav-bg: rgba(255,255,255,0.85);
}

body.dark {
    --bg: #0f172a;
    --card-bg: rgba(30,41,59,0.9);
    --text: #f1f5f9;
    --text-light: #94a3b8;
    --border: rgba(255,255,255,0.1);
    --primary: #60a5fa;
    --accent: #a78bfa;
    --nav-bg: rgba(30,41,59,0.9);
}

/* 修复 footer 与屏幕中间的间隔：使用 Flex 布局填满视口 */
html, body {
    height: 100%;
}
body {
    background: var(--bg);
    color: var(--text);
    transition: background 0.2s, color 0.2s;
    margin: 0;
    padding-top: 70px;  /* 为固定导航栏留出空间 */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* 主要内容区域自动撑开，将 footer 推到底部 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    flex: 1;
    width: 100%;
}

/* 导航栏 - 固定顶部 + 毛玻璃效果 */
.navbar {
    background: var(--nav-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 10px 24px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.logo-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.logo-img {
    height: 36px;
    border-radius: 8px;
}

.site-title {
    display: flex;
    flex-direction: column;
}

.site-name {
    font-size: 20px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    line-height: 1.2;
}

.site-subtitle {
    font-size: 0.7rem;
    color: var(--text-light);
    margin-top: 2px;
    letter-spacing: 0.5px;
}

.nav-links {
    display: flex;
    gap: 24px;
    align-items: center;
    flex-wrap: wrap;
}

.nav-links a {
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: 0.2s;
}

.nav-links a:hover {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.theme-toggle {
    background: rgba(59,130,246,0.12);
    border: none;
    padding: 8px 18px;
    border-radius: 40px;
    color: var(--primary);
    font-weight: 500;
    cursor: pointer;
    transition: 0.2s;
}

.theme-toggle:hover {
    background: rgba(139,92,246,0.2);
    color: var(--accent);
}

/* 按钮样式 */
.btn {
    display: inline-block;
    padding: 0.5rem 1.2rem;
    border-radius: 40px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    text-decoration: none;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: opacity 0.2s, transform 0.1s;
}
.btn:hover {
    opacity: 0.9;
}
.btn-outline {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
    background-image: none;
}
.btn-outline:hover {
    background: rgba(59,130,246,0.1);
    opacity: 1;
}
.btn-primary {
    background: var(--primary);
    background-image: none;
}
.btn-small {
    display: inline-block;
    padding: 0.4rem 1rem;
    border-radius: 2rem;
    font-size: 0.8rem;
    font-weight: 500;
    text-decoration: none;
    transition: opacity 0.2s;
    cursor: pointer;
}
.btn-small:hover {
    opacity: 0.9;
}

/* 卡片样式 */
.module-card, .card {
    background: var(--card-bg);
    backdrop-filter: blur(8px);
    border-radius: 28px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.module-card:hover, .card:hover {
    transform: translateY(-6px);
    border-color: var(--accent);
    background: var(--card-hover);
}

/* 表单行 */
.form-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}
.form-row label {
    width: 70px;
    text-align: right;
    font-weight: 500;
    flex-shrink: 0;
}
.input-wrapper {
    flex: 1;
}
.input-wrapper input,
.input-wrapper select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    font-size: 0.9rem;
}
.code-row {
    display: flex;
    gap: 8px;
    align-items: center;
}
.code-row input {
    flex: 1;
    min-width: 0;
}
.code-row button {
    flex-shrink: 0;
    white-space: nowrap;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    justify-content: center;
    align-items: center;
    z-index: 1100;
}
.modal-content {
    background: var(--card-bg);
    border-radius: 48px;
    padding: 30px;
    max-width: 450px;
    width: 90%;
    border: 1px solid var(--border);
    text-align: center;
}
.close-modal, .close-qr {
    float: right;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-light);
}
.tab-buttons {
    display: flex;
    gap: 15px;
    margin: 20px 0;
    border-bottom: 1px solid var(--border);
}
.tab {
    padding: 8px 20px;
    cursor: pointer;
    color: var(--text-light);
}
.tab.active {
    color: var(--primary);
    border-bottom: 2px solid var(--primary);
}
.form-pane {
    display: none;
}
.form-pane.active {
    display: block;
}
.error-msg {
    background: #fee;
    color: #c00;
    padding: 8px;
    border-radius: 16px;
    margin-bottom: 15px;
    display: none;
}

/* Toast 提示 */
.custom-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: #4caf50;
    color: white;
    padding: 12px 24px;
    border-radius: 60px;
    font-family: 'Inter', 'Segoe UI Emoji', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 2000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    animation: fadeInUp 0.2s ease;
}
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* ========== 悬浮卡通形象样式（气泡和菜单显示在左侧，形象增加动画） ========== */
.floating-leaf-wrapper {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

/* 气泡提示框 - 显示在左侧 */
.leaf-bubble {
    background: rgba(255, 255, 255, 0.96);
    border-radius: 28px;
    padding: 8px 18px;
    max-width: 220px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
    position: absolute;
    bottom: 50%;
    right: 100%;
    margin-right: 12px;
    transform: translateY(50%);
    white-space: nowrap;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(0, 0, 0, 0.06);
    font-family: 'Inter', 'Segoe UI Emoji', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: #2c3e50;
    text-align: center;
}
.bubble-tail {
    position: absolute;
    top: 50%;
    right: -10px;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
    border-left: 12px solid rgba(255, 255, 255, 0.96);
    filter: drop-shadow(2px 0 2px rgba(0, 0, 0, 0.08));
}

/* 卡通形象本体 - 增加动画效果，悬浮时暂停动画 */
.floating-leaf {
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, #ffb347, #ff8c00);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(2px);
    overflow: hidden;
    transition: none;
}
.floating-leaf:hover {
    animation-play-state: paused !important;
    transform: none !important;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}
.leaf-emoji {
    font-size: 60px;
}
.floating-leaf:hover .leaf-emoji {
    transform: none;
}
.floating-leaf img {
    width: 80%;
    height: 80%;
    object-fit: contain;
}
.floating-leaf:hover img {
    transform: none;
}

/* 动画定义 */
@keyframes leafFloat {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-12px); }
    100% { transform: translateY(0px); }
}
@keyframes leafRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
@keyframes leafBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-16px); }
}

.float {
    animation: leafFloat 3s ease-in-out infinite;
}
.rotate {
    animation: leafRotate 4s linear infinite;
}
.bounce {
    animation: leafBounce 1s ease-in-out infinite;
}

/* 菜单面板 - 显示在左侧，与卡通形象平齐 */
.leaf-menu {
    position: absolute;
    bottom: 0;
    right: 100%;
    margin-right: 12px;
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    border-radius: 28px;
    padding: 12px 0;
    min-width: 180px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    display: none;
    flex-direction: column;
    transition: opacity 0.2s;
}
.leaf-menu a {
    display: block;
    padding: 10px 20px;
    color: var(--text);
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
}
.leaf-menu a:hover {
    background: rgba(139, 92, 246, 0.15);
    color: var(--accent);
}
.leaf-menu hr {
    margin: 6px 0;
    border-color: var(--border);
}

/* 页脚样式 */
.footer {
    background: var(--card-bg);
    border-top: 1px solid var(--border);
    padding: 1.5rem;
    text-align: center;
    color: var(--text-light);
    margin-top: 0;
    width: 100%;
}

/* 响应式调整 */
@media (max-width: 768px) {
    body {
        padding-top: 60px;  /* 移动端导航栏高度略小 */
    }
    .navbar {
        padding: 8px 16px;
    }
    .floating-leaf-wrapper {
        bottom: 20px;
        right: 20px;
    }
    .floating-leaf {
        width: 70px;
        height: 70px;
    }
    .leaf-emoji {
        font-size: 42px;
    }
    .leaf-bubble {
        font-size: 12px;
        padding: 6px 14px;
        max-width: 160px;
        white-space: normal;
        word-break: break-word;
        margin-right: 8px;
    }
    .bubble-tail {
        right: -8px;
        border-top: 8px solid transparent;
        border-bottom: 8px solid transparent;
        border-left: 10px solid rgba(255, 255, 255, 0.96);
    }
    .leaf-menu {
        min-width: 150px;
        margin-right: 8px;
    }
    .leaf-menu a {
        padding: 8px 16px;
        font-size: 12px;
        white-space: normal;
    }
    .float {
        animation: leafFloat 2.5s ease-in-out infinite;
    }
    .bounce {
        animation: leafBounce 0.8s ease-in-out infinite;
    }
}