/* ============================================
   生肖算命 - 仿站样式
   Red theme matching original Miaoda site
   ============================================ */

/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
}
a { color: #333; text-decoration: none; transition: color .2s; }
a:hover { color: #dc2626; }
img { max-width: 100%; height: auto; display: block; }
ul, ol { list-style: none; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 16px; }

/* === Header / Navbar === */
.navbar {
    background: #dc2626;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.navbar .container {
    display: flex;
    align-items: center;
    height: 56px;
    gap: 8px;
}
.navbar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    font-size: 20px;
    font-weight: 700;
    white-space: nowrap;
    margin-right: 16px;
}
.navbar-brand svg { width: 28px; height: 28px; fill: #fff; }
.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
}
.nav-links a {
    color: rgba(255,255,255,.9);
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 500;
    transition: background .2s, color .2s;
    white-space: nowrap;
}
.nav-links a:hover, .nav-links a.active {
    background: rgba(255,255,255,.15);
    color: #fff;
}
.nav-right {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}
.search-box {
    display: flex;
    align-items: center;
    background: rgba(255,255,255,.15);
    border-radius: 20px;
    padding: 0 12px;
    border: 1px solid rgba(255,255,255,.2);
}
.search-box input {
    background: transparent;
    border: none;
    color: #fff;
    padding: 6px 8px;
    font-size: 14px;
    width: 160px;
    outline: none;
}
.search-box input::placeholder { color: rgba(255,255,255,.6); }
.search-box button {
    background: none;
    border: none;
    color: rgba(255,255,255,.8);
    cursor: pointer;
    padding: 4px;
}
.btn-login {
    color: #fff;
    background: rgba(255,255,255,.2);
    padding: 6px 20px;
    border-radius: 20px;
    font-size: 14px;
    border: 1px solid rgba(255,255,255,.3);
    cursor: pointer;
    transition: background .2s;
}
.btn-login:hover { background: rgba(255,255,255,.3); color: #fff; }

/* Hamburger for mobile */
.hamburger { display: none; background: none; border: none; color: #fff; font-size: 24px; cursor: pointer; }

/* === Carousel / Hero Section === */
.carousel-section {
    margin: 24px auto;
    max-width: 1200px;
    padding: 0 16px;
}
.carousel {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    height: 300px;
    background: #333;
}
.carousel-slides {
    display: flex;
    height: 100%;
    transition: transform .5s ease;
}
.carousel-slide {
    min-width: 100%;
    height: 100%;
    position: relative;
}
.carousel-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.carousel-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 24px 32px;
    background: linear-gradient(transparent, rgba(0,0,0,.7));
    color: #fff;
}
.carousel-overlay h3 { font-size: 22px; margin-bottom: 8px; }
.carousel-overlay p { font-size: 14px; opacity: .85; }
.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,.3);
    border: none;
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s;
}
.carousel-btn:hover { background: rgba(255,255,255,.5); }
.carousel-btn.prev { left: 16px; }
.carousel-btn.next { right: 16px; }
.carousel-read-more {
    display: inline-block;
    margin-top: 12px;
    padding: 8px 20px;
    background: rgba(255,255,255,.15);
    color: #fff;
    border: 1px solid rgba(255,255,255,.4);
    border-radius: 6px;
    font-size: 14px;
    transition: background .2s;
}
.carousel-read-more:hover { background: rgba(255,255,255,.3); color: #fff; }

/* === Main Layout === */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px 32px;
    display: flex;
    gap: 24px;
}
.sidebar-left { width: 240px; flex-shrink: 0; }
.content-center { flex: 1; min-width: 0; }
.sidebar-right { width: 240px; flex-shrink: 0; }

/* === Section Titles === */
.section-title {
    font-size: 20px;
    font-weight: 700;
    color: #dc2626;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.section-title svg { width: 20px; height: 20px; }

/* === Sidebar Cards === */
.sidebar-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.sidebar-card-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 6px;
    color: #dc2626;
}
.sidebar-card-title svg { width: 18px; height: 18px; }

