/* Global Styles */
/* 功能点：设置网站基础样式
   关键技术：
   1. CSS变量定义主题颜色
   2. 重置默认样式
   3. 设置基础字体和颜色 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Arial', sans-serif;
}

:root {
    --primary-color: #3b82f6;
    --secondary-color: #4b5563;
    --bg-color: #f3f4f6;
    --text-color: #1f2937;
    --text-light: #6b7280;
    --border-color: #e5e7eb;
    --success-color: #10b981;
    --danger-color: #ef4444;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
}

.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header */
/* 功能点：响应式导航栏样式
   关键技术：
   1. 使用sticky定位实现导航栏固定
   2. 使用flex布局实现导航项排列
   3. 使用媒体查询实现响应式布局 */
header {
    background-color: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.nav-links {
    display: flex;
    gap: 1.5rem;
}

.nav-links a {
    color: var(--text-color);
    font-weight: 500;
    transition: color 0.3s ease;
}

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

.mobile-menu-btn {
    display: none;
    cursor: pointer;
    font-size: 1.5rem;
}

/* Search Bar */
/* 功能点：搜索框样式美化
   关键技术：
   1. 使用flex布局实现搜索框布局
   2. 使用transition实现过渡动画
   3. 使用伪类实现交互效果 */
.search-container {
    position: relative;
    flex: 1;
    max-width: 400px;
    margin: 0 1rem;
}

.search-input {
    width: 100%;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 50px;
    outline: none;
    transition: all 0.3s ease;
}

.search-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.search-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-light);
}

