:root {
    --primary-color: #1d1d1f;       /* 深空黑（Apple风格） */
    --secondary-color: #86868b;     /* 高级灰 */
    --accent-color: #0066cc;        /* 精致的科技蓝，仅用于重要操作 */
    
    --bg-color: #f5f5f7;            /* 浅灰背景，衬托卡片 */
    --card-bg: #ffffff;             /* 纯白卡片 */
    
    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.04); /* 极其柔和的弥散阴影 */
    --shadow-hover: 0 8px 32px rgba(0, 0, 0, 0.08);
    --shadow-float: 0 20px 40px rgba(0, 0, 0, 0.1);
    
    --radius-sm: 8px;
    --radius-md: 18px;              /* 更圆润的角 */
    --radius-lg: 24px;
    
    --font-main: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Roboto, sans-serif;
    
    --spacing-container: 24px;
    --max-width: 960px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--primary-color);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding-bottom: 120px; /* 底部留出更多空间给悬浮导航 */
}

/* Header - 磨砂玻璃通栏 */
header {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    padding: 18px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    transition: background 0.3s;
}

header h1 {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-color);
    letter-spacing: -0.5px;
}

.user-info {
    font-size: 13px;
    font-weight: 500;
    color: var(--secondary-color);
    background: rgba(0,0,0,0.05);
    padding: 6px 12px;
    border-radius: 20px;
}

.back-btn {
    background: #f2f2f7;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.back-btn:hover {
    background: #e5e5ea;
    transform: scale(1.05);
}

/* Authentication Pages */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: #fff; /* 登录页用纯白背景更干净 */
}

.auth-box {
    width: 100%;
    max-width: 400px;
    padding: 40px;
}

.auth-box h1 {
    margin-bottom: 10px;
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -1px;
}

.auth-subtitle {
    color: var(--secondary-color);
    margin-bottom: 40px;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-color);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 16px;
    border: 1px solid #d2d2d7;
    border-radius: 12px;
    font-size: 17px;
    background: #fff;
    transition: all 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 4px rgba(0, 102, 204, 0.1);
}

/* Buttons - 扎实的质感 */
.btn-primary {
    width: 100%;
    padding: 16px;
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.2s;
}

.btn-primary:hover {
    opacity: 0.9;
    transform: scale(1.01);
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-secondary {
    padding: 12px 24px;
    background: #e5e5ea;
    color: var(--primary-color);
    border: none;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: #d1d1d6;
}

.btn-danger {
    padding: 16px;
    background: #fff0f0;
    color: #ff3b30;
    border: none;
    border-radius: 12px;
    width: 100%;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
}

.btn-danger:hover {
    background: #ffe5e5;
}

.btn-full {
    width: 100%;
}

.auth-links {
    margin-top: 30px;
    text-align: center;
    font-size: 14px;
}

.auth-links a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 500;
}

/* Products Grid - 悬浮卡片 */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 24px;
    padding: 24px;
}

.product-card {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    box-shadow: var(--shadow-card);
    border: 1px solid rgba(0,0,0,0.02);
    position: relative;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-hover);
}

.product-card img {
    width: 100%;
    height: 240px;
    object-fit: cover;
    background-color: #f2f2f7;
}

.product-card h3 {
    padding: 20px 20px 4px;
    font-size: 17px;
    font-weight: 600;
    color: var(--primary-color);
}

.product-description {
    padding: 0 20px;
    color: var(--secondary-color);
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 40px;
}

.product-price {
    padding: 0 20px;
    font-size: 20px;
    color: var(--primary-color);
    font-weight: 700;
    letter-spacing: -0.5px;
}

.product-card button {
    margin: 20px;
    margin-top: auto;
    width: calc(100% - 40px);
    padding: 12px;
    background: #f2f2f7;
    color: var(--primary-color);
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
}

.product-card button:hover {
    background: var(--primary-color);
    color: #fff;
}

/* Navigation - 悬浮玻璃岛 */
.bottom-nav {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 500px;
    background: rgba(29, 29, 31, 0.85); /* 深色玻璃 */
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    display: flex;
    justify-content: space-between;
    padding: 14px 30px;
    border-radius: 40px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    z-index: 1000;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.5);
    transition: all 0.3s;
    position: relative;
}

.nav-item.active {
    color: #fff;
}

.nav-icon svg {
    width: 24px;
    height: 24px;
    stroke-width: 2;
}

.nav-text {
    font-size: 10px;
    margin-top: 4px;
    font-weight: 500;
}

/* Modal - 居中弹窗 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: #fff;
    padding: 40px;
    border-radius: 24px;
    max-width: 480px;
    width: 90%;
    box-shadow: var(--shadow-float);
    animation: scaleIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes scaleIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-content h2 {
    margin-bottom: 16px;
    font-size: 24px;
    font-weight: 700;
}

#announcementContent {
    color: var(--secondary-color);
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 32px;
}

.modal-buttons {
    display: flex;
    gap: 16px;
}

.modal-buttons button {
    flex: 1;
}

/* Product Detail */
.product-detail {
    background: #fff;
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin: 20px;
    box-shadow: var(--shadow-card);
}

.product-image img {
    width: 100%;
    height: auto;
    max-height: 500px;
    object-fit: contain;
    background: #fff;
}

.product-info {
    padding: 40px;
}

.product-info h2 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

