/* 银豹商品展示 - 小程序风格样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: #f5f6f8;
    color: #333;
}

.app {
    max-width: 640px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 顶部 */
.header {
    background: linear-gradient(135deg, #07c160, #06ad56);
    color: #fff;
    padding: 14px 16px 12px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.header-top {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 10px;
    position: relative;
}

.header-top h1 {
    font-size: 20px;
    font-weight: 600;
}

.btn-refresh {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.5);
    color: #fff;
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-refresh:disabled {
    opacity: 0.6;
}

.refresh-icon.spinning {
    display: inline-block;
    animation: spin 1s linear infinite;
}

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

.search-bar {
    display: flex;
    gap: 8px;
}

.search-bar input {
    flex: 1;
    border: none;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    background: #fff;
}

.btn-search {
    background: #fff;
    border: none;
    border-radius: 20px;
    padding: 0 18px;
    font-size: 14px;
    color: #06ad56;
    font-weight: 600;
    cursor: pointer;
}

/* 分类栏 */
.category-bar {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    background: #fff;
    padding: 8px 10px;
    gap: 8px;
    position: sticky;
    top: 92px;
    z-index: 99;
    border-bottom: 1px solid #eee;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.category-bar::-webkit-scrollbar {
    display: none;
}

.category-item {
    flex-shrink: 0;
    padding: 6px 14px;
    border-radius: 16px;
    font-size: 13px;
    background: #f2f3f5;
    color: #555;
    cursor: pointer;
    white-space: nowrap;
}

.category-item.active {
    background: #07c160;
    color: #fff;
    font-weight: 600;
}

/* 商品网格 */
.product-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 12px;
}

.product-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    cursor: pointer;
    transition: transform 0.1s;
}

.product-card:active {
    transform: scale(0.98);
}

.product-img {
    width: 100%;
    height: 130px;
    object-fit: contain;
    background: #fafafa;
    display: block;
}

.product-noimg {
    width: 100%;
    height: 130px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fafafa;
    color: #bbb;
    font-size: 12px;
}

.product-body {
    padding: 8px 10px 10px;
}

.product-name {
    font-size: 13px;
    line-height: 1.4;
    color: #333;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 36px;
    margin-bottom: 6px;
}

.product-barcode {
    font-size: 11px;
    color: #999;
    margin-bottom: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

.product-price {
    color: #fa5151;
    font-size: 16px;
    font-weight: 700;
}

.product-price small {
    font-size: 11px;
    font-weight: 400;
}

.stock-badge {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
}

.stock-ok {
    background: #e8f7ee;
    color: #07c160;
}

.stock-low {
    background: #ffece8;
    color: #fa5151;
}

/* 加载/空状态 */
.loading, .empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 0;
    color: #999;
    font-size: 14px;
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
}

.pagination button {
    border: none;
    background: #07c160;
    color: #fff;
    border-radius: 16px;
    padding: 6px 18px;
    font-size: 13px;
    cursor: pointer;
}

.pagination button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.page-info {
    font-size: 13px;
    color: #666;
}

/* 底部 */
.footer {
    padding: 10px 16px 24px;
    text-align: center;
    color: #999;
    font-size: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: #f5f6f8;
}

/* 备案号 */
.footer-icp {
    color: #999;
    font-size: 12px;
    text-decoration: none;
    line-height: 1.4;
}

.footer-icp:hover {
    color: #666;
    text-decoration: underline;
}

/* 提示 toast */
.toast {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 13px;
    z-index: 999;
    max-width: 80%;
    text-align: center;
    animation: fadein 0.2s;
}

@keyframes fadein {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* 详情页 */
.detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.detail-header h1 {
    font-size: 17px;
}

.back-link {
    color: #fff;
    text-decoration: none;
    font-size: 14px;
}

.detail-main {
    background: #fff;
    margin: 12px;
    border-radius: 12px;
    padding: 16px;
}

.detail-image {
    display: flex;
    justify-content: center;
    margin-bottom: 12px;
}

.detail-image img {
    max-width: 100%;
    max-height: 280px;
    object-fit: contain;
}

.no-image {
    width: 200px;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fafafa;
    color: #bbb;
    border-radius: 8px;
}

.detail-name {
    font-size: 18px;
    font-weight: 600;
    line-height: 1.5;
    margin-bottom: 12px;
}

.detail-price {
    background: #fff7f7;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 14px;
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.price-label {
    font-size: 13px;
    color: #999;
}

.price-value {
    color: #fa5151;
    font-size: 24px;
    font-weight: 700;
}

.detail-info {
    list-style: none;
    border-top: 1px solid #f0f0f0;
}

.detail-info li {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #f5f5f5;
    font-size: 14px;
}

.info-label {
    color: #999;
}

.info-value {
    color: #333;
    text-align: right;
    word-break: break-all;
}
