/* 花知百科 - 主样式表 */
:root {
    --primary: #e91e63;
    --primary-light: #f48fb1;
    --primary-dark: #c2185b;
    --accent: #ff9800;
    --green: #4caf50;
    --bg: #fdf6f0;
    --bg-card: #ffffff;
    --text: #333333;
    --text-light: #888888;
    --text-muted: #aaaaaa;
    --border: #f0e6de;
    --tag-bg: #f1e8da;
    --shadow: 0 2px 12px rgba(0,0,0,0.06);
    --radius: 12px;
    --container: 1200px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    font-size: 15px;
}
a { color: inherit; text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--primary); }
img { max-width: 100%; height: auto; }
.container { max-width: var(--container); margin: 0 auto; padding: 0 16px; }

/* ========== 头部导航 ========== */
.site-header { margin-bottom: 20px;
    background: #fff;
    box-shadow: 0 1px 8px rgba(0,0,0,0.06);
    position: sticky;
    top: 0;
    z-index: 1000;
}
.header-inner {
    display: flex;
    align-items: center;
    height: 64px;
    gap: 20px;
}
.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    flex-shrink: 0;
}
.logo-icon { font-size: 28px; }
.main-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
}
.nav-link {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    color: #555;
    transition: all 0.2s;
    white-space: nowrap;
}
.nav-link:hover, .nav-link.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
}
.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.search-form {
    display: flex;
    align-items: center;
    background: #f5f5f5;
    border-radius: 20px;
    padding: 0 4px 0 14px;
    border: 1px solid transparent;
    transition: border-color 0.3s;
}
.search-form:focus-within { border-color: var(--primary); background: #fff; }
.search-form input {
    border: none;
    background: transparent;
    outline: none;
    padding: 8px 0;
    font-size: 14px;
    width: 160px;
}
.search-btn {
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 16px;
    padding: 6px;
}
.btn-login, .btn-user {
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 13px;
    background: var(--primary);
    color: #fff;
}
.btn-login:hover, .btn-user:hover { background: var(--primary-dark); color: #fff; }
.btn-logout { font-size: 13px; color: #999; }
.mobile-menu-btn { display: none; border: none; background: transparent; font-size: 24px; cursor: pointer; }

/* ========== 轮播图 ========== */
.hero-carousel {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    height: 360px;
    margin-bottom: 30px;
}
.carousel-track {
    display: flex;
    transition: transform 0.5s ease;
    height: 100%;
}
.carousel-slide {
    min-width: 100%;
    position: relative;
}
.carousel-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.carousel-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 30px;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    color: #fff;
}
.carousel-overlay h2 { font-size: 24px; margin-bottom: 8px; }
.carousel-overlay p { font-size: 14px; opacity: 0.9; }
.carousel-dots {
    position: absolute;
    bottom: 16px;
    right: 20px;
    display: flex;
    gap: 8px;
}
.carousel-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    cursor: pointer;
    transition: background 0.3s;
}
.carousel-dot.active { background: #fff; width: 28px; border-radius: 5px; }
.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255,255,255,0.8);
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
    z-index: 2;
}
.carousel-btn:hover { background: #fff; }
.carousel-prev { left: 16px; }
.carousel-next { right: 16px; }

/* ========== 分类卡片区 ========== */
.category-cards {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    margin-bottom: 30px;
}
.category-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px 16px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: all 0.3s;
    cursor: pointer;
}
.category-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(233,30,99,0.12);
}
.category-card .icon { font-size: 36px; margin-bottom: 8px; display: block; }
.category-card .name { font-size: 15px; font-weight: 600; color: var(--text); }
.category-card .desc { font-size: 12px; color: var(--text-light); margin-top: 4px; }

/* ========== 内容区布局 ========== */
.content-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 24px;
    margin-bottom: 40px;
}
.content-layout.with-sidebar-left {
    grid-template-columns: 260px 1fr 280px;
}

/* ========== 区块标题 ========== */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--primary);
}
.section-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}
.section-title::before {
    content: '';
    width: 4px;
    height: 22px;
    background: var(--primary);
    border-radius: 2px;
}
.section-more { color: var(--text-light); font-size: 14px; }
.section-more:hover { color: var(--primary); }

