/* 全局样式 */
:root {
    --primary-color: #3498db;
    --secondary-color: #2980b9;
    --danger-color: #dc3545;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --gray-color: #6c757d;
    --border-color: #dee2e6;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 全局布局设置，确保页脚始终在底部 */
html {
    height: 100%;
}

body {
    min-height: 100%;
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    font-family: 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

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

a:hover {
    text-decoration: underline;
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
}

/* 头部样式 */
header {
    background-color: #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
}

.logo a {
    font-size: 24px;
    font-weight: bold;
    color: var(--dark-color);
}

.logo a:hover {
    text-decoration: none;
}

.nav ul {
    display: flex;
    gap: 20px;
}

.nav li {
    position: relative;
}

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

.nav span {
    color: var(--gray-color);
}

/* 主要内容区域 */
main.container {
    flex: 1 0 auto; /* 不允许内容区域缩小 */
    padding: 20px 15px;
}

/* 卡片样式 */
.card {
    background-color: #fff;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    overflow: hidden;
}

.card-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--light-color);
}

.card-header h2, .card-header h3 {
    margin: 0;
    color: var(--dark-color);
}

.card-body {
    padding: 20px;
}

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

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

.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 16px;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.25);
}

.form-text {
    margin-top: 5px;
    font-size: 14px;
    color: var(--gray-color);
}

/* 按钮样式 */
.btn {
    display: inline-block;
    padding: 8px 16px;
    background-color: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    text-align: center;
}

.btn:hover {
    background-color: var(--secondary-color);
    text-decoration: none;
}

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

.btn-success:hover {
    background-color: #218838;
}

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

.btn-danger:hover {
    background-color: #c82333;
}

/* 提示框样式 */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
}

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

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

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

/* 表格样式 */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

table th, table td {
    padding: 10px;
    border: 1px solid var(--border-color);
    text-align: left;
}

table th {
    background-color: var(--light-color);
    font-weight: 600;
}

table tr:nth-child(even) {
    background-color: #f9f9f9;
}

/* 分页样式 */
.pagination {
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

.pagination li {
    margin: 0 5px;
}

.pagination a, .pagination span {
    display: block;
    padding: 8px 12px;
    background-color: #fff;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.pagination a:hover {
    background-color: var(--light-color);
    text-decoration: none;
}

.pagination .active span {
    background-color: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

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

.product-card {
    background-color: #fff;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
}

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

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

.product-info {
    padding: 15px;
}

.product-title {
    margin: 0 0 10px;
    font-size: 18px;
    height: 3em;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.product-points {
    color: var(--danger-color);
    font-weight: bold;
    margin-bottom: 0;
    font-size: 18px;
}

/* 欢迎区域样式 */
.welcome-section {
    margin-bottom: 30px;
}

/* 管理后台样式 */
.admin-container {
    display: flex;
    background-color: #fff;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.sidebar {
    width: 250px;
    background-color: var(--dark-color);
    padding: 20px 0;
    border-radius: 4px 0 0 4px;
}

.content {
    flex: 1;
    padding: 20px;
}

.sidebar-menu a {
    display: block;
    padding: 10px 20px;
    color: #fff;
    border-left: 3px solid transparent;
}

.sidebar-menu a:hover, .sidebar-menu a.active {
    background-color: rgba(255, 255, 255, 0.1);
    border-left-color: var(--primary-color);
    text-decoration: none;
}

/* 手机菜单按钮 */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    z-index: 100;
}

.mobile-menu-toggle .bar {
    display: block;
    width: 25px;
    height: 3px;
    margin: 5px auto;
    background-color: var(--dark-color);
    transition: all 0.3s ease-in-out;
}

.mobile-menu-toggle.active .bar:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.mobile-menu-toggle.active .bar:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active .bar:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* 响应式样式增强 */
.responsive-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.product-card-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.product-info {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    justify-content: space-between;
}

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

.section-title {
    text-align: center;
    margin: 20px 0;
    font-size: 28px;
    color: var(--dark-color);
}

.view-all-products {
    text-align: center; 
    margin-top: 20px;
}

/* 增强现有媒体查询 */
@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: block;
    }
    
    .header-container {
        flex-wrap: wrap;
        justify-content: space-between;
        padding: 10px 0;
    }
    
    .nav {
        flex-basis: 100%;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease-in-out;
        width: 100%;
    }
    
    .nav.active {
        max-height: 500px;
    }
    
    .nav ul {
        flex-direction: column;
        width: 100%;
        margin-top: 15px;
        padding: 0;
    }
    
    .nav li {
        width: 100%;
        text-align: center;
        margin: 5px 0;
    }
    
    .products-grid.responsive-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .product-image {
        height: 160px;
    }
    
    .product-title {
        font-size: 16px;
        height: 2.4em;
    }
    
    .product-points {
        margin-bottom: 10px;
        font-size: 16px;
    }
    
    .card-header, .card-body {
        padding: 10px 15px;
    }
    
    .welcome-section {
        margin-bottom: 15px;
    }
    
    .btn {
        padding: 6px 12px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .products-grid.responsive-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .product-image {
        height: 180px;
    }
    
    .product-info {
        padding: 12px;
    }
    
    .product-title {
        font-size: 16px;
        margin-bottom: 8px;
    }
    
    .container {
        padding: 0 10px;
    }
    
    .section-title {
        font-size: 24px;
        margin: 15px 0;
    }
}

/* 底部样式 */
footer {
    flex-shrink: 0; /* 防止页脚被压缩 */
    background-color: var(--dark-color);
    color: #fff;
    padding: 20px 0;
    margin-top: auto; /* 自动将剩余空间推到页脚上方 */
}

footer p {
    margin: 5px 0;
    text-align: center;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: #fff;
    margin: 10% auto;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    width: 80%;
    max-width: 500px;
    position: relative;
}

.close {
    position: absolute;
    right: 20px;
    top: 15px;
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: black;
    text-decoration: none;
}

/* 搜索表单样式 */
.search-form {
    margin-bottom: 20px;
}

.search-container {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .search-container {
        flex-direction: column;
    }
    
    .search-container .btn {
        margin-top: 5px;
    }
}

/* 商品卡片链接样式 */
.product-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.product-card-link:hover {
    text-decoration: none;
}

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