/* ============================================================
   优选商城 公共样式
   适用于所有前台页面
   ============================================================ */

/* ============================================================
   1. 全局重置
   ============================================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    background-color: #f5f6fa;
    color: #2d3436;
    font-size: 14px;
    line-height: 1.5;
    height: 100%;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

img {
    display: block;
    max-width: 100%;
}

ul,
ol {
    list-style: none;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    outline: none;
    background: none;
}

input,
textarea,
select {
    font-family: inherit;
    outline: none;
    border: none;
}

/* ============================================================
   2. Toast 提示
   ============================================================ */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: rgba(0, 0, 0, 0.78);
    color: #fff;
    padding: 14px 28px;
    border-radius: 12px;
    font-size: 15px;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    text-align: center;
    max-width: 80%;
    min-width: 120px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.20);
}

.toast.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    pointer-events: auto;
}

/* ============================================================
   3. 顶部搜索栏
   ============================================================ */
.top-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: linear-gradient(135deg, #ff6b35 0%, #f93b1d 100%);
    padding: 10px 16px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 2px 12px rgba(249, 59, 29, 0.30);
}

.search-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 24px;
    padding: 0 14px;
    height: 38px;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.search-wrapper:focus-within {
    background: #ffffff;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.search-wrapper i {
    color: #999;
    font-size: 15px;
    margin-right: 8px;
    flex-shrink: 0;
}

.search-wrapper input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 14px;
    color: #2d3436;
    height: 100%;
    padding: 0 4px;
    min-width: 0;
}

.search-wrapper input::placeholder {
    color: #b2bec3;
    font-size: 13px;
}

.search-btn {
    background: #ff6b35;
    border: none;
    color: #fff;
    border-radius: 20px;
    padding: 4px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    flex-shrink: 0;
    height: 28px;
    line-height: 28px;
    margin-left: 6px;
}

.search-btn:hover {
    background: #e85a2a;
}

.search-btn:active {
    transform: scale(0.92);
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.top-actions .action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    background: transparent;
    min-width: 44px;
    height: 38px;
    line-height: 1.2;
    border: none;
}

.top-actions .action-btn i {
    font-size: 18px;
    margin-bottom: 1px;
}

.top-actions .action-btn span {
    font-size: 10px;
    opacity: 0.9;
    max-width: 48px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.top-actions .action-btn:active {
    transform: scale(0.92);
}

/* ============================================================
   4. Banner 轮播
   ============================================================ */
.banner-wrap {
    position: relative;
    margin: 12px 12px 8px;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    background: #dfe6e9;
    min-height: 120px;
}

.banner-slider {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 7;
    overflow: hidden;
}

.banner-slider .slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.6s ease;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 22px;
    font-weight: 600;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
    cursor: pointer;
}

.banner-slider .slide.active {
    opacity: 1;
    z-index: 2;
}

.banner-slider .slide .slide-label {
    background: rgba(0, 0, 0, 0.35);
    padding: 6px 20px;
    border-radius: 30px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    font-size: 16px;
    letter-spacing: 2px;
}

.banner-dots {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 5;
}

.banner-dots .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.3s;
    border: none;
    padding: 0;
}

.banner-dots .dot.active {
    background: #fff;
    width: 22px;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

/* ============================================================
   5. 快捷导航
   ============================================================ */
.nav-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    background: #fff;
    margin: 0 12px 10px;
    padding: 14px 4px 12px;
    border-radius: 14px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
}

.nav-grid .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 4px 0;
    cursor: pointer;
    border-radius: 10px;
    transition: background 0.2s;
    border: none;
    background: transparent;
    font-family: inherit;
}

.nav-grid .nav-item:active {
    background: #f0f0f0;
    transform: scale(0.94);
}

