/* ===================================
   珍靓茶叶电商系统 - 全局样式
   =================================== */

/* CSS变量 */
:root {
    --primary: #2d5016;
    --primary-light: #4a7c23;
    --primary-dark: #1a3009;
    --secondary: #8b4513;
    --accent: #d4a574;
    --danger: #dc3545;
    --success: #28a745;
    --warning: #ffc107;
    --info: #17a2b8;
    
    --text-primary: #333;
    --text-secondary: #666;
    --text-muted: #999;
    --text-light: #fff;
    
    --bg-white: #fff;
    --bg-light: #f8f9fa;
    --bg-gray: #f5f5f5;
    --bg-dark: #1a1a1a;
    
    --border: #e5e5e5;
    --border-light: #f0f0f0;
    
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
    
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;
    
    --transition: all 0.3s ease;
    
    --container: 1200px;
    --header-height: 70px;
}

/* 重置 */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-light);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

img {
    max-width: 100%;
    height: auto;
    vertical-align: middle;
}

button, input, select, textarea {
    font-family: inherit;
    font-size: inherit;
    border: none;
    outline: none;
    background: none;
}

button {
    cursor: pointer;
}

ul, ol {
    list-style: none;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
}

/* 容器 */
.container {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 15px;
}

/* ===================================
   通用组件
   =================================== */

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: var(--transition);
    white-space: nowrap;
    cursor: pointer;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 12px;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 16px;
}

.btn-block {
    width: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: var(--text-light);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--secondary);
    color: var(--text-light);
}

.btn-white {
    background: var(--bg-white);
    color: var(--primary);
}

.btn-white:hover {
    background: var(--bg-light);
}

.btn-outline-primary {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-outline-primary:hover {
    background: var(--primary);
    color: var(--text-light);
}

.btn-ghost {
    background: rgba(255,255,255,0.1);
    color: var(--text-light);
}

/* 徽章 */
.badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 10px;
    font-weight: 600;
    line-height: 18px;
    text-align: center;
    color: var(--text-light);
    background: var(--danger);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 卡片 */
.card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

/* 分割线 */
.divider {
    height: 1px;
    background: var(--border);
    margin: 20px 0;
}

/* Toast */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    padding: 12px 24px;
    background: rgba(0,0,0,0.8);
    color: var(--text-light);
    border-radius: var(--radius-md);
    font-size: 14px;
    z-index: 9999;
    opacity: 0;
    transition: all 0.3s ease;
}

.toast.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* ===================================
   头部导航
   =================================== */

.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--bg-white);
    box-shadow: var(--shadow-sm);
    z-index: 1000;
}

.header-content {
    display: flex;
    align-items: center;
    height: 100%;
    gap: 40px;
}

.logo img {
    height: 40px;
    width: auto;
}

.nav {
    display: flex;
    align-items: center;
    gap: 32px;
}

.nav-link {
    position: relative;
    font-size: 15px;
    color: var(--text-secondary);
    padding: 8px 0;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: var(--transition);
}

.nav-link:hover, .nav-link.active {
    color: var(--primary);
}

.nav-link:hover::after, .nav-link.active::after {
    width: 100%;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-left: auto;
}

.action-btn {
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--text-secondary);
    border-radius: var(--radius-full);
    transition: var(--transition);
}

.action-btn:hover {
    background: var(--bg-gray);
    color: var(--primary);
}

.menu-btn {
    display: none;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--text-primary);
}

/* 移动端菜单 */
.mobile-menu {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-white);
    z-index: 1001;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.mobile-menu.show {
    transform: translateX(0);
}

.mobile-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid var(--border);
    font-size: 18px;
    font-weight: 600;
}

.mobile-menu-header button {
    width: 40px;
    height: 40px;
    font-size: 24px;
}

.mobile-nav {
    padding: 20px;
}

.mobile-nav-link {
    display: block;
    padding: 15px 0;
    font-size: 16px;
    border-bottom: 1px solid var(--border-light);
}

.mobile-nav-link.active {
    color: var(--primary);
}

.mobile-nav-footer {
    padding: 20px;
    margin-top: 20px;
}

/* ===================================
   轮播图
   =================================== */

.hero {
    margin-top: var(--header-height);
}

.hero-swiper {
    width: 100%;
    height: 500px;
}

.slide-bg {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
}

.slide-content {
    max-width: 500px;
    color: var(--text-light);
}

.slide-content h2 {
    font-size: 42px;
    margin-bottom: 16px;
}

.slide-content p {
    font-size: 18px;
    opacity: 0.9;
    margin-bottom: 24px;
}

.swiper-pagination-bullet {
    width: 8px;
    height: 8px;
    background: rgba(255,255,255,0.5);
}

.swiper-pagination-bullet-active {
    background: var(--bg-white);
    width: 24px;
    border-radius: 4px;
}

