/**
 * 易卖网 - 完整样式文件
 * 响应式设计，完美支持移动端和PC端
 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --primary-color: #ff6b35;
    --primary-dark: #e55a2b;
    --danger-color: #e53e3e;
    --secondary-color: #2b9348;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --bg-gray: #f8fafc;
    --bg-white: #ffffff;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-gray);
    color: var(--text-primary);
    overflow-x: hidden;
    width: 100%;
}

@media (min-width: 768px) {
    body {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        display: flex;
        justify-content: center;
        align-items: center;
        min-height: 100vh;
        padding: 20px;
    }
}

@media (max-width: 767px) {
    body {
        padding-bottom: 70px;
    }
}

.app-main-container {
    width: 100%;
    position: relative;
    background: var(--bg-gray);
    overflow-x: hidden;
}

@media (min-width: 768px) {
    .app-main-container {
        max-width: 480px;
        margin: 0 auto;
        border-radius: var(--radius-xl);
        overflow: hidden;
        box-shadow: var(--shadow-lg);
        background: var(--bg-white);
    }
}

@media (max-width: 767px) {
    .app-main-container {
        min-height: 100vh;
    }
}

/* 顶部导航 */
.app-header {
    background: var(--bg-white);
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    background: rgba(255,255,255,0.95);
    width: 100%;
}

.header-top {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.location-selector {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    font-weight: 500;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}

.search-bar {
    flex: 1;
    display: flex;
    align-items: center;
    background: var(--bg-gray);
    border-radius: var(--radius-xl);
    padding: 8px 12px;
    gap: 6px;
    min-width: 0;
}

.search-bar input {
    flex: 1;
    border: none;
    background: none;
    outline: none;
    font-size: 14px;
    padding: 0;
    min-width: 0;
}

.search-btn, .voice-btn, .scan-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    color: var(--text-muted);
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    width: 32px;
    height: 32px;
}

.search-btn:hover {
    background: var(--primary-color);
    color: white;
}

.voice-btn:hover, .scan-btn:hover {
    background: var(--bg-gray);
    color: var(--primary-color);
}

.publish-btn {
    background: var(--primary-color);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

/* 搜索联想 */
.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    margin-top: 8px;
    z-index: 101;
    max-height: 400px;
    overflow-y: auto;
}

@media (min-width: 768px) {
    .search-suggestions {
        max-width: 480px;
        left: 50%;
        transform: translateX(-50%);
    }
}

.suggestions-header {
    display: flex;
    gap: 16px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.suggestions-header span {
    cursor: pointer;
    color: var(--text-muted);
}

.suggestions-header span.active {
    color: var(--primary-color);
}

.suggestions-content {
    padding: 12px 16px;
}

.hot-keywords, .history-keywords {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.hot-tag {
    background: var(--bg-gray);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.hot-tag:hover {
    background: var(--primary-color);
    color: white;
}

/* 分类导航 */
.category-nav {
    background: var(--bg-white);
    padding: 12px 0;
    overflow-x: auto;
    overflow-y: hidden;
    border-bottom: 1px solid var(--border-color);
    width: 100%;
    white-space: nowrap;
}

.category-nav::-webkit-scrollbar {
    display: none;
}

.category-scroll {
    display: inline-flex;
    gap: 20px;
    padding: 0 16px;
}

.category-item {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    flex-shrink: 0;
}

.category-icon {
    width: 44px;
    height: 44px;
    background: var(--bg-gray);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.category-item.active .category-name {
    color: var(--primary-color);
    font-weight: 500;
}

.category-name {
    font-size: 12px;
    color: var(--text-secondary);
}

/* 推广横幅 */
.promotion-banner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 16px;
    background: linear-gradient(135deg, #fff5f0 0%, #fff0e6 100%);
}

.promotion-item {
    background: var(--bg-white);
    border-radius: var(--radius-md);
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.promotion-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
}

.promotion-info {
    flex: 1;
}

.promotion-info h3 {
    font-size: 16px;
    font-weight: 600;
}

.promotion-info p {
    font-size: 11px;
    color: var(--text-muted);
}

/* 区块头部 */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
}

.section-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.recommend-tip {
    font-size: 12px;
    color: var(--text-muted);
}

.section-controls {
    display: flex;
    gap: 8px;
}

.section-controls button {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-white);
    cursor: pointer;
}

/* ==================== 最新商品滚动 ==================== */
.new-products-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 0 16px 16px;
    width: 100%;
    scrollbar-width: thin;
}

.new-products-scroll::-webkit-scrollbar {
    height: 4px;
}

.new-products-scroll::-webkit-scrollbar-track {
    background: var(--border-color);
    border-radius: 2px;
}

.new-products-scroll::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 2px;
}