/* Almanac (老黄历) */
.almanac-date { text-align: center; margin-bottom: 12px; }
.almanac-date .year { font-size: 24px; font-weight: 700; color: #333; }
.almanac-date .weekday { font-size: 13px; color: #888; margin-top: 2px; }
.almanac-lunar { text-align: center; color: #dc2626; font-size: 15px; font-weight: 600; margin-bottom: 16px; }
.almanac-section { margin-bottom: 12px; }
.almanac-section-icon { font-size: 14px; margin-bottom: 6px; }
.almanac-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.almanac-tag {
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 12px;
    border: 1px solid #e5e5e5;
}
.almanac-tag.yi { color: #dc2626; border-color: #fecaca; background: #fef2f2; }
.almanac-tag.ji { color: #666; border-color: #e5e5e5; background: #f9f9f9; }

/* Hot tags */
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-item {
    display: inline-block;
    padding: 4px 12px;
    font-size: 14px;
    color: #555;
    transition: color .2s;
}
.tag-item:hover { color: #dc2626; }

/* Hot articles sidebar list */
.hot-article-list { list-style: none; }
.hot-article-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}
.hot-article-item:last-child { border-bottom: none; }
.hot-rank {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    margin-top: 2px;
}
.hot-rank.r1 { background: #dc2626; }
.hot-rank.r2 { background: #ea580c; }
.hot-rank.r3 { background: #f59e0b; }
.hot-rank.r4, .hot-rank.r5 { background: #9ca3af; }
.hot-article-info { flex: 1; min-width: 0; }
.hot-article-info a {
    font-size: 14px;
    color: #333;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.4;
}
.hot-article-info a:hover { color: #dc2626; }
.hot-article-views { font-size: 12px; color: #999; margin-top: 4px; }

/* Liked articles sidebar */
.liked-article-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}
.liked-article-item:last-child { border-bottom: none; }
.liked-rank {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    margin-top: 2px;
    background: #f87171;
}
.liked-article-info { flex: 1; min-width: 0; }
.liked-article-info a {
    font-size: 14px;
    color: #333;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}
.liked-article-info a:hover { color: #dc2626; }
.liked-article-likes { font-size: 12px; color: #999; margin-top: 4px; }

/* === Article Cards (3-column grid) === */
.article-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}
.article-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
    transition: transform .2s, box-shadow .2s;
}
.article-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,.12);
}
.article-card-img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    background: #e5e5e5;
}
.article-card-body { padding: 16px; }
.article-card-category {
    display: inline-block;
    padding: 2px 10px;
    background: #dc2626;
    color: #fff;
    border-radius: 4px;
    font-size: 12px;
    margin-bottom: 8px;
}
.article-card-category.cat-shengxiaoyunshi { background: #dc2626; }
.article-card-category.cat-shengxiaopeidui { background: #ea580c; }
.article-card-category.cat-shengxiaoxingge { background: #7c3aed; }
.article-card-category.cat-shengxiaocaiyun { background: #dc2626; }
.article-card-category.cat-shengxiaoshiye { background: #0891b2; }
.article-card-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.article-card-title:hover { color: #dc2626; }
.article-card-excerpt {
    font-size: 13px;
    color: #888;
    margin-bottom: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.5;
}
.article-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}
.article-card-tag {
    padding: 2px 8px;
    background: #f5f5f5;
    color: #666;
    border-radius: 4px;
    font-size: 12px;
}
.article-card-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 12px;
    color: #aaa;
    padding-top: 10px;
    border-top: 1px solid #f0f0f0;
}
.article-card-meta span { display: flex; align-items: center; gap: 4px; }

/* === Breadcrumb === */
.breadcrumb {
    padding: 16px 0;
    font-size: 14px;
    color: #888;
    max-width: 1200px;
    margin: 0 auto;
    padding-left: 16px;
    padding-right: 16px;
}
.breadcrumb a { color: #888; }
.breadcrumb a:hover { color: #dc2626; }
.breadcrumb span { margin: 0 6px; }

/* === Article Detail === */
.article-detail-layout {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px 32px;
    display: flex;
    gap: 24px;
}
.article-detail-main { flex: 1; min-width: 0; }
.article-detail-content {
    background: #fff;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.article-detail-title {
    font-size: 26px;
    font-weight: 700;
    color: #333;
    margin-bottom: 16px;
    line-height: 1.4;
}
.article-detail-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    font-size: 14px;
    color: #888;
}
.article-detail-meta .cat-badge {
    padding: 2px 10px;
    background: #dc2626;
    color: #fff;
    border-radius: 4px;
    font-size: 12px;
}
.article-detail-meta .tag-badge {
    padding: 2px 8px;
    background: #f0f0f0;
    color: #666;
    border-radius: 4px;
    font-size: 12px;
}
.article-body {
    font-size: 16px;
    line-height: 1.8;
    color: #444;
}
.article-body h2 { font-size: 22px; margin: 24px 0 12px; color: #333; }
.article-body h3 { font-size: 18px; margin: 20px 0 10px; color: #333; }
.article-body p { margin-bottom: 16px; }
.article-body img { border-radius: 8px; margin: 16px 0; max-width: 100%; }
.article-body strong { color: #333; }

/* Article actions */
.article-actions {
    display: flex;
    gap: 16px;
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid #f0f0f0;
}
.action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    background: #fff;
    color: #666;
    cursor: pointer;
    font-size: 14px;
    transition: all .2s;
}
.action-btn:hover { border-color: #dc2626; color: #dc2626; }
.action-btn.active { border-color: #dc2626; color: #dc2626; background: #fef2f2; }

/* Prev/Next navigation */
.prev-next-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 24px;
    padding: 20px 0;
    border-top: 1px solid #f0f0f0;
    border-bottom: 1px solid #f0f0f0;
}
.prev-next-item {
    max-width: 48%;
}
.prev-next-label { font-size: 13px; color: #999; margin-bottom: 4px; }
.prev-next-title {
    font-size: 14px;
    color: #333;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.prev-next-title:hover { color: #dc2626; }
.prev-next-item.next { text-align: right; }

/* Related articles */
.related-section { margin-top: 32px; }
.related-section .section-title { font-size: 20px; margin-bottom: 16px; }

/* === Category / Tag Page Header === */
.page-header {
    padding: 24px 0 8px;
    max-width: 1200px;
    margin: 0 auto;
    padding-left: 16px;
    padding-right: 16px;
}
.page-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: #333;
}
.page-header p { font-size: 14px; color: #888; margin-top: 4px; }

/* === Search Page === */
.search-form-inline {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
}
.search-form-inline input {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
    outline: none;
}
.search-form-inline input:focus { border-color: #dc2626; }
.search-form-inline button {
    padding: 10px 24px;
    background: #dc2626;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    cursor: pointer;
    transition: background .2s;
}
.search-form-inline button:hover { background: #b91c1c; }

/* === Pagination === */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 32px;
    padding: 16px 0;
}
.page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid #ddd;
    border-radius: 8px;
    color: #666;
    font-size: 14px;
    transition: all .2s;
}
.page-btn:hover { border-color: #dc2626; color: #dc2626; }
.page-info { font-size: 14px; color: #888; }

/* === Footer === */
.footer {
    background: #dc2626;
    color: rgba(255,255,255,.9);
    padding: 48px 0 24px;
    margin-top: 40px;
}
.footer-content {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1.5fr;
    gap: 48px;
    margin-bottom: 32px;
}
.footer-brand h3 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.footer-brand p { font-size: 14px; opacity: .8; line-height: 1.6; }
.footer-nav h4 { font-size: 16px; font-weight: 600; margin-bottom: 16px; }
.footer-nav a {
    display: block;
    color: rgba(255,255,255,.8);
    font-size: 14px;
    padding: 4px 0;
    transition: color .2s;
}
.footer-nav a:hover { color: #fff; }
.footer-about h4 { font-size: 16px; font-weight: 600; margin-bottom: 16px; }
.footer-about p { font-size: 14px; opacity: .8; line-height: 1.6; }
.footer-about a { color: rgba(255,255,255,.8); }
.footer-about a:hover { color: #fff; }
.footer-bottom {
    text-align: center;
    padding-top: 24px;
    border-top: 1px solid rgba(255,255,255,.2);
    font-size: 13px;
    opacity: .7;
}
.footer-bottom p { margin: 4px 0; }

/* === Auth Pages === */
.auth-container {
    max-width: 420px;
    margin: 60px auto;
    padding: 0 16px;
}
.auth-card {
    background: #fff;
    border-radius: 12px;
    padding: 40px 32px;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.auth-card h2 { font-size: 24px; text-align: center; margin-bottom: 24px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 14px; color: #555; margin-bottom: 6px; }
.form-group input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
    outline: none;
}
.form-group input:focus { border-color: #dc2626; }
.btn-primary {
    width: 100%;
    padding: 12px;
    background: #dc2626;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: background .2s;
    margin-top: 8px;
}
.btn-primary:hover { background: #b91c1c; }
.auth-link { text-align: center; margin-top: 16px; font-size: 14px; color: #888; }
.auth-link a { color: #dc2626; }

/* === Alert Messages === */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}
.alert-error { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }

/* === 404 Page === */
.error-page {
    text-align: center;
    padding: 80px 16px;
}
.error-page h1 { font-size: 72px; color: #dc2626; margin-bottom: 16px; }
.error-page p { font-size: 18px; color: #888; margin-bottom: 24px; }
.error-page a {
    display: inline-block;
    padding: 10px 24px;
    background: #dc2626;
    color: #fff;
    border-radius: 8px;
    transition: background .2s;
}
.error-page a:hover { background: #b91c1c; }

/* === Responsive === */
@media (max-width: 1024px) {
    .main-content { flex-direction: column; }
    .sidebar-left, .sidebar-right { width: 100%; }
    .sidebar-left { order: -1; display: flex; gap: 16px; flex-wrap: wrap; }
    .sidebar-left .sidebar-card { flex: 1; min-width: 250px; }
    .article-grid { grid-template-columns: repeat(2, 1fr); }
    .footer-content { grid-template-columns: 1fr; gap: 24px; }
    .article-detail-layout { flex-direction: column; }
}

@media (max-width: 768px) {
    .nav-links { display: none; }
    .hamburger { display: block; }
    .nav-links.open {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 56px;
        left: 0;
        right: 0;
        background: #dc2626;
        padding: 16px;
        box-shadow: 0 4px 12px rgba(0,0,0,.15);
    }
    .search-box input { width: 120px; }
    .article-grid { grid-template-columns: 1fr; }
    .carousel { height: 200px; }
    .article-detail-content { padding: 20px; }
    .article-detail-title { font-size: 20px; }
    .prev-next-nav { flex-direction: column; gap: 12px; }
    .prev-next-item { max-width: 100%; }
    .prev-next-item.next { text-align: left; }
}
