/* 首页样式 - 按规范1:1像素级还原 */

/* ========== 2.1 顶部标题固定栏 ========== */
.top-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 68px;
    background-color: #1677FF;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: none;
    box-shadow: none;
}

.header-login-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    padding: 4px 14px;
    background: rgba(255,255,255,0.25);
    color: #FFFFFF;
    border-radius: 14px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid rgba(255,255,255,0.4);
    white-space: nowrap;
}

.header-login-btn:active {
    background: rgba(255,255,255,0.4);
}

.header-main-title {
    font-size: 18px;
    font-weight: 700;
    color: #FFFFFF;
    line-height: 34px;
    text-align: center;
}

.header-sub-title {
    font-size: 14px;
    font-weight: 400;
}

/* ========== 小程序跳转横幅 ========== */
.miniapp-banner {
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #FFF5F0 0%, #FFF0E6 100%);
    border: 1px solid #FFD4C2;
    border-radius: 12px;
    margin: 12px 16px;
    padding: 12px 16px;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.1);
}

.miniapp-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #FF6B35 0%, #F7931E 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin-right: 12px;
}

.miniapp-info {
    flex: 1;
}

.miniapp-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.miniapp-desc {
    font-size: 13px;
    color: #999;
}

.miniapp-arrow {
    width: 32px;
    height: 32px;
    background: #FF6B35;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    color: #FFFFFF;
    line-height: 24px;
    text-align: center;
}

/* ========== 2.2 区域限制提示条 ========== */
.area-notice {
    margin-top: 68px;
    background-color: #FFF7E6;
    color: #FF7D00;
    font-size: 13px;
    height: 32px;
    line-height: 32px;
    text-align: center;
}

/* ========== 2.3 优惠券Banner条 ========== */
.coupon-banner {
    background: linear-gradient(180deg, #FF4D4F, #FF7875);
    color: #FFFFFF;
    font-size: 14px;
    height: 36px;
    line-height: 36px;
    text-align: center;
}

/* ========== 2.4 价格展示卡片 ========== */
.price-card {
    margin: 15px;
    background: #FFFFFF;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    border: none;
}

.price-left {
    float: left;
    width: 60%;
}

.price-right {
    float: right;
    width: 40%;
    text-align: right;
}

.price-current {
    font-size: 28px;
    font-weight: 700;
    color: #333333;
}

.price-unit {
    font-size: 16px;
    font-weight: 400;
}

.price-original {
    font-size: 14px;
    color: #999999;
    text-decoration: line-through;
    margin-top: 2px;
}

.price-save {
    font-size: 13px;
    color: #999999;
    margin-top: 4px;
}

.stock-limit {
    font-size: 14px;
    font-weight: 700;
    color: #FF4D4F;
}

.stock-limit-sub {
    font-size: 13px;
    color: #666666;
    margin-top: 4px;
}

/* ========== 2.5 库存进度条模块 ========== */
.progress-section {
    margin: 10px 15px;
}

.progress-title {
    font-size: 14px;
    color: #333333;
    margin-bottom: 8px;
}

.progress-bar {
    height: 8px;
    background-color: #F0F2F5;
    border-radius: 4px;
    overflow: hidden;
    margin: 8px 0;
}

.progress-fill {
    height: 100%;
    background-color: #FF4D4F;
    border-radius: 4px;
    transition: width 0.5s ease;
    width: 0%;
}

.progress-info {
    font-size: 13px;
    color: #666666;
    margin-bottom: 10px;
}

.progress-info strong {
    color: #FF4D4F;
}

/* ========== 2.6 随机滚动下单播报条 ========== */
.roll-notice {
    background-color: #111111;
    color: #FFFFFF;
    height: 36px;
    line-height: 36px;
    overflow: hidden;
    position: relative;
    white-space: nowrap;
}

.roll-content {
    display: inline-block;
    animation: rollScroll 20s linear infinite;
    font-size: 13px;
    padding-left: 100%;
}

@keyframes rollScroll {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-100%);
    }
}

/* ========== 2.7 采购数量选择模块 ========== */
.quantity-section {
    margin: 12px 15px;
}

.quantity-title {
    font-size: 15px;
    color: #333333;
    margin-bottom: 12px;
}

.quantity-buttons {
    display: flex;
    gap: 10px;
}

.qty-btn {
    flex: 1;
    height: 40px;
    line-height: 40px;
    text-align: center;
    font-size: 14px;
    color: #333333;
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    -webkit-user-select: none;
}

