:root {
    --primary-color: #4e6a6d;
    --secondary-color: #e9e5d7;
    --background-color: #EEEEEE;
    --text-color: #333333;
    --border-radius: 8px;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* 基础样式 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Microsoft YaHei', sans-serif;
    background: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 80px auto 0;
    padding: 20px;
}

/* 统一导航栏样式 */
.navbar {
    background: var(--primary-color);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    display: none；
}

.nav-logo {
    height: 40px;
    width: auto;
    display: none;
    
}

.nav-menu {
    display: flex;
    gap: 2rem;
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    transition: background-color 0.3s ease;
}

.nav-link:hover,
.nav-link.active {
    background-color: rgba(255,255,255,0.2);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* 导航栏按钮样式 */
.navbar .btn {
    background: rgba(255,255,255,0.9);
    color: var(--primary-color);
    border: 2px solid rgba(255,255,255,0.3);
    padding: 0.6rem 1.2rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    display: inline-block;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.navbar .btn:hover {
    background: white;
    color: var(--primary-color);
    border-color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.navbar .btn.secondary {
    background: transparent;
    color: white;
    border: 2px solid rgba(255,255,255,0.6);
}

.navbar .btn.secondary:hover {
    background: rgba(255,255,255,0.1);
    color: white;
    border-color: white;
}

.user-menu {
    position: relative;
    display: inline-block;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid white;
    transition: transform 0.3s ease;
}

.user-avatar:hover {
    transform: scale(1.1);
}

.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background: white;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    border-radius: var(--border-radius);
    min-width: 150px;
    z-index: 1001;
}

.dropdown-menu a {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--text-color);
    text-decoration: none;
    transition: background-color 0.3s ease;
}

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

/* 按钮样式 */
.btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.btn.secondary {
    background: #6c757d;
    color: white;
}

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

/* 模态框样式 */
.modal {
    display: none;               /* 打开时 JS 设成 flex，见下方居中 */
    position: fixed;
    inset: 0;
    left: 0; top: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, .45);
    z-index: 2000;
    align-items: center;         /* 垂直居中 */
    justify-content: center;     /* 水平居中 */
    padding: 24px 16px;
    box-sizing: border-box;
}

.modal-content {
    /* 由父级 flex 居中；显式清掉可能从别处继承来的定位，避免被推到角落 */
    position: relative;
    top: auto; left: auto; right: auto; bottom: auto;
    transform: none;
    margin: 0;
    background-color: #fff;
    padding: 26px 28px;
    border: 1px solid #e4e0d4;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, .18);
    width: 100%;
    max-width: 520px;
    max-height: calc(100vh - 48px);
    overflow-y: auto;            /* 内容太长时弹窗内部滚动 */
    box-sizing: border-box;
    animation: modalIn .18s ease-out;
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* 表单样式 */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-color);
    font-weight: 500;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

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

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* 商品网格样式 */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

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

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}

.product-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.product-info {
    padding: 1rem;
}

.product-title {
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.product-price {
    font-size: 1.2rem;
    color: var(--primary-color);
    font-weight: bold;
    margin-bottom: 1rem;
}

.product-description {
    color: #666;
    margin-bottom: 1rem;
    line-height: 1.5;
}

/* 购物车侧边栏 */
.cart-sidebar {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: white;
    box-shadow: -2px 0 8px rgba(0,0,0,0.1);
    transition: right 0.3s ease;
    z-index: 1500;
    display: flex;
    flex-direction: column;
}

.cart-sidebar.open {
    right: 0;
}

.cart-header {
    padding: 1rem;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.cart-item {
    display: flex;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid #eee;
}

.cart-item-image {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: var(--border-radius);
}

.cart-item-info {
    flex: 1;
}

.cart-item-title {
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.cart-item-price {
    color: var(--primary-color);
    font-weight: bold;
}

.cart-footer {
    padding: 1rem;
    border-top: 1px solid #eee;
}

.cart-total {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 1rem;
    text-align: right;
}

/* 论坛样式 */
.forum-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--primary-color);
}

.posts-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.post-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    transition: transform 0.3s ease;
}

.post-card:hover {
    transform: translateY(-2px);
}

.post-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.post-author {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.post-author img {
    width: 30px;
    height: 30px;
    border-radius: 50%;
}

.post-title {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.post-content {
    color: #666;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.post-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #999;
    font-size: 0.9rem;
}

.post-actions {
    display: flex;
    gap: 1rem;
}

.post-action {
    cursor: pointer;
    transition: color 0.3s ease;
}

.post-action:hover {
    color: var(--primary-color);
}

/* 评论样式 */
.comments-section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.comment {
    padding: 1rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

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

.comment-time {
    color: #999;
    font-size: 0.9rem;
}

.comment-content {
    color: #666;
    line-height: 1.5;
}

/* 分页样式 */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 2rem;
}

.pagination button {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    background: white;
    color: var(--text-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.3s ease;
}

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

/* 购物车 */
.cart-icon {
    position: relative;
    cursor: pointer;
    color: white;
    font-size: 1.2rem;
    padding: 0.5rem;
    border-radius: var(--border-radius);
    transition: background-color 0.3s ease;
}

.cart-icon:hover {
    background-color: rgba(255,255,255,0.2);
}

.cart-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4757;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
}

/* 提示消息 */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem 2rem;
    border-radius: var(--border-radius);
    color: white;
    z-index: 3000;
    display: none;
}

.toast.success {
    background-color: #2ed573;
}

.toast.error {
    background-color: #ff4757;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
} 

/* 响应式设计 */
@media (max-width: 768px) {
    .navbar {
        padding: 1rem;
    }
    
    .nav-menu {
        display: none;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 1rem;
    }
    
    .cart-sidebar {
        width: 100%;
        right: -100%;
    }
    
    .forum-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .post-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
} 