/* css/style.css - 主要样式文件 */

/* 基础设置 */
:root {
    --primary-color: #2c5aa0;
    --secondary-color: #d4af37;
    --accent-color: #c62828;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --gray-color: #6c757d;
    --light-gray: #e9ecef;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --border-radius: 8px;
    --box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Noto Sans TC', sans-serif;
    line-height: 1.6;
    color: var(--dark-color);
    background-color: #fff;
    overflow-x: hidden;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 按钮样式 */
.btn {
    display: inline-block;
    padding: 12px 30px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
    text-align: center;
}

.btn:hover {
    background-color: #1e3d6f;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.btn-primary {
    background-color: var(--primary-color);
}

.btn-secondary {
    background-color: var(--secondary-color);
}

.btn-accent {
    background-color: var(--accent-color);
}

/* 标题样式 */
.section-title {
    font-size: 2.2rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 2.5rem;
    color: var(--dark-color);
    position: relative;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background-color: var(--secondary-color);
    border-radius: 2px;
}

/* 导航栏 */
.header {
    background-color: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 15px 0;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo h1 {
    font-size: 1.8rem;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.logo p {
    font-size: 0.9rem;
    color: var(--gray-color);
}

.main-nav ul {
    display: flex;
    list-style: none;
}

.main-nav li {
    margin-left: 30px;
}

.main-nav a {
    text-decoration: none;
    color: var(--dark-color);
    font-weight: 500;
    font-size: 1.05rem;
    transition: var(--transition);
    display: flex;
    align-items: center;
}

.main-nav a i {
    margin-right: 8px;
    font-size: 1.1rem;
}

.main-nav a:hover, .main-nav a.active {
    color: var(--primary-color);
}

#cart-count {
    background-color: var(--accent-color);
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    margin-left: 5px;
}

.mobile-menu-btn {
    display: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--dark-color);
}

/* 主横幅 */
.hero {
    background: linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7)), url('https://images.unsplash.com/photo-1547592180-85f173990554?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1770&q=80');
    background-size: cover;
    background-position: center;
    color: white;
    padding: 100px 0;
    text-align: center;
}

.hero-content h2 {
    font-size: 3rem;
    margin-bottom: 20px;
    font-weight: 700;
}

.hero-content p {
    font-size: 1.3rem;
    margin-bottom: 30px;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

/* 分类区域 */
.categories {
    padding: 80px 0;
    background-color: var(--light-color);
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 25px;
}

.category-card {
    background-color: white;
    border-radius: var(--border-radius);
    padding: 30px 20px;
    text-align: center;
    text-decoration: none;
    color: var(--dark-color);
    box-shadow: var(--box-shadow);
    transition: var(--transition);
}

.category-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
}

