/* css/style.css */

/* 1. 核心变量配置 (莫兰迪色系) */
:root {
    --bg-color: #F2F0EB;
    --card-bg: #FFFFFF;
    --text-main: #4A4A4A;
    --text-muted: #64748b;
    /* slate-500 */
    --accent: #6B8E9B;
    --accent-hover: #567582;
    --border: #E5E5E0;
    --font-sans: 'Inter', sans-serif;
    --font-serif: 'Playfair Display', serif;
}

/* 2. 基础重置 */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-sans);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 3. 通用工具类 (为了兼容之前的布局) */
.hidden {
    display: none !important;
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.justify-center {
    justify-content: center;
}

.text-center {
    text-align: center;
}

.w-full {
    width: 100%;
}

.max-w-5xl {
    max-width: 64rem;
    margin-left: auto;
    margin-right: auto;
}

.max-w-4xl {
    max-width: 56rem;
    margin-left: auto;
    margin-right: auto;
}

.max-w-3xl {
    max-width: 48rem;
    margin-left: auto;
    margin-right: auto;
}

.max-w-2xl {
    max-width: 42rem;
    margin-left: auto;
    margin-right: auto;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.mb-6 {
    margin-bottom: 1.5rem;
}

.mb-10 {
    margin-bottom: 2.5rem;
}

.mb-16 {
    margin-bottom: 4rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mt-4 {
    margin-top: 1rem;
}

.mt-6 {
    margin-top: 1.5rem;
}

.mt-12 {
    margin-top: 3rem;
}

.mt-24 {
    margin-top: 6rem;
}

.p-6 {
    padding: 1.5rem;
}

.p-8 {
    padding: 2rem;
}

.py-8 {
    padding-top: 2rem;
    padding-bottom: 2rem;
}

.py-12 {
    padding-top: 3rem;
    padding-bottom: 3rem;
}

.px-6 {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

.space-x-6> :not([hidden])~ :not([hidden]) {
    margin-left: 1.5rem;
}

.space-y-4> :not([hidden])~ :not([hidden]) {
    margin-top: 1rem;
}

.grid {
    display: grid;
}

.gap-6 {
    gap: 1.5rem;
}

.gap-12 {
    gap: 3rem;
}

/* 响应式 Grid */
@media (min-width: 768px) {
    .md\:grid-cols-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .md\:flex {
        display: flex;
    }

    .md\:hidden {
        display: none;
    }

    .md\:text-4xl {
        font-size: 2.25rem;
    }
}

@media (min-width: 1024px) {
    .lg\:grid-cols-3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* 4. 组件样式优化 */

/* 头部导航 */
header {
    border-bottom: 1px solid var(--border);
    background: white;
}

.brand-title {
    font-family: var(--font-serif);
    font-size: 1.875rem;
    color: #1e293b;
    letter-spacing: -0.025em;
    font-weight: 700;
    text-decoration: none;
}

.brand-accent {
    font-style: italic;
    color: var(--accent);
}

.nav-link {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
    text-decoration: none;
    transition: color 0.2s;
}

.nav-link:hover {
    color: var(--accent);
}

.nav-link.active {
    color: var(--accent);
    border-bottom: 2px solid var(--accent);
    padding-bottom: 0.25rem;
}

/* 文本排版 */
h1,
h2,
h3 {
    font-family: var(--font-serif);
    color: #334155;
    line-height: 1.2;
}

.text-hero {
    font-size: 1.875rem;
    line-height: 1.3;
}

.text-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
}

.prose {
    max-width: 65ch;
    color: #475569;
}

.prose p {
    margin-bottom: 1.25em;
}

/* 卡片与输入框 */
.card-base {
    background: var(--card-bg);
    border-radius: 1rem;
    border: 1px solid #f1f5f9;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

textarea {
    width: 100%;
    height: 20rem;
    padding: 1.5rem;
    border-radius: 1rem;
    border: 1px solid transparent;
    background: #fff;
    font-size: 1.125rem;
    color: #334155;
    resize: none;
    outline: none;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    font-family: var(--font-sans);
}

textarea:focus {
    ring: 2px solid var(--accent);
    box-shadow: 0 0 0 3px rgba(107, 142, 155, 0.2);
}

textarea::placeholder {
    color: #cbd5e1;
    font-family: var(--font-serif);
    font-style: italic;
}

.select-wrapper {
    background: rgba(242, 240, 235, 0.8);
    backdrop-filter: blur(4px);
    padding: 0.5rem;
    border-radius: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: center;
}

select {
    background: transparent;
    border: none;
    font-size: 0.875rem;
    color: #334155;
    font-weight: 500;
    width: 100%;
    outline: none;
    cursor: pointer;
}

/* 按钮 */
.btn-primary {
    width: 100%;
    background-color: var(--accent);
    color: white;
    padding: 1rem;
    border-radius: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.025em;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 6px -1px rgba(107, 142, 155, 0.2);
    display: flex;
    justify-content: center;
    align-items: center;
}

.btn-primary:hover {
    background-color: var(--accent-hover);
    transform: translateY(-1px);
}

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

.btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* 结果区域 */
.output-box {
    height: 20rem;
    overflow-y: auto;
    color: #334155;
    font-size: 1.125rem;
    line-height: 1.6;
    white-space: pre-wrap;
    font-family: var(--font-serif);
}

.copy-btn {
    font-size: 0.75rem;
    color: #94a3b8;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.copy-btn:hover {
    color: var(--accent);
}

/* 广告位 */
.ad-pattern {
    background-image: radial-gradient(#cbd5e1 1px, transparent 1px);
    background-size: 20px 20px;
    background-color: #f8fafc;
    border-radius: 0.75rem;
    border: 1px solid #e2e8f0;
}

/* 动画 */
.animate-spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}


/* ================= 修复加载图标样式 ================= */

/* 定义 h-5 和 w-5 的大小 (20px) */
.h-5 {
    height: 1.25rem;
}

.w-5 {
    width: 1.25rem;
}

.ml-3 {
    margin-left: 0.75rem;
}

/* 确保 SVG 不会变形 */
#loader {
    min-width: 1.25rem;
    min-height: 1.25rem;
}


/* ================= Library 卡片专用样式 (补丁) ================= */

.scenario-card {
    background-color: #FFFFFF;
    padding: 1.5rem;
    border-radius: 0.75rem;
    border: 1px solid #f1f5f9;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 16rem;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    /* 默认阴影 */
}

.scenario-card:hover {
    transform: translateY(-4px);
    /* 悬浮上浮 */
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    /* 悬浮加深阴影 */
    border-color: var(--accent);
}

.card-tag {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.card-title {
    font-family: var(--font-serif);
    font-size: 1.25rem;
    color: #1e293b;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.card-desc {
    font-size: 0.875rem;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.read-more {
    margin-top: 1rem;
    font-size: 0.875rem;
    color: var(--accent);
    font-weight: 500;
    display: flex;
    align-items: center;
}


/* ================== 底部版权署名样式 ================== */
.powered-by {
    margin-top: 10px;
    font-size: 0.75rem;
    /* 12px 左右，比较小 */
    opacity: 0.6;
    /* 稍微淡一点，不干扰主内容 */
    font-family: sans-serif;
    transition: opacity 0.2s;
    text-align: center;
}

.powered-by:hover {
    opacity: 1;
    /* 鼠标放上去变亮 */
}

.powered-by a {
    color: inherit;
    /* 跟随父元素颜色 */
    text-decoration: none;
    font-weight: 600;
    /* 稍微加粗品牌名 */
    border-bottom: 1px dashed currentColor;
    /* 虚线底边，显示可点击 */
}


/* ================== 下拉菜单 (Dropdown) 样式 ================== */

/* 下拉容器 */
.dropdown {
    position: relative;
    display: inline-block;
    height: 100%;
}

/* 下拉触发按钮 (AI Tools ▾) */
.dropbtn {
    background-color: transparent;
    color: #555;
    padding: 10px 0;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
    font-weight: 500;
    font-family: inherit;
    /* 继承主字体 */
    transition: color 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* 鼠标悬停时按钮变色 */
.dropdown:hover .dropbtn,
.dropbtn:hover {
    color: #6B8E9B;
    /* 使用你的品牌色 */
}

/* 下拉菜单内容框 */
.dropdown-content {
    display: none;
    /* 默认隐藏 */
    position: absolute;
    background-color: #ffffff;
    min-width: 240px;
    /* 宽度适中 */
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    /* 漂亮的阴影 */
    border-radius: 8px;
    border: 1px solid #f0f0f0;
    z-index: 1000;
    top: 100%;
    /* 在按钮正下方 */
    left: 50%;
    transform: translateX(-50%);
    /* 居中对齐 */
    padding: 8px 0;
    animation: fadeIn 0.2s ease-in-out;
}

/* 鼠标悬停在容器上时，显示菜单 */
.dropdown:hover .dropdown-content {
    display: block;
}

/* 菜单里的链接 */
.dropdown-content a {
    color: #333;
    padding: 12px 20px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
    transition: background 0.2s;
    white-space: nowrap;
    /* 防止换行 */
}

/* 链接悬停效果 */
.dropdown-content a:hover {
    background-color: #f8f9fa;
    color: #6B8E9B;
}

/* 菜单里的小图标 */
.menu-icon {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
}

/* 简单的淡入动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, 10px);
    }

    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

/* 移动端适配 (防止下拉菜单在手机上错位) */
@media (max-width: 768px) {
    .dropdown-content {
        position: static;
        box-shadow: none;
        border: none;
        padding-left: 20px;
        transform: none;
        display: none;
        /* 手机上默认也是隐藏，点击展开逻辑由之前的 JS 控制或保持隐藏 */
    }

    .dropdown:hover .dropdown-content {
        display: block;
        /* 简单的手机端 Hover 模拟 */
    }
}