.nav-grid .nav-item .icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.nav-grid .nav-item .icon.orange {
    background: linear-gradient(135deg, #ff9a56, #ff6b35);
}

.nav-grid .nav-item .icon.blue {
    background: linear-gradient(135deg, #54a0ff, #2e86de);
}

.nav-grid .nav-item .icon.green {
    background: linear-gradient(135deg, #55efc4, #00b894);
}

.nav-grid .nav-item .icon.purple {
    background: linear-gradient(135deg, #a29bfe, #6c5ce7);
}

.nav-grid .nav-item .label {
    font-size: 12px;
    color: #2d3436;
    font-weight: 500;
}

/* ============================================================
   6. 底部导航
   ============================================================ */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 200;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: stretch;
    height: 58px;
    max-width: 480px;
    margin: 0 auto;
}

.bottom-nav .nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    cursor: pointer;
    border: none;
    background: transparent;
    font-family: inherit;
    color: #999;
    transition: color 0.2s;
    position: relative;
    padding: 4px 0;
}

.bottom-nav .nav-item i {
    font-size: 22px;
    transition: transform 0.2s;
}

.bottom-nav .nav-item span {
    font-size: 10px;
    font-weight: 500;
}

.bottom-nav .nav-item.active {
    color: #ff6b35;
}

.bottom-nav .nav-item.active i {
    transform: scale(1.05);
}

.bottom-nav .nav-item:active {
    transform: scale(0.92);
}

/* 底部导航中间的 "发布" 按钮 */
.bottom-nav .nav-item.center-btn {
    position: relative;
}

.bottom-nav .nav-item.center-btn .icon-wrap {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #ff6b35, #f93b1d);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 26px;
    margin-top: -20px;
    box-shadow: 0 4px 16px rgba(249, 59, 29, 0.35);
    transition: transform 0.2s;
}

.bottom-nav .nav-item.center-btn:active .icon-wrap {
    transform: scale(0.90);
}

.bottom-nav .nav-item.center-btn span {
    color: #2d3436;
    margin-top: 2px;
}

/* ============================================================
   7. 抽屉（城市/价格选择）
   ============================================================ */
.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0);
    visibility: hidden;
    z-index: 300;
    transition: background 0.3s ease, visibility 0.3s ease;
    display: flex;
    align-items: stretch;
    justify-content: flex-end;
}

.drawer-overlay.show {
    background: rgba(0, 0, 0, 0.45);
    visibility: visible;
}

.drawer-overlay .drawer-panel {
    background: #fff;
    width: 82%;
    max-width: 340px;
    height: 100%;
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    padding: 24px 20px 32px;
    border-radius: 20px 0 0 20px;
    box-shadow: -6px 0 24px rgba(0, 0, 0, 0.10);
}

.drawer-overlay.show .drawer-panel {
    transform: translateX(0);
}

.drawer-panel .panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid #f0f0f0;
}

.drawer-panel .panel-header h3 {
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.drawer-panel .panel-header h3 i {
    color: #ff6b35;
}

.drawer-panel .panel-header .close-btn {
    font-size: 24px;
    color: #999;
    cursor: pointer;
    background: none;
    border: none;
    padding: 4px 8px;
    border-radius: 8px;
    transition: background 0.2s;
}

.drawer-panel .panel-header .close-btn:active {
    background: #f0f0f0;
}

.drawer-panel .option-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 4px;
}

.drawer-panel .option-grid .opt {
    padding: 10px 20px;
    border-radius: 24px;
    border: 1.5px solid #e0e0e0;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s;
    background: #fff;
    color: #2d3436;
    flex: 0 0 auto;
}

.drawer-panel .option-grid .opt:active {
    transform: scale(0.94);
}

.drawer-panel .option-grid .opt.active {
    border-color: #ff6b35;
    background: #fff5f0;
    color: #ff6b35;
    font-weight: 500;
}
/* 抽屉面板 */
.drawer-panel .option-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 4px;
}
.drawer-panel .option-list .opt {
    padding: 14px 20px;
    border-radius: 12px;
    border: 1.5px solid #e0e0e0;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s;
    background: #fff;
    color: #2d3436;
    text-align: center;
}
.drawer-panel .option-list .opt.active {
    border-color: #ff6b35;
    background: #fff5f0;
    color: #ff6b35;
    font-weight: 500;
}
/* ============================================================
   8. 商品列表
   ============================================================ */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px 6px;
}

.section-header h2 {
    font-size: 17px;
    font-weight: 700;
    color: #2d3436;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-header h2 i {
    color: #ff6b35;
}