.category-icon {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.category-card h3 {
    font-size: 1.4rem;
    margin-bottom: 10px;
}

.category-card p {
    color: var(--gray-color);
    font-size: 0.95rem;
}

/* 产品网格 */
.featured-products {
    padding: 80px 0;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.product-card {
    background-color: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
    transition: var(--transition);
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
}

.product-image {
    height: 200px;
    background-color: var(--light-gray);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-info {
    padding: 20px;
}

.product-category {
    color: var(--gray-color);
    font-size: 0.9rem;
    margin-bottom: 5px;
    display: block;
}

.product-name {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--dark-color);
}

.product-description {
    color: var(--gray-color);
    font-size: 0.95rem;
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-price {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.product-price::after {
    content: " NT$";
    font-size: 0.9rem;
}

.product-actions {
    display: flex;
    justify-content: space-between;
}

/* 服务区域 */
.services {
    padding: 80px 0;
    background-color: var(--light-color);
}

.service-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

.service-card {
    text-align: center;
    padding: 30px 20px;
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.service-icon {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 20px;
}

.service-card h3 {
    font-size: 1.4rem;
    margin-bottom: 15px;
}

/* 页脚 */
.footer {
    background-color: var(--dark-color);
    color: white;
    padding: 60px 0 30px;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}

.footer-col h3, .footer-col h4 {
    color: white;
    margin-bottom: 20px;
    font-size: 1.3rem;
}

.footer-col h3 i, .footer-col h4 i {
    margin-right: 10px;
}

.footer-col ul {
    list-style: none;
}

.footer-col ul li {
    margin-bottom: 10px;
}

.footer-col a {
    color: #ccc;
    text-decoration: none;
    transition: var(--transition);
}

.footer-col a:hover {
    color: white;
}

.footer-bottom {
    text-align: center;
    padding-top: 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: #aaa;
    font-size: 0.9rem;
}

.payment-icons {
    font-size: 1.8rem;
    margin-top: 15px;
}

.payment-icons i {
    margin-right: 15px;
}

/* 产品页面 */
.products-header {
    padding: 60px 0;
    background-color: var(--light-color);
    text-align: center;
}

.products-header h1 {
    font-size: 2.5rem;
    margin-bottom: 15px;
}

/* 筛选器 */
.filters {
    padding: 30px 0;
    background-color: white;
    border-bottom: 1px solid var(--light-gray);
}

.filter-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 15px;
}

.filter-label {
    font-weight: 500;
}

.filter-select {
    padding: 10px 15px;
    border-radius: var(--border-radius);
    border: 1px solid var(--light-gray);
    background-color: white;
    font-family: 'Noto Sans TC', sans-serif;
}

/* 购物车页面 */
.cart-container {
    padding: 60px 0;
}

.cart-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 30px;
    background-color: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
}

.cart-table th {
    background-color: var(--primary-color);
    color: white;
    padding: 15px;
    text-align: left;
}

.cart-table td {
    padding: 15px;
    border-bottom: 1px solid var(--light-gray);
}

.cart-item-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 5px;
}

.cart-quantity {
    display: flex;
    align-items: center;
    gap: 10px;
}

.quantity-btn {
    width: 30px;
    height: 30px;
    background-color: var(--light-gray);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: bold;
}

.cart-summary {
    background-color: white;
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-top: 30px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--light-gray);
}

.summary-total {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* 结账页面 */
.checkout-container {
    padding: 60px 0;
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 40px;
}

.checkout-section {
    background-color: white;
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-bottom: 30px;
}

.checkout-section h2 {
    margin-bottom: 25px;
    color: var(--primary-color);
    font-size: 1.5rem;
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--light-gray);
    border-radius: var(--border-radius);
    font-family: 'Noto Sans TC', sans-serif;
    font-size: 1rem;
}

.payment-method {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.payment-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px;
    border: 1px solid var(--light-gray);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.payment-option:hover {
    border-color: var(--primary-color);
}

.payment-option.selected {
    border-color: var(--primary-color);
    background-color: rgba(44, 90, 160, 0.05);
}

/* 登录注册页面 */
.auth-container {
    min-height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 0;
}

.auth-box {
    width: 100%;
    max-width: 450px;
    background-color: white;
    padding: 40px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.auth-title {
    text-align: center;
    margin-bottom: 30px;
    color: var(--primary-color);
    font-size: 1.8rem;
}

.auth-link {
    text-align: center;
    margin-top: 20px;
}

.auth-link a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

/* 响应式设计 */
@media (max-width: 992px) {
    .checkout-container {
        grid-template-columns: 1fr;
    }
    
    .section-title {
        font-size: 1.8rem;
    }
    
    .hero-content h2 {
        font-size: 2.5rem;
    }
}

@media (max-width: 768px) {
    .main-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background-color: white;
        box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
        padding: 20px;
    }
    
    .main-nav.active {
        display: block;
    }
    
    .main-nav ul {
        flex-direction: column;
    }
    
    .main-nav li {
        margin: 0 0 15px 0;
    }
    
    .mobile-menu-btn {
        display: block;
    }
    
    .category-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .cart-table {
        display: block;
        overflow-x: auto;
    }
    
    .hero {
        padding: 70px 0;
    }
    
    .hero-content h2 {
        font-size: 2rem;
    }
    
    .hero-content p {
        font-size: 1.1rem;
    }
}

@media (max-width: 576px) {
    .category-grid {
        grid-template-columns: 1fr;
    }
    
    .product-grid {
        grid-template-columns: 1fr;
    }
    
    .filter-container {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .auth-box {
        padding: 30px 20px;
    }
    
    .btn {
        padding: 10px 20px;
        width: 100%;
    }
}

/* 文本居中 */
.text-center {
    text-align: center;
}

/* 加载动画 */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 50px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid var(--light-gray);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 消息提示 */
.message {
    padding: 15px 20px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    font-weight: 500;
}

.message.success {
    background-color: rgba(40, 167, 69, 0.1);
    border-left: 4px solid var(--success-color);
    color: var(--success-color);
}

.message.error {
    background-color: rgba(220, 53, 69, 0.1);
    border-left: 4px solid var(--danger-color);
    color: var(--danger-color);
}

.message.info {
    background-color: rgba(0, 123, 255, 0.1);
    border-left: 4px solid var(--primary-color);
    color: var(--primary-color);
}

/* 隐藏元素 */
.hidden {
    display: none !important;
}