.new-products-wrapper {
    display: inline-flex;
    gap: 12px;
    min-width: min-content;
}

/* 最新商品卡片 - 缩小尺寸，一栏显示5个 */
.new-product-card {
    width: 110px;
    flex-shrink: 0;
    background: var(--bg-white);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-fast);
    cursor: pointer;
}

.new-product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.new-product-img {
    width: 100%;
    height: 110px;
    object-fit: cover;
    background: var(--bg-gray);
}

.new-product-info {
    padding: 8px;
}

.new-product-title {
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.new-product-price {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 13px;
}
/* 平板适配 */
@media (min-width: 768px) and (max-width: 1024px) {
    .new-product-card {
        width: 110px;
    }
    .new-product-img {
        height: 110px;
    }
}
/* 大屏手机适配 */
@media (min-width: 481px) and (max-width: 767px) {
    .new-product-card {
        width: 105px;
    }
    .new-product-img {
        height: 105px;
    }
}

/* 小屏手机适配 */
@media (max-width: 480px) {
    .new-product-card {
        width: 90px;
    }
    .new-product-img {
        height: 90px;
    }
    .new-products-wrapper {
        gap: 8px;
    }
}

/* 超小屏适配 */
@media (max-width: 380px) {
    .new-product-card {
        width: 80px;
    }
    .new-product-img {
        height: 80px;
    }
    .new-product-title {
        font-size: 10px;
    }
    .new-product-price {
        font-size: 11px;
    }
}


/* 商品网格 */
.products-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 0 16px;
}

/* 商品卡片样式 */
.product-card {
    background: var(--bg-white);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-fast);
    cursor: pointer;
}

.product-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.product-img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    background: var(--bg-gray);
}

.product-info {
    padding: 10px;
}

.product-title {
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.4;
    min-height: 36px;
}

.product-price {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 15px;
}

/* 底部导航 */
/* ==================== 底部导航 - 完整修复版 ==================== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-white);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 8px 0 12px;
    z-index: 100;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}
/* 底部导航a标签样式 */
.bottom-nav .nav-item {
    text-decoration: none;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex: 1;
    max-width: 80px;
    padding: 4px 0;
    transition: all var(--transition-fast);
}

.bottom-nav .nav-item.active {
    color: var(--primary-color);
}

.bottom-nav .nav-item:hover:not(.active) {
    color: var(--primary-color);
    transform: translateY(-2px);
}

/* PC端：底部导航跟随主体容器宽度（480px），居中显示 */
@media (min-width: 768px) {
    .bottom-nav {
        max-width: 480px;
        width: 100%;
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -2px 15px rgba(0,0,0,0.1);
    }
}

/* 移动端：底部导航全宽显示 */
@media (max-width: 767px) {
    .bottom-nav {
        width: 100%;
        left: 0;
        right: 0;
        transform: none;
        border-radius: 0;
    }
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    flex: 1;
    max-width: 80px;
    padding: 4px 0;
    color: var(--text-muted);
}

.nav-item.active {
    color: var(--primary-color);
}

.nav-item:hover:not(.active) {
    color: var(--primary-color);
    transform: translateY(-2px);
}

.nav-icon {
    width: 22px;
    height: 22px;
    transition: transform var(--transition-fast);
}