.section-header .more {
    font-size: 12px;
    color: #999;
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.section-header .more:active {
    opacity: 0.6;
}

.product-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 0 12px 100px;
}

.product-item {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.product-item:active {
    transform: scale(0.97);
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.08);
}

.product-item .img-wrap {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #f0f0f0;
    overflow: hidden;
    position: relative;
}

.product-item .img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s;
}

.product-item .info {
    padding: 10px 10px 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.product-item .info .title {
    font-size: 13px;
    font-weight: 500;
    color: #2d3436;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
    min-height: 36px;
}

.product-item .info .price-row {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-top: 2px;
}

.product-item .info .price-row .price {
    font-size: 18px;
    font-weight: 700;
    color: #f93b1d;
}

.product-item .info .price-row .price .symbol {
    font-size: 12px;
    font-weight: 600;
}

.product-item .info .price-row .origin-price {
    font-size: 12px;
    color: #b2bec3;
    text-decoration: line-through;
}

.product-item .info .sale-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    color: #999;
    margin-top: 2px;
}

.product-item .info .sale-row .tag {
    background: #ff6b35;
    color: #fff;
    padding: 0 8px;
    border-radius: 10px;
    font-size: 10px;
    line-height: 18px;
    font-weight: 500;
}

/* ============================================================
   9. 加载更多
   ============================================================ */
.load-more {
    text-align: center;
    padding: 12px 0 30px;
    color: #b2bec3;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.load-more .spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid #eee;
    border-top-color: #ff6b35;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.load-more .hidden {
    display: none;
}

/* ============================================================
   10. 响应式
   ============================================================ */
@media (max-width: 420px) {
    .top-bar {
        padding: 8px 12px 10px;
    }

    .top-actions .action-btn {
        min-width: 36px;
        height: 34px;
    }

    .top-actions .action-btn i {
        font-size: 16px;
    }

    .search-btn {
        font-size: 12px;
        padding: 2px 10px;
        height: 26px;
        line-height: 26px;
    }

    .nav-grid .nav-item .icon {
        width: 42px;
        height: 42px;
        font-size: 18px;
    }

    .product-item .info .price-row .price {
        font-size: 16px;
    }

    .drawer-overlay .drawer-panel {
        width: 88%;
        padding: 20px 16px 28px;
    }

    .banner-slider .slide .slide-label {
        font-size: 14px;
        padding: 4px 14px;
    }

    .banner-slider .slide {
        font-size: 18px;
    }
}

@media (min-width: 600px) {
    .product-grid {
        gap: 14px;
        padding: 0 20px 100px;
    }

    .banner-wrap {
        margin: 16px 20px 12px;
    }

    .nav-grid {
        margin: 0 20px 14px;
        padding: 18px 8px 16px;
    }

    .top-bar {
        padding: 14px 20px 14px;
    }

    .search-wrapper {
        height: 42px;
    }
}

/* ============================================================
   11. 工具类
   ============================================================ */
.text-center {
    text-align: center;
}

.text-muted {
    color: #999;
}

.text-primary {
    color: #ff6b35;
}

.text-success {
    color: #27ae60;
}

.text-danger {
    color: #e74c3c;
}

.hidden {
    display: none !important;
}

.flex {
    display: flex;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.w-full {
    width: 100%;
}

.h-full {
    height: 100%;
}

.gap-10 {
    gap: 10px;
}

.gap-20 {
    gap: 20px;
}

.mt-10 {
    margin-top: 10px;
}

.mt-20 {
    margin-top: 20px;
}

.mb-10 {
    margin-bottom: 10px;
}

.mb-20 {
    margin-bottom: 20px;
}

.p-10 {
    padding: 10px;
}

.p-20 {
    padding: 20px;
}

.rounded {
    border-radius: 8px;
}

.rounded-full {
    border-radius: 9999px;
}

.shadow {
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.shadow-lg {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.10);
}

/* ============================================================
   12. 滚动条美化
   ============================================================ */
::-webkit-scrollbar {
    width: 3px;
    height: 3px;
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

/* ============================================================
   13. 加载占位（骨架屏）
   ============================================================ */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 8px;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}