/* ========== 文章卡片 ========== */
.article-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}
.article-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.3s;
}
.article-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}
.article-card .card-image {
    position: relative;
    height: 180px;
    overflow: hidden;
}
.article-card .card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}
.article-card:hover .card-image img { transform: scale(1.05); }
.article-card .card-category {
    position: absolute;
    top: 12px;
    left: 12px;
    background: var(--primary);
    color: #fff;
    font-size: 12px;
    padding: 2px 10px;
    border-radius: 12px;
}
.article-card .card-body { padding: 16px; }
.article-card .card-title {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.5;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.article-card .card-excerpt {
    font-size: 13px;
    color: var(--text-light);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 12px;
}
.article-card .card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: var(--text-muted);
    flex-wrap: wrap;
}
.card-meta span { display: flex; align-items: center; gap: 3px; }

/* ========== 文章列表样式（横向卡片） ========== */
.article-list-item {
    display: flex;
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
    transition: all 0.3s;
}
.article-list-item:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}
.article-list-item .list-image {
    width: 240px;
    min-height: 160px;
    flex-shrink: 0;
    overflow: hidden;
}
.article-list-item .list-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.article-list-item .list-body {
    padding: 16px 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.article-list-item .list-title {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.article-list-item .list-excerpt {
    font-size: 13px;
    color: var(--text-light);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 12px;
}
.article-list-item .card-meta { font-size: 12px; color: var(--text-muted); display: flex; gap: 12px; }

/* ========== 侧边栏 ========== */
.sidebar { min-width: 0; }
.sidebar-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}
.sidebar-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border);
}
.hot-list { list-style: none; }
.hot-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid #f8f4ef;
    font-size: 14px;
}
.hot-list li:last-child { border-bottom: none; }
.hot-list li a {
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.hot-list li a:hover { color: var(--primary); }
.hot-rank {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}
.rank-top { background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; }
.rank-normal { background: #f0e6de; color: #999; }

.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    background: var(--tag-bg);
    border-radius: 20px;
    font-size: 13px;
    color: #8b6914;
    transition: all 0.2s;
}
.tag-item:hover { background: var(--primary); color: #fff; }
.tag-count { font-size: 11px; opacity: 0.7; }

/* ========== 文章详情 ========== */
.article-detail {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 36px;
    box-shadow: var(--shadow);
}
.article-detail .article-header { margin-bottom: 24px; }
.article-detail .article-title { font-size: 28px; font-weight: 700; line-height: 1.4; margin-bottom: 16px; }
.article-detail .article-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 14px;
    color: var(--text-light);
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}
.article-detail .article-content {
    font-size: 16px;
    line-height: 2;
    color: #444;
}
.article-content h2 { font-size: 22px; margin: 32px 0 16px; padding-left: 12px; border-left: 4px solid var(--primary); }
.article-content h3 { font-size: 18px; margin: 24px 0 12px; }
.article-content p { margin-bottom: 16px; }
.article-content img { border-radius: 8px; margin: 16px 0; }
.article-content blockquote {
    background: #fef3e7;
    border-left: 4px solid var(--accent);
    padding: 16px 20px;
    margin: 16px 0;
    border-radius: 0 8px 8px 0;
    color: #666;
}
.article-content ul, .article-content ol { margin: 16px 0; padding-left: 24px; }
.article-content li { margin-bottom: 8px; }
.article-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }
.article-actions {
    display: flex;
    gap: 16px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}
.action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 24px;
    border-radius: 24px;
    border: 1px solid var(--border);
    background: #fff;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}