.nav-item.active .nav-icon {
    transform: scale(1.1);
}

.nav-item span {
    font-size: 11px;
    font-weight: 500;
}

.nav-item .badge {
    position: absolute;
    top: -4px;
    right: 50%;
    transform: translateX(50%);
    background: var(--danger-color);
    color: white;
    font-size: 10px;
    padding: 2px 5px;
    border-radius: 10px;
    min-width: 16px;
    text-align: center;
    font-weight: bold;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* 发布按钮特殊样式 */
.publish-center {
    position: relative;
    top: -15px;
}

.publish-center .nav-icon {
    width: 28px;
    height: 28px;
    background: var(--primary-color);
    border-radius: 50%;
    padding: 6px;
    stroke: white;
    stroke-width: 2;
    box-shadow: 0 4px 10px rgba(255,107,53,0.3);
    transition: all var(--transition-fast);
}

.publish-center:hover .nav-icon {
    transform: scale(1.1);
    box-shadow: 0 6px 15px rgba(255,107,53,0.4);
}

.publish-center span {
    margin-top: 2px;
}

/* 移动端适配 */
@media (max-width: 767px) {
    .bottom-nav {
        padding: 6px 0 10px;
    }
    
    .nav-icon {
        width: 20px;
        height: 20px;
    }
    
    .publish-center {
        top: -12px;
    }
    
    .publish-center .nav-icon {
        width: 24px;
        height: 24px;
        padding: 5px;
    }
    
    .nav-item span {
        font-size: 10px;
    }
}

/* 小屏手机适配 */
@media (max-width: 380px) {
    .nav-icon {
        width: 18px;
        height: 18px;
    }
    
    .publish-center .nav-icon {
        width: 22px;
        height: 22px;
        padding: 4px;
    }
    
    .nav-item span {
        font-size: 9px;
    }
}

/* 安全区域适配（iPhone X 及以上） */
@supports (padding: max(0px)) {
    .bottom-nav {
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }
}
/* 模态框 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 400px;
    max-height: 80%;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
}

.modal-body {
    padding: 16px;
}

.current-location button {
    width: 100%;
    padding: 12px;
    background: var(--bg-gray);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
}

.city-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

.city-list span {
    padding: 8px 16px;
    background: var(--bg-gray);
    border-radius: 20px;
    cursor: pointer;
}

/* 语音动画 */
.voice-content {
    text-align: center;
    padding: 40px;
}

.voice-animation {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    height: 100px;
    margin-bottom: 20px;
}

.voice-wave {
    width: 8px;
    height: 40px;
    background: var(--primary-color);
    border-radius: 4px;
    animation: wave 0.8s ease-in-out infinite;
}

.voice-wave:nth-child(2) { animation-delay: 0.2s; height: 60px; }
.voice-wave:nth-child(3) { animation-delay: 0.4s; height: 80px; }

@keyframes wave {
    0%, 100% { transform: scaleY(1); }
    50% { transform: scaleY(1.5); }
}

.voice-cancel, .scan-cancel {
    margin-top: 20px;
    padding: 10px 24px;
    background: var(--bg-gray);
    border: none;
    border-radius: 20px;
    cursor: pointer;
}

/* 扫一扫 */
.scan-content {
    text-align: center;
}

.scan-area {
    position: relative;
    width: 250px;
    height: 250px;
    margin: 20px auto;
    background: #000;
    overflow: hidden;
    border-radius: var(--radius-md);
}

.scan-frame {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 2px solid var(--primary-color);
    box-shadow: 0 0 0 1000px rgba(0,0,0,0.5);
}

.scan-line {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-color);
    animation: scan 2s linear infinite;
}

@keyframes scan {
    0% { top: 0; }
    100% { top: 100%; }
}

/* 加载动画 */
.loading-spinner {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.loading-more {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    grid-column: span 2;
}

.load-more-trigger {
    height: 20px;
    margin: 20px 0;
}