.qty-btn.active {
    background-color: #1677FF;
    color: #FFFFFF;
    font-weight: 700;
    border: 1px solid #1677FF;
}

.qty-btn:active {
    opacity: 0.8;
}

/* ========== 2.8 价格计算面板 ========== */
.calc-panel {
    margin: 12px 15px;
    background: #FFFFFF;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.calc-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 36px;
    line-height: 36px;
    border-bottom: 1px solid #F0F2F5;
}

.calc-row:last-child {
    border-bottom: none;
}

.calc-label {
    font-size: 14px;
    color: #333333;
}

.calc-value {
    font-size: 14px;
    color: #333333;
}

.calc-final .calc-label {
    font-size: 16px;
    font-weight: 700;
}

.calc-pay {
    font-size: 16px;
    font-weight: 700;
    color: #FF4D4F;
}

/* ========== 2.9 优惠券卡片模块 ========== */
.coupon-section {
    margin: 0 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.coupon-card {
    background: #FFFFFF;
    border-radius: 8px;
    padding: 14px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
    border: 1px solid #F0F2F5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.coupon-card.expired {
    opacity: 0.5;
    filter: grayscale(0.8);
}

.coupon-card.used::after {
    content: '已使用';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-15deg);
    font-size: 20px;
    font-weight: 700;
    color: #999;
    background: rgba(255,255,255,0.7);
    padding: 4px 16px;
    border: 2px solid #ccc;
    border-radius: 4px;
    opacity: 0.6;
}

.coupon-card.not-available {
    opacity: 0.5;
    filter: grayscale(0.5);
}

.coupon-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.coupon-name {
    font-size: 16px;
    font-weight: 700;
    color: #333333;
}

.coupon-expire-label {
    font-size: 13px;
    color: #999999;
}

.coupon-right {
    text-align: right;
}

.coupon-amount {
    font-size: 18px;
    font-weight: 700;
    color: #FF7D00;
}

.coupon-countdown {
    font-size: 14px;
    color: #FF4D4F;
    margin-top: 4px;
}

.coupon-card.expired .coupon-countdown {
    color: #999999;
}

/* ========== 2.10 辅助说明模块 ========== */
.help-section {
    margin: 15px;
}

.help-section p {
    font-size: 13px;
    color: #666666;
    line-height: 20px;
    margin-bottom: 4px;
}

.help-section p:last-child {
    margin-bottom: 0;
}

/* ========== 底部占位 ========== */
.bottom-placeholder {
    height: 70px;
}

/* ========== 2.11 底部固定下单按钮 ========== */
.fixed-bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50px;
    z-index: 999;
    background: #FFFFFF;
    border-top: 1px solid #F0F2F5;
    display: flex;
    align-items: center;
}

.bottom-user-btn {
    width: 70px;
    height: 50px;
    line-height: 50px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: #666666;
    text-decoration: none;
    background: #F5F7FA;
    border-right: 1px solid #F0F2F5;
    flex-shrink: 0;
}

.bottom-user-btn:active {
    background: #E8EAED;
}

.order-btn {
    flex: 1;
    height: 50px;
    border: none;
    border-radius: 0;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    -webkit-user-select: none;
    user-select: none;
}

.order-btn.disabled {
    background-color: #CCCCCC;
    color: #FFFFFF;
    cursor: not-allowed;
}

.order-btn.enabled {
    background-color: #FF4D4F;
    color: #FFFFFF;
    cursor: pointer;
}

.order-btn.enabled:active {
    background-color: #E64340;
}

/* ========== 加载遮罩 ========== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.3);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top: 3px solid #FFFFFF;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ========== 响应式适配 ========== */
@media (min-width: 750px) {
    #app {
        max-width: 750px;
        margin: 0 auto;
    }
    .top-header {
        max-width: 750px;
        left: 50%;
        transform: translateX(-50%);
    }
    .fixed-bottom-bar {
        max-width: 750px;
        left: 50%;
        transform: translateX(-50%);
    }
}

@media (max-width: 360px) {
    .qty-btn {
        font-size: 12px;
        height: 36px;
        line-height: 36px;
    }
    .quantity-buttons {
        gap: 6px;
    }
}

/* 禁止横屏 */
@media (orientation: landscape) and (max-height: 500px) {
    #app {
        display: none;
    }
    body::after {
        content: '请使用竖屏浏览';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: #f5f5f5;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 18px;
        color: #999;
        z-index: 99999;
    }
}