.action-btn:hover { border-color: var(--primary); color: var(--primary); }
.action-btn.liked { background: #fce4ec; border-color: var(--primary); color: var(--primary); }

/* 上下篇 */
.prev-next {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 24px;
}
.prev-next a {
    display: block;
    padding: 16px;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    font-size: 14px;
}
.prev-next a .label { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }

/* ========== 分页 ========== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 30px 0;
}
.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s;
}
.pagination a { background: var(--bg-card); box-shadow: var(--shadow); color: var(--text); }
.pagination a:hover { background: var(--primary); color: #fff; }
.pagination .current { background: var(--primary); color: #fff; }
.pagination .disabled { opacity: 0.5; pointer-events: none; }

/* ========== 面包屑 ========== */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 20px;
}
.breadcrumb a { color: var(--text-light); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .sep { color: #ddd; }

/* ========== 搜索页 ========== */
.search-hero {
    text-align: center;
    padding: 40px 0 30px;
}
.search-hero h1 { font-size: 24px; margin-bottom: 16px; color: var(--text); }
.search-hero .search-form-large {
    display: flex;
    max-width: 600px;
    margin: 0 auto;
    background: #fff;
    border-radius: 30px;
    overflow: hidden;
    box-shadow: var(--shadow);
}
.search-hero .search-form-large input {
    flex: 1;
    border: none;
    outline: none;
    padding: 14px 24px;
    font-size: 16px;
}
.search-hero .search-form-large button {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 14px 32px;
    font-size: 16px;
    cursor: pointer;
}

/* ========== 登录/注册 ========== */
.auth-container {
    max-width: 420px;
    margin: 60px auto;
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 40px;
    box-shadow: var(--shadow);
}
.auth-container h2 { text-align: center; font-size: 24px; margin-bottom: 24px; }
.auth-container .form-group { margin-bottom: 16px; }
.auth-container label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.auth-container input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
}
.auth-container input:focus { outline: none; border-color: var(--primary); }
.auth-container .btn-submit {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
}
.auth-container .btn-submit:hover { background: var(--primary-dark); }
.auth-container .auth-link { text-align: center; margin-top: 16px; font-size: 14px; color: var(--text-light); }
.auth-container .auth-link a { color: var(--primary); font-weight: 600; }

/* ========== 404页面 ========== */
.page-404 {
    text-align: center;
    padding: 80px 0;
}
.page-404 .icon-404 { font-size: 80px; margin-bottom: 16px; }
.page-404 h2 { font-size: 28px; margin-bottom: 12px; }
.page-404 p { color: var(--text-light); margin-bottom: 24px; }
.page-404 a { display: inline-block; padding: 10px 24px; background: var(--primary); color: #fff; border-radius: 8px; }

/* ========== 页脚 ========== */
.site-footer {
    background: #2c1810;
    color: #cbb89d;
    padding: 40px 0 0;
    margin-top: 40px;
}
.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 30px;
    padding-bottom: 30px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.footer-logo { font-size: 20px; font-weight: 700; color: #fff; margin-bottom: 12px; }
.footer-about p { font-size: 13px; line-height: 1.8; }
.footer-links h4 { color: #fff; font-size: 15px; margin-bottom: 14px; }
.footer-links ul { list-style: none; }
.footer-links li { margin-bottom: 8px; }
.footer-links a { font-size: 13px; color: #cbb89d; }
.footer-links a:hover { color: var(--primary-light); }
.footer-bottom {
    text-align: center;
    padding: 16px 0;
    font-size: 13px;
    color: #8a7560;
}
.footer-bottom a { color: #8a7560; }

/* ========== 空状态 ========== */
.empty { text-align: center; color: var(--text-muted); padding: 40px 0; font-size: 14px; }

/* ========== 消息提示 ========== */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.alert-error { background: #fce4ec; color: #c62828; }
.alert-success { background: #e8f5e9; color: #2e7d32; }

/* ========== 响应式 ========== */
@media (max-width: 1024px) {
    .content-layout { grid-template-columns: 1fr; }
    .content-layout.with-sidebar-left { grid-template-columns: 1fr; }
    .article-grid { grid-template-columns: repeat(2, 1fr); }
    .category-cards { grid-template-columns: repeat(3, 1fr); }
    .footer-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .main-nav { display: none; flex-direction: column; position: absolute; top: 64px; left: 0; right: 0; background: #fff; box-shadow: 0 8px 24px rgba(0,0,0,0.1); padding: 16px; z-index: 999; }
    .main-nav.show { display: flex; }
    .mobile-menu-btn { display: block; }
    .search-form { display: none; }
    .header-inner { gap: 12px; }
    .article-grid { grid-template-columns: 1fr; }
    .category-cards { grid-template-columns: repeat(2, 1fr); }
    .hero-carousel { height: 220px; }
    .article-detail { padding: 20px; }
    .article-detail .article-title { font-size: 22px; }
    .prev-next { grid-template-columns: 1fr; }
    .footer-grid { grid-template-columns: 1fr; }
    .article-list-item { flex-direction: column; }
    .article-list-item .list-image { width: 100%; height: 180px; }
}