.swiper-button-prev, .swiper-button-next {
    width: 48px;
    height: 48px;
    background: rgba(255,255,255,0.2);
    border-radius: var(--radius-full);
    backdrop-filter: blur(10px);
}

.swiper-button-prev::after, .swiper-button-next::after {
    font-size: 18px;
    color: var(--text-light);
}

/* ===================================
   区域通用
   =================================== */

.section {
    padding: 60px 0;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
}

.section-title {
    font-size: 24px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-more {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    color: var(--text-muted);
}

.section-more:hover {
    color: var(--primary);
}

/* ===================================
   商品分类
   =================================== */

.category-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 20px;
}

.category-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 16px;
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    transition: var(--transition);
}

.category-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.category-icon {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: var(--text-light);
    border-radius: var(--radius-full);
    margin-bottom: 12px;
}

.category-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.category-desc {
    font-size: 12px;
    color: var(--text-muted);
}

/* ===================================
   商品卡片
   =================================== */

.product-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.product-card {
    display: block;
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: var(--transition);
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.product-image {
    position: relative;
    aspect-ratio: 1;
    background: var(--bg-gray);
    overflow: hidden;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.product-card:hover .product-image img {
    transform: scale(1.05);
}

.product-tag {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 4px 8px;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-light);
    border-radius: var(--radius-sm);
}

.product-tag.hot {
    background: linear-gradient(135deg, #ff6b35, #ff8c42);
}

.product-tag.new {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
}

.product-info {
    padding: 16px;
}

.product-name {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.product-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.product-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.product-price {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.price-current {
    font-size: 18px;
    font-weight: 700;
    color: var(--danger);
}

.price-original {
    font-size: 12px;
    color: var(--text-muted);
    text-decoration: line-through;
}

.btn-add-cart {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--text-light);
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: var(--radius-full);
    transition: var(--transition);
}

.btn-add-cart:hover {
    transform: scale(1.1);
}

/* ===================================
   促销活动
   =================================== */

.promotion-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr;
    gap: 20px;
}

.promotion-card {
    position: relative;
    padding: 24px;
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    min-height: 200px;
    display: flex;
    flex-direction: column;
}

.promotion-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 150px;
    height: 150px;
    background: linear-gradient(135deg, transparent 50%, var(--bg-gray) 50%);
    border-radius: 0 0 0 100%;
}

.promotion-large {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: var(--text-light);
}

.promotion-large::before {
    background: rgba(255,255,255,0.1);
}

.promotion-large .promotion-tag {
    background: var(--bg-white);
    color: var(--primary);
}

.promotion-tag {
    position: absolute;
    top: 16px;
    right: 16px;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 600;
    background: var(--danger);
    color: var(--text-light);
    border-radius: var(--radius-full);
}

.promotion-content {
    position: relative;
    z-index: 1;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.promotion-content h3 {
    font-size: 20px;
    margin-bottom: 8px;
}

.promotion-content p {
    font-size: 14px;
    opacity: 0.8;
    margin-bottom: 16px;
}

.promotion-price {
    font-size: 28px;
    font-weight: 700;
    color: var(--danger);
    margin-bottom: 12px;
}

.promotion-highlight {
    font-size: 36px;
    font-weight: 700;
    color: var(--danger);
    margin-bottom: 12px;
}

.countdown {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.countdown-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 12px;
    background: rgba(0,0,0,0.2);
    border-radius: var(--radius-sm);
}

.countdown-num {
    font-size: 20px;
    font-weight: 700;
}

.countdown-item small {
    font-size: 10px;
    opacity: 0.8;
}

/* ===================================
   特色服务
   =================================== */

.features {
    background: var(--bg-white);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 40px;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 16px;
}

.feature-icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: var(--primary);
    background: rgba(45, 80, 22, 0.1);
    border-radius: var(--radius-full);
}

.feature-info h4 {
    font-size: 16px;
    margin-bottom: 4px;
}

.feature-info p {
    font-size: 12px;
    color: var(--text-muted);
}

/* ===================================
   底部导航（移动端）
   =================================== */

.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--bg-white);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 100;
}

.bottom-nav-item {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: 10px;
    color: var(--text-muted);
}

.bottom-nav-item i {
    font-size: 22px;
}

.bottom-nav-item.active {
    color: var(--primary);
}

.bottom-nav-item .badge {
    position: absolute;
    top: 2px;
    right: calc(50% - 18px);
    display: none;
}

/* ===================================
   页脚
   =================================== */