.product-stock {
    display: inline-block;
    background: #f2f2f7;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 13px;
    color: var(--secondary-color);
    margin-bottom: 24px;
    font-weight: 500;
}

.product-price {
    padding: 0;
    font-size: 28px;
    margin-bottom: 40px;
}

.product-actions {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 16px;
}

/* Cart & Profile Lists - 模块化列表 */
.cart-page,
.profile-page,
.messages-page {
    padding: 20px;
}

.cart-item {
    background: #fff;
    padding: 20px;
    border-radius: var(--radius-md);
    display: flex;
    gap: 20px;
    align-items: center;
    margin-bottom: 20px;
    box-shadow: var(--shadow-card);
}

.cart-item img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 12px;
    background: #f2f2f7;
}

.cart-item-info h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 6px;
}

.cart-item .price {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-color);
}

.empty-message {
    text-align: center;
    padding: 60px 0;
    color: var(--secondary-color);
}

/* Profile */
.profile-header {
    background: #fff;
    padding: 40px;
    text-align: center;
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
    box-shadow: var(--shadow-card);
}

.profile-avatar {
    width: 100px;
    height: 100px;
    margin: 0 auto 20px;
    background: #f2f2f7;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    font-size: 40px;
}

.profile-header h2 {
    font-size: 24px;
    font-weight: 700;
}

.profile-menu {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.profile-section {
    background: #fff;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-card);
}

.profile-section h3 {
    padding: 20px 24px 10px;
    font-size: 12px;
    color: var(--secondary-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.menu-item {
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid #f2f2f7;
}

.menu-item:last-child {
    border-bottom: none;
}

.menu-item:hover {
    background: #f9f9f9;
}

.menu-item span {
    display: flex;
    align-items: center;
    font-size: 16px;
    font-weight: 500;
}

.menu-item svg {
    width: 20px;
    height: 20px;
    color: var(--primary-color);
    margin-right: 12px;
}

.arrow {
    color: #c7c7cc;
    font-size: 20px;
}

/* Messages */
.message-item {
    background: #fff;
    padding: 24px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-card);
    cursor: pointer;
    transition: transform 0.2s;
}

.message-item:hover {
    transform: scale(1.02);
}

.message-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #0066cc 0%, #004499 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.3);
}

.message-item.disabled .message-icon {
    background: #e5e5ea;
    color: #999;
    box-shadow: none;
}

.message-text {
    font-size: 16px;
    font-weight: 600;
}

.message-subtitle {
    font-size: 12px;
    color: var(--secondary-color);
    font-weight: 400;
    margin-top: 4px;
    line-height: 1.4;
}

/* Coupon Card */
.coupon-card {
    background: #fff;
    padding: 32px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.03);
}

.coupon-card::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 6px;
    background: var(--accent-color);
}

.coupon-discount {
    font-size: 40px;
    font-weight: 800;
    color: var(--accent-color);
    letter-spacing: -1px;
}

.coupon-info h3 {
    font-size: 18px;
    margin-bottom: 6px;
    font-weight: 700;
}

.coupon-info p {
    color: var(--secondary-color);
    font-size: 13px;
}

/* Chat UI */
.chat-page {
    padding-bottom: 80px;
}

.chat-messages {
    padding: 20px;
}

.chat-message {
    max-width: 80%;
    padding: 14px 18px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.5;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}

.user-message {
    background: var(--accent-color);
    color: #fff;
    border-bottom-right-radius: 4px;
    margin-left: auto;
}

.bot-message {
    background: #fff;
    color: var(--primary-color);
    border-bottom-left-radius: 4px;
}

.chat-input {
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(0,0,0,0.05);
    padding: 16px 24px;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 900;
}

.chat-input input {
    background: #f2f2f7;
    padding: 12px 20px;
    border-radius: 24px;
}

.chat-input button {
    border-radius: 24px;
    padding: 10px 24px;
    background: var(--accent-color);
}

/* 正在输入动画 */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 14px 18px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--secondary-color);
    animation: typing 1.4s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Payment */
.payment-qrcode {
    background: #fff;
    padding: 60px 40px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    text-align: center;
    margin-top: 20px;
}

.qrcode-container {
    background: #fff;
    padding: 20px;
    border-radius: 16px;
    border: 1px solid #f2f2f7;
    display: inline-block;
    margin: 30px 0;
}

/* 小说下载按钮区域 */
.novel-download-section {
    padding: 24px;
    margin-top: 20px;
}

.novel-download-btn {
    width: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: var(--radius-lg);
    padding: 24px 28px;
    display: flex;
    align-items: center;
    gap: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
    position: relative;
    overflow: hidden;
}

.novel-download-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.novel-download-btn:hover::before {
    left: 100%;
}

.novel-download-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(102, 126, 234, 0.5);
}

.novel-download-btn:active {
    transform: translateY(-2px);
}

.novel-btn-icon {
    font-size: 48px;
    line-height: 1;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.novel-btn-content {
    flex: 1;
    text-align: left;
}

.novel-btn-title {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 6px;
    letter-spacing: -0.3px;
}

.novel-btn-subtitle {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 400;
}

.novel-btn-arrow {
    font-size: 28px;
    color: #fff;
    font-weight: 300;
    transition: transform 0.3s;
}

.novel-download-btn:hover .novel-btn-arrow {
    transform: translateX(4px);
}