/* =====================================================
   会员系统 - 全局样式
   ===================================================== */

/* 重置与基础 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4a90d9;
    --primary-hover: #3a7bc8;
    --success-color: #52c41a;
    --warning-color: #faad14;
    --danger-color: #f5222d;
    --text-color: #333;
    --text-secondary: #666;
    --text-muted: #999;
    --border-color: #e8e8e8;
    --bg-color: #f5f5f5;
    --white: #fff;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-color);
    background: var(--bg-color);
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s;
}

a:hover {
    color: var(--primary-hover);
}

/* 容器 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* =====================================================
   头部
   ===================================================== */
.site-header {
    background: var(--white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
}

.logo img {
    height: 40px;
}

.main-nav {
    display: flex;
    gap: 30px;
}

.main-nav a {
    color: var(--text-color);
    font-weight: 500;
}

.main-nav a:hover,
.main-nav a.active {
    color: var(--primary-color);
}

.user-area {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info .points {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: bold;
}

.user-dropdown {
    position: relative;
}

.user-dropdown .username {
    padding: 5px 15px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    display: inline-block;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow);
    min-width: 150px;
    z-index: 1000;
}

.user-dropdown:hover .dropdown-menu {
    display: block;
}

.dropdown-menu a {
    display: block;
    padding: 10px 20px;
    color: var(--text-color);
}

.dropdown-menu a:hover {
    background: var(--bg-color);
}

.auth-buttons {
    display: flex;
    gap: 10px;
}

.btn-login, .btn-register {
    padding: 8px 20px;
    border-radius: 20px;
    font-weight: 500;
}

.btn-login {
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-register {
    background: var(--primary-color);
    color: white;
}

/* =====================================================
   闪存消息
   ===================================================== */
.flash-message {
    padding: 15px;
    margin: 15px auto;
    max-width: 1200px;
    border-radius: 8px;
    text-align: center;
}

.flash-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.flash-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.flash-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

/* =====================================================
   主内容区
   ===================================================== */
.main-content {
    min-height: calc(100vh - 70px - 200px);
    padding: 30px 0;
}

/* =====================================================
   轮播图
   ===================================================== */
.banner-slider {
    margin-bottom: 30px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.banner-slider .slides {
    position: relative;
    height: 400px;
}

.banner-slider .slide {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.5s;
}

.banner-slider .slide.active {
    opacity: 1;
}

.banner-slider .slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.banner-slider .slide-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 30px;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    color: white;
}

.banner-slider .dots {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
}

.banner-slider .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    cursor: pointer;
}

.banner-slider .dot.active {
    background: white;
}

/* =====================================================
   首页模块
   ===================================================== */
.home-section {
    background: var(--white);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

.section-title {
    font-size: 20px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-title a {
    font-size: 14px;
    font-weight: normal;
}

/* 热榜 */
.hot-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.hot-item {
    display: flex;
    align-items: center;
    padding: 10px;
    background: var(--bg-color);
    border-radius: 8px;
    transition: transform 0.2s;
}

.hot-item:hover {
    transform: translateX(5px);
}

.hot-rank {
    width: 30px;
    height: 30px;
    line-height: 30px;
    text-align: center;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    font-weight: bold;
    margin-right: 15px;
}

.hot-rank.top {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.hot-item a {
    flex: 1;
    color: var(--text-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 文章列表 */
.article-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.article-card {
    background: var(--bg-color);
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
}

.article-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow);
}

.article-card .cover {
    height: 180px;
    overflow: hidden;
}

.article-card .cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.article-card .content {
    padding: 15px;
}

.article-card .title {
    font-size: 16px;
    margin-bottom: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.article-card .summary {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 15px;
    height: 40px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.article-card .meta {
    display: flex;
    justify-content: space-between;
    color: var(--text-muted);
    font-size: 12px;
}

/* 产品列表 */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.product-card {
    background: var(--white);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: transform 0.3s, box-shadow 0.3s;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow);
}

.product-card .cover {
    height: 200px;
    overflow: hidden;
}

.product-card .cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-card .info {
    padding: 15px;
}

.product-card .name {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 10px;
}

.product-card .points {
    color: #f5576c;
    font-size: 18px;
    font-weight: bold;
}

.product-card .points span {
    font-size: 12px;
    font-weight: normal;
}

/* =====================================================
   登录框
   ===================================================== */
.login-box {
    background: var(--white);
    border-radius: 12px;
    padding: 30px;
    box-shadow: var(--shadow);
}

.login-box h2 {
    text-align: center;
    margin-bottom: 25px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.btn {
    display: inline-block;
    padding: 10px 30px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-block {
    display: block;
    width: 100%;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-warning {
    background: var(--warning-color);
    color: white;
}

/* =====================================================
   分页
   ===================================================== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-top: 30px;
}

.pagination a,
.pagination span {
    display: inline-block;
    padding: 8px 15px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    color: var(--text-color);
}

.pagination a:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.pagination .active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* =====================================================
   评论
   ===================================================== */
.comment-section {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 1px solid var(--border-color);
}

.comment-list {
    margin-top: 20px;
}

.comment-item {
    padding: 20px;
    background: var(--bg-color);
    border-radius: 12px;
    margin-bottom: 15px;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.comment-author {
    font-weight: bold;
    color: var(--primary-color);
}

.comment-time {
    color: var(--text-muted);
    font-size: 12px;
}

.comment-content {
    margin-bottom: 10px;
}

.comment-actions {
    display: flex;
    gap: 15px;
}

.comment-actions a {
    color: var(--text-muted);
    font-size: 12px;
}

.comment-reply {
    margin-left: 50px;
    margin-top: 15px;
}

.comment-form {
    margin-top: 20px;
    padding: 20px;
    background: var(--bg-color);
    border-radius: 12px;
}

.comment-form textarea {
    width: 100%;
    padding: 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    resize: vertical;
    min-height: 100px;
    margin-bottom: 15px;
}

/* =====================================================
   抽奖
   ===================================================== */
.lottery-container {
    text-align: center;
}

.lottery-wheel {
    width: 350px;
    height: 350px;
    margin: 30px auto;
    position: relative;
}

.lottery-wheel canvas {
    width: 100%;
    height: 100%;
}

.lottery-pointer {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 80px;
    cursor: pointer;
}

/* =====================================================
   占卜
   ===================================================== */
.fortune-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.fortune-card {
    background: var(--white);
    border-radius: 12px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    border: 2px solid transparent;
}

.fortune-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow);
    border-color: var(--primary-color);
}

.fortune-card .icon {
    font-size: 50px;
    margin-bottom: 15px;
}

.fortune-card h3 {
    margin-bottom: 10px;
}

.fortune-card p {
    color: var(--text-secondary);
    font-size: 13px;
}

/* =====================================================
   积分商品
   ===================================================== */
.exchange-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.exchange-card {
    background: var(--white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.exchange-card .cover {
    height: 200px;
    overflow: hidden;
}

.exchange-card .cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.exchange-card .info {
    padding: 20px;
}

.exchange-card .name {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 10px;
}

.exchange-card .desc {
    color: var(--text-secondary);
    margin-bottom: 15px;
}

.exchange-card .footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.exchange-card .points {
    font-size: 24px;
    color: #f5576c;
    font-weight: bold;
}

/* =====================================================
   底部
   ===================================================== */
.site-footer {
    background: #1a1a1a;
    color: #999;
    padding: 50px 0 20px;
    margin-top: 50px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
    margin-bottom: 30px;
}

.footer-section h4 {
    color: #fff;
    margin-bottom: 15px;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 10px;
}

.footer-section a {
    color: #999;
}

.footer-section a:hover {
    color: var(--primary-color);
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #333;
}

/* =====================================================
   后台样式
   ===================================================== */
.admin-wrapper {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 220px;
    background: #001529;
    color: white;
    padding: 20px 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.admin-sidebar .logo {
    padding: 0 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    text-align: center;
}

.admin-sidebar .menu {
    list-style: none;
}

.admin-sidebar .menu-item {
    position: relative;
}

.admin-sidebar .menu-item a {
    display: block;
    padding: 12px 20px;
    color: rgba(255,255,255,0.7);
    transition: all 0.3s;
}

.admin-sidebar .menu-item a:hover,
.admin-sidebar .menu-item.active a {
    background: rgba(255,255,255,0.1);
    color: white;
}

.admin-sidebar .submenu {
    list-style: none;
    display: none;
}

.admin-sidebar .menu-item.open .submenu {
    display: block;
}

.admin-sidebar .submenu a {
    padding-left: 40px;
    font-size: 13px;
}

.admin-main {
    flex: 1;
    margin-left: 220px;
    padding: 20px;
    background: #f0f2f5;
}

.admin-header {
    background: white;
    padding: 15px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: -20px -20px 20px;
}

.admin-breadcrumb {
    display: flex;
    gap: 10px;
    align-items: center;
}

.admin-content {
    background: white;
    border-radius: 8px;
    padding: 25px;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e8e8e8;
}

.admin-table th {
    background: #fafafa;
    font-weight: 500;
}

.admin-table tr:hover {
    background: #fafafa;
}

/* =====================================================
   响应式
   ===================================================== */
@media (max-width: 768px) {
    .site-header .container {
        flex-wrap: wrap;
        height: auto;
        padding: 10px 15px;
    }
    
    .main-nav {
        order: 3;
        width: 100%;
        justify-content: center;
        gap: 15px;
        padding-top: 10px;
        border-top: 1px solid var(--border-color);
        margin-top: 10px;
    }
    
    .footer-content {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .article-grid,
    .product-grid {
        grid-template-columns: 1fr;
    }
}

/* ========== 导航栏 ========== */
.navbar {
    background: #001529;
    color: white;
    height: 56px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.nav-container {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    height: 56px;
}
.nav-logo {
    font-size: 18px;
    font-weight: bold;
    color: white;
    text-decoration: none;
    margin-right: 40px;
    white-space: nowrap;
}
.nav-links {
    display: flex;
    list-style: none;
    flex: 1;
    margin: 0;
    padding: 0;
}
.nav-links li a {
    display: block;
    padding: 0 16px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    height: 56px;
    line-height: 56px;
    font-size: 15px;
}
.nav-links li a:hover {
    color: white;
    background: rgba(255,255,255,0.1);
}
.nav-auth {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.nav-user {
    color: white;
    text-decoration: none;
    font-size: 14px;
}
.points-badge {
    background: rgba(255,255,255,0.15);
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 13px;
}
.btn-sm {
    padding: 4px 14px;
    font-size: 13px;
}
.btn {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    border: none;
    font-size: 14px;
    transition: all 0.2s;
}
.btn-primary {
    background: var(--primary-color);
    color: white;
}
.btn-primary:hover {
    background: var(--primary-hover);
}
.nav-auth .btn {
    background: rgba(255,255,255,0.1);
    color: white;
}
.nav-auth .btn:hover {
    background: rgba(255,255,255,0.2);
}
.nav-auth .btn-primary {
    background: #1890ff;
}