/* Carousel Styles */
/* 轮播图样式 */
.carousel {
    position: relative;
    overflow: hidden;
    margin-bottom: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.carousel-inner {
    height: 600px;
}

.carousel-item {
    height: 100%;
}

.carousel-item img {
    height: 100%;
    object-fit: cover;
    filter: brightness(0.9);
}

.carousel-caption {
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
    left: 0;
    right: 0;
    bottom: 0;
    padding: 2rem;
    text-align: left;
}

.carousel-caption h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.carousel-caption p {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.carousel-caption .btn {
    padding: 0.8rem 2rem;
    font-size: 1.1rem;
    border-radius: 50px;
    transition: all 0.3s ease;
}

.carousel-caption .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.carousel-control-prev,
.carousel-control-next {
    width: 5%;
    opacity: 0;
    transition: all 0.3s ease;
}

.carousel:hover .carousel-control-prev,
.carousel:hover .carousel-control-next {
    opacity: 0.8;
}

.carousel-control-prev-icon,
.carousel-control-next-icon {
    width: 40px;
    height: 40px;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    background-size: 50%;
}

.carousel-indicators {
    margin-bottom: 1.5rem;
}

.carousel-indicators button {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin: 0 6px;
    background-color: rgba(255, 255, 255, 0.5);
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.carousel-indicators button.active {
    background-color: #fff;
    transform: scale(1.2);
}

/* Product Grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* 商品卡片样式 */
.product-card {
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.product-card .card-img-top {
    height: 240px;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.product-card:hover .card-img-top {
    transform: scale(1.05);
}

.product-info {
    padding: 1rem;
}

.product-category {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.product-title {
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.product-price .original-price {
    text-decoration: line-through;
    color: var(--text-light);
    font-size: 0.9rem;
    margin-left: 0.5rem;
}

/* Categories */
/* 商品分类样式 */
.categories {
    display: flex;
    gap: 1rem;
    padding: 1rem 0;
    margin-bottom: 2rem;
    overflow-x: auto;
}

.category-filter-btn {
    padding: 0.5rem 1rem;
    border-radius: 50px;
    transition: all 0.3s ease;
}

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

/* Footer */
footer {
    background-color: var(--secondary-color);
    color: white;
    padding: 2rem 0;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
}

.footer-column h3 {
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.footer-column ul li {
    margin-bottom: 0.5rem;
}

.footer-column ul li a:hover {
    text-decoration: underline;
}

.copyright {
    text-align: center;
    padding: 1.5rem 0 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 1.5rem;
}

/* Button Styles */
.btn {
    padding: 0.5rem 1.5rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

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

.btn-primary:hover {
    background-color: #2563eb;
}

.btn-outline {
    background-color: transparent;
    border: 1px solid currentColor;
}

.btn-outline:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

/* Section Titles */
.section-title {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 1.5rem;
    position: relative;
    padding-bottom: 0.5rem;
}

.section-title::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 50px;
    height: 3px;
    background-color: var(--primary-color);
}

/* Form Elements */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    outline: none;
    transition: all 0.3s ease;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.form-error {
    color: var(--danger-color);
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

/* Admin Dashboard */
/* 后台管理页面样式 */
/* 功能点：后台管理界面布局
   关键技术：
   1. 使用Grid布局实现数据展示
   2. 使用flex布局实现侧边栏
   3. 使用CSS变量实现主题定制 */
.admin-wrapper {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 250px;
    background-color: var(--secondary-color);
    color: white;
    transition: all 0.3s ease;
}

.admin-sidebar.collapsed {
    width: 60px;
}

.admin-main {
    flex: 1;
    overflow: hidden;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background-color: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.admin-content {
    padding: 1.5rem;
}

.admin-menu-toggle {
    cursor: pointer;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: white;
    border-radius: 8px;
    width: 500px;
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.2rem;
    font-weight: bold;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
}

.modal-body {
    padding: 1rem;
}

.modal-footer {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* Responsive Styles */
/* 响应式布局样式 */
/* 功能点：适配不同屏幕尺寸
   关键技术：
   1. 使用媒体查询实现断点
   2. 调整布局和字体大小
   3. 优化移动端显示效果 */
@media (max-width: 992px) {
    .search-container {
        max-width: 300px;
    }
    
    .carousel-inner {
        height: 500px;
    }
    
    .carousel-caption h2 {
        font-size: 2rem;
    }
    
    .carousel-caption p {
        font-size: 1.1rem;
    }
}

@media (max-width: 768px) {
    .mobile-menu-btn {
        display: block;
    }
    
    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: white;
        flex-direction: column;
        padding: 1rem;
        box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
    }
    
    .nav-links.active {
        display: flex;
    }
    
    .search-container {
        margin: 0 0.5rem;
    }
    
    .carousel-inner {
        height: 400px;
    }
    
    .carousel-caption {
        padding: 1.5rem;
    }
    
    .carousel-caption h2 {
        font-size: 1.8rem;
    }
    
    .carousel-caption p {
        font-size: 1rem;
    }
    
    .carousel-caption .btn {
        padding: 0.6rem 1.5rem;
        font-size: 1rem;
    }
    
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    
    .footer-content {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
    
    .admin-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 100;
        transform: translateX(-100%);
    }
    
    .admin-sidebar.active {
        transform: translateX(0);
    }
    
    .admin-main {
        margin-left: 0;
    }
    
    .product-card .card-img-top {
        height: 200px;
    }
    
    .carousel-inner .carousel-item img {
        height: 300px;
    }
    
    .product-gallery .product-main-image {
        height: 300px;
    }
}

@media (max-width: 576px) {
    .carousel-inner {
        height: 300px;
    }
    
    .carousel-caption {
        padding: 1rem;
    }
    
    .carousel-caption h2 {
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
    }
    
    .carousel-caption p {
        font-size: 0.9rem;
        margin-bottom: 1rem;
    }
    
    .carousel-caption .btn {
        padding: 0.5rem 1.2rem;
        font-size: 0.9rem;
    }
    
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .footer-content {
        grid-template-columns: 1fr;
    }
    
    .product-card .card-img-top {
        height: 180px;
    }
    
    .carousel-inner .carousel-item img {
        height: 200px;
    }
}

/* Product Detail Page */
/* 商品详情页样式 */
.product-detail-container {
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
}

.product-gallery {
    display: flex;
    flex-direction: column;
}

.product-gallery .product-main-image {
    height: 400px;
    overflow: hidden;
    border-radius: 8px;
}

.product-gallery .product-main-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-thumbnails {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    overflow-x: auto;
}

.product-thumbnail {
    width: 80px;
    height: 80px;
    border: 2px solid transparent;
    cursor: pointer;
    border-radius: 4px;
    overflow: hidden;
}

.product-thumbnail.active {
    border-color: var(--primary-color);
}

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

.product-detail-info {
    padding: 1.5rem;
}

.product-detail-title {
    font-size: 1.8rem;
    margin-bottom: 1rem;
}

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

.product-detail-meta {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    color: var(--text-light);
}

.product-quantity {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
}

.quantity-btn {
    width: 30px;
    height: 30px;
    background-color: var(--bg-color);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.quantity-input {
    width: 50px;
    height: 30px;
    text-align: center;
    border: 1px solid var(--border-color);
    margin: 0 0.5rem;
}

.product-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.product-description {
    margin-bottom: 2rem;
}

.product-tabs {
    border-bottom: 1px solid var(--border-color);
    display: flex;
    margin-bottom: 1.5rem;
}

.product-tab {
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
}

.product-tab.active {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.product-tab-content {
    display: none;
}

.product-tab-content.active {
    display: block;
}

/* Login/Register Page */
/* 登录注册表单样式 */
/* 功能点：表单样式美化
   关键技术：
   1. 使用flex布局实现表单居中
   2. 使用渐变背景实现视觉效果
   3. 使用box-shadow实现卡片效果 */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #4b6cb7, #182848);
    background-size: cover;
    background-position: center;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    padding: 2rem;
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-title {
    font-size: 1.8rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.auth-subtitle {
    color: var(--text-light);
}

.auth-form {
    margin-bottom: 1.5rem;
}

.auth-footer {
    text-align: center;
    color: var(--text-light);
}

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

.auth-footer a:hover {
    text-decoration: underline;
}

/* Admin Dashboard */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background-color: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.stat-card-title {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.stat-card-value {
    font-size: 1.8rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.stat-card-footer {
    display: flex;
    align-items: center;
    font-size: 0.9rem;
}

.stat-card-footer.positive {
    color: var(--success-color);
}

.stat-card-footer.negative {
    color: var(--danger-color);
}

.admin-table-container {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.admin-table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

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

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

.admin-table th {
    background-color: var(--bg-color);
    font-weight: 500;
}

.admin-table tr:last-child td {
    border-bottom: none;
}

.admin-table-actions {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
}

.action-btn.edit {
    background-color: #3b82f6;
}

.action-btn.delete {
    background-color: #ef4444;
}

.admin-menu {
    padding: 1rem 0;
}

.admin-menu-item {
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    color: rgba(255, 255, 255, 0.8);
    transition: all 0.3s ease;
}

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

.admin-menu-item i {
    margin-right: 1rem;
    width: 20px;
    text-align: center;
}

.admin-menu-text {
    white-space: nowrap;
    overflow: hidden;
}

.admin-sidebar.collapsed .admin-menu-text {
    display: none;
}

/* 轮播图优化 */
.carousel-inner .carousel-item img {
    height: 500px;
    object-fit: cover;
}

/* 评价图片样式 */
.review-images img {
    width: 80px;
    height: 80px;
    object-fit: cover;
} 