.footer {
    background: var(--bg-dark);
    color: var(--text-light);
    padding: 60px 0 30px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

.footer-col h4 {
    font-size: 16px;
    margin-bottom: 16px;
}

.footer-col p {
    font-size: 13px;
    opacity: 0.7;
    line-height: 1.8;
}

.footer-col ul li {
    margin-bottom: 10px;
}

.footer-col ul li a {
    font-size: 13px;
    opacity: 0.7;
}

.footer-col ul li a:hover {
    opacity: 1;
    color: var(--primary-light);
}

.contact-info li {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    opacity: 0.7;
    margin-bottom: 10px;
}

.footer-bottom {
    padding-top: 30px;
    border-top: 1px solid rgba(255,255,255,0.1);
    text-align: center;
    font-size: 12px;
    opacity: 0.6;
}

.footer-bottom a:hover {
    opacity: 1;
    color: var(--primary-light);
}

/* 返回顶部 */
.back-to-top {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--text-light);
    background: var(--primary);
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-md);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: var(--transition);
    z-index: 99;
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background: var(--primary-dark);
}

/* ===================================
   响应式设计
   =================================== */

@media (max-width: 1200px) {
    :root {
        --container: 960px;
    }
    
    .category-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 992px) {
    .nav {
        display: none;
    }
    
    .menu-btn {
        display: flex;
    }
    
    .hero-swiper {
        height: 400px;
    }
    
    .slide-content h2 {
        font-size: 32px;
    }
    
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 30px;
    }
    
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    :root {
        --header-height: 60px;
    }
    
    .header-actions .action-btn:not(.menu-btn) {
        display: none;
    }
    
    .hero-swiper {
        height: 280px;
    }
    
    .slide-content h2 {
        font-size: 24px;
    }
    
    .slide-content p {
        font-size: 14px;
    }
    
    .section {
        padding: 40px 0;
    }
    
    .section-title {
        font-size: 20px;
    }
    
    .category-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }
    
    .category-card {
        padding: 16px 8px;
    }
    
    .category-icon {
        width: 48px;
        height: 48px;
        font-size: 22px;
    }
    
    .category-name {
        font-size: 13px;
    }
    
    .category-desc {
        display: none;
    }
    
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .product-info {
        padding: 12px;
    }
    
    .product-name {
        font-size: 13px;
    }
    
    .price-current {
        font-size: 16px;
    }
    
    .promotion-grid {
        grid-template-columns: 1fr;
    }
    
    .promotion-large {
        min-height: 180px;
    }
    
    .bottom-nav {
        display: flex;
    }
    
    .footer {
        padding-bottom: 80px;
    }
    
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .back-to-top {
        bottom: 80px;
    }
}

@media (max-width: 480px) {
    .hero-swiper {
        height: 220px;
    }
    
    .swiper-button-prev, .swiper-button-next {
        display: none;
    }
    
    .category-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .features-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

/* ===================================
   表单样式
   =================================== */

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.form-input {
    width: 100%;
    height: 44px;
    padding: 0 16px;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(45, 80, 22, 0.1);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-textarea {
    height: auto;
    min-height: 120px;
    padding: 12px 16px;
    resize: vertical;
}

.form-error {
    font-size: 12px;
    color: var(--danger);
    margin-top: 6px;
}

/* ===================================
   页面容器
   =================================== */

.page-container {
    max-width: 480px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    padding-top: calc(var(--header-height) + 20px);
}

.page-header {
    text-align: center;
    margin-bottom: 40px;
}

.page-header h1 {
    font-size: 24px;
    margin-bottom: 8px;
}

.page-header p {
    font-size: 14px;
    color: var(--text-muted);
}

.auth-form {
    background: var(--bg-white);
    padding: 30px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 24px 0;
    color: var(--text-muted);
    font-size: 12px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 14px;
    color: var(--text-muted);
}

.auth-footer a {
    color: var(--primary);
    font-weight: 500;
}

/* ===================================
   空状态
   =================================== */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.empty-state i {
    font-size: 64px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 16px;
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* ===================================
   加载状态
   =================================== */

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.loading::after {
    content: '';
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===================================
   标签页
   =================================== */

.tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--bg-gray);
    border-radius: var(--radius-md);
    margin-bottom: 20px;
}

.tab-item {
    flex: 1;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    color: var(--text-secondary);
    background: transparent;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.tab-item.active {
    color: var(--primary);
    background: var(--bg-white);
    box-shadow: var(--shadow-sm);
}

/* ===================================
   列表样式
   =================================== */

.list-item {
    display: flex;
    align-items: center;
    padding: 16px;
    background: var(--bg-white);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    transition: var(--transition);
}

.list-item:hover {
    box-shadow: var(--shadow-sm);
}

.list-item-image {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-md);
    overflow: hidden;
    flex-shrink: 0;
}

.list-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.list-item-content {
    flex: 1;
    margin-left: 16px;
}

.list-item-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
}

.list-item-desc {
    font-size: 12px;
    color: var(--text-muted);
}

.list-item-action {
    flex-shrink: 0;
    margin-left: 16px;
}
