/* ===== 周期购鲜奶 - 客户下单小程序样式 ===== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: #f5f5f5;
    color: #333;
    -webkit-font-smoothing: antialiased;
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
}

.app-container {
    min-height: 100vh;
    padding-bottom: 80px;
    background: #f5f5f5;
}

/* ===== Header ===== */
.header {
    background: linear-gradient(135deg, #4CAF50 0%, #66BB6A 100%);
    color: #fff;
    padding: 30px 20px 25px;
    text-align: center;
}

.logo {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 1px;
}

.subtitle {
    font-size: 13px;
    opacity: 0.9;
    margin-top: 6px;
}

/* Success header */
.success-header {
    background: linear-gradient(135deg, #43A047 0%, #66BB6A 100%);
    padding: 40px 20px 30px;
}

.success-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.success-title {
    font-size: 24px;
    font-weight: 700;
}

.success-subtitle {
    font-size: 14px;
    opacity: 0.9;
    margin-top: 8px;
}

/* ===== Main ===== */
.main {
    padding: 15px;
}

/* ===== Sections ===== */
.section {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.section-title {
    font-size: 16px;
    font-weight: 700;
    color: #333;
    margin-bottom: 14px;
    padding-left: 8px;
    border-left: 3px solid #4CAF50;
}

/* ===== Product Cards ===== */

.product-card:hover {
    border-color: #A5D6A7;
}

.product-card.selected {
    border-color: #4CAF50;
    background: #f1f8e9;
}

.product-card .check-mark {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: transparent;
    flex-shrink: 0;
    transition: all 0.2s;
}

.product-card.selected .check-mark {
    background: #4CAF50;
    border-color: #4CAF50;
    color: #fff;
}

.product-info {
    flex: 1;
    margin-left: 10px;
}

.product-name {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    line-height: 1.4;
}

.product-spec {
    font-size: 12px;
    color: #999;
    margin-top: 2px;
}

.product-price {
    font-size: 18px;
    font-weight: 700;
    color: #E53935;
    white-space: nowrap;
}

.product-price .unit {
    font-size: 12px;
    font-weight: 400;
    color: #999;
}

/* ===== Form ===== */
.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    font-size: 14px;
    color: #666;
    margin-bottom: 4px;
    font-weight: 500;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    color: #333;
    background: #fafafa;
    transition: border-color 0.2s;
    -webkit-appearance: none;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #4CAF50;
    background: #fff;
}

.form-row {
    display: flex;
    gap: 10px;
}

.form-group.half {
    flex: 1;
    margin-bottom: 12px;
}

/* ===== Calc Result ===== */
.calc-result {
    background: #f1f8e9;
    border-radius: 8px;
    padding: 12px 14px;
    margin-top: 8px;
}

.calc-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
}

.calc-row span {
    font-size: 14px;
    color: #666;
}

.calc-row strong {
    font-size: 16px;
    color: #2E7D32;
}

/* ===== Submit Button ===== */
.submit-btn {
    display: block;
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #4CAF50, #66BB6A);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 8px;
    letter-spacing: 2px;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
    transition: all 0.2s;
}

.submit-btn:active {
    transform: scale(0.98);
    box-shadow: 0 2px 6px rgba(76, 175, 80, 0.2);
}

.form-tip {
    text-align: center;
    font-size: 12px;
    color: #999;
    margin-top: 10px;
}

/* ===== Bottom Nav ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    display: flex;
    background: #fff;
    border-top: 1px solid #eee;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.05);
    z-index: 100;
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 0 12px;
    text-decoration: none;
    color: #999;
    font-size: 11px;
    transition: color 0.2s;
}

.nav-item.active {
    color: #4CAF50;
}

.nav-icon {
    font-size: 20px;
    margin-bottom: 2px;
}

/* ===== Order No Card ===== */
.order-no-card {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.order-no-label {
    font-size: 14px;
    color: #999;
    margin-bottom: 8px;
}

.order-no-value {
    font-size: 28px;
    font-weight: 800;
    color: #E53935;
    letter-spacing: 2px;
    word-break: break-all;
    font-family: "Courier New", monospace;
}

.order-no-tip {
    font-size: 13px;
    color: #FF9800;
    margin-top: 12px;
}

/* ===== Detail List ===== */
.detail-list {
    display: flex;
    flex-direction: column;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f5f5f5;
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    font-size: 14px;
    color: #999;
}

.detail-value {
    font-size: 14px;
    color: #333;
    font-weight: 500;
}

.detail-value.price {
    font-size: 20px;
    font-weight: 700;
    color: #E53935;
}

.total-row {
    background: #FFF8E1;
    margin: 0 -16px;
    padding: 12px 16px;
    border-radius: 0 0 12px 12px;
}

/* ===== Action Buttons ===== */
.action-buttons {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.btn-primary, .btn-secondary {
    flex: 1;
    display: block;
    text-align: center;
    padding: 12px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
}

.btn-primary {
    background: #4CAF50;
    color: #fff;
}

.btn-secondary {
    background: #fff;
    color: #4CAF50;
    border: 1px solid #4CAF50;
}

/* ===== Search ===== */
.search-form {
    margin-bottom: 15px;
}

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

.search-box input {
    flex: 1;
    padding: 11px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    font-size: 15px;
    background: #fff;
}

.search-box input:focus {
    outline: none;
    border-color: #4CAF50;
}

.search-box button {
    padding: 11px 20px;
    background: #4CAF50;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

/* ===== Order Cards (lookup) ===== */
.order-card {
    background: #fff;
    border-radius: 10px;
    margin-bottom: 10px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.order-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: #f9f9f9;
    border-bottom: 1px solid #eee;
}

.order-no {
    font-size: 13px;
    font-weight: 600;
    color: #666;
    font-family: "Courier New", monospace;
}

.order-date {
    font-size: 12px;
    color: #999;
}

.order-card-body {
    padding: 10px 14px;
}

.oc-row {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    font-size: 13px;
}

.oc-row span:first-child {
    color: #999;
}

.oc-row span:last-child {
    color: #333;
    font-weight: 500;
    text-align: right;
}

.oc-row .price {
    font-size: 16px;
    font-weight: 700;
    color: #E53935;
}

.oc-row.total-row {
    background: none;
    margin: 0;
    padding: 8px 0 0;
    margin-top: 4px;
    border-top: 1px dashed #eee;
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

/* ===== Flash Messages ===== */
.flash-msg {
    padding: 10px 14px;
    margin-bottom: 10px;
    border-radius: 8px;
    font-size: 14px;
    text-align: center;
}

.flash-error {
    background: #FFEBEE;
    color: #C62828;
}

/* ===== Payment Buttons ===== */
.pay-btn-inline {
    display: block;
    text-align: center;
    padding: 14px 16px;
    background: linear-gradient(135deg, #E8F5E9, #C8E6C9);
    border: 2px solid #4CAF50;
    border-radius: 12px;
    text-decoration: none;
    font-size: 15px;
    font-weight: 700;
    color: #2E7D32;
    transition: all 0.2s;
}

.pay-btn-inline:hover {
    background: linear-gradient(135deg, #C8E6C9, #A5D6A7);
}

.pay-btn-inline:active {
    transform: scale(0.98);
}

/* Old pay-link-card (for reference) */
.payment-section {
    display: flex;
    align-items: center;
    gap: 16px;
}

.payment-qr-wrapper {
    flex-shrink: 0;
    width: 120px;
    height: 120px;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid #4CAF50;
    background: #f9f9f9;
}

.payment-qr {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.qr-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #ccc;
}

.qr-placeholder span {
    font-size: 36px;
}

.qr-placeholder p {
    font-size: 11px;
    margin-top: 4px;
}

.payment-info {
    flex: 1;
}

.payment-title {
    font-size: 15px;
    font-weight: 700;
    color: #333;
    margin-bottom: 4px;
}

.payment-desc {
    font-size: 12px;
    color: #999;
    margin-bottom: 6px;
}

.payment-desc.order-no-ref {
    color: #E53935;
    font-weight: 700;
    font-family: "Courier New", monospace;
    font-size: 14px;
    background: #FFF3E0;
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
}

.payment-amount {
    font-size: 14px;
    color: #E53935;
}

.payment-amount strong {
    font-size: 20px;
}

.payment-amount.large {
    font-size: 28px;
    font-weight: 800;
    color: #E53935;
    margin-top: 4px;
}

.payment-reminder {
    border: 2px dashed #4CAF50;
}

.payment-reminder .section-title {
    color: #2E7D32;
    border-left-color: #FF9800;
}

/* ===== Responsive ===== */
@media (max-width: 360px) {
    .product-name {
        font-size: 14px;
    }
    .product-price {
        font-size: 16px;
    }
    .order-no-value {
        font-size: 22px;
    }
}

/* ===== Product thumbnails & detail link ===== */
.product-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.product-card-wrapper {
    position: relative;
}
.product-card {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border: 2px solid #eee;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    gap: 10px;
}
.product-thumb {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    background: #f5f5f5;
}
.placeholder-thumb {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    background: #f0f0f0;
    color: #ccc;
}
.product-detail-link {
    display: block;
    text-align: right;
    font-size: 11px;
    color: #4CAF50;
    text-decoration: none;
    padding: 2px 4px 4px;
}

/* ===== Purchase Mode Toggle ===== */
.mode-toggle {
    display: flex;
    gap: 8px;
    background: #f0f0f0;
    border-radius: 12px;
    padding: 4px;
}
.mode-btn {
    flex: 1;
    padding: 10px 8px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    background: transparent;
    color: #666;
    transition: all 0.2s;
}
.mode-btn.active {
    background: #fff;
    color: #333;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
.mode-btn:nth-child(1).active { color: #1565C0; }
.mode-btn:nth-child(2).active { color: #E65100; }
.mode-desc {
    text-align: center;
    font-size: 12px;
    color: #999;
    margin-top: 8px;
}

/* ===== SKU Cards ===== */
.sku-list {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.sku-card {
    flex: 1;
    min-width: 90px;
    padding: 12px 10px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}
.sku-card:hover { border-color: #FF9800; }
.sku-card.selected {
    border-color: #FF6F00;
    background: #FFF3E0;
    box-shadow: 0 2px 8px rgba(255,111,0,0.2);
}
.sku-qty {
    font-size: 18px;
    font-weight: 800;
    color: #333;
}
.sku-price {
    font-size: 16px;
    font-weight: 700;
    color: #E53935;
    margin-top: 2px;
}
.sku-discount {
    display: inline-block;
    padding: 1px 6px;
    background: #FF6F00;
    color: #fff;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 700;
    margin-top: 4px;
}
.sku-empty {
    text-align: center;
    padding: 20px;
    color: #999;
    flex: 1 1 100%;
}
.sku-empty small {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    color: #bbb;
}


/* ===== 手机端自适应增强 (Phase 2) ===== */
html{scroll-behavior:smooth;-webkit-overflow-scrolling:touch}
a,button,input,select,textarea{touch-action:manipulation}
button,input[type=submit]{min-height:44px}

/* 安全区域 */
@supports(padding-bottom:env(safe-area-inset-bottom)){
  .app-container{padding-bottom:calc(80px + env(safe-area-inset-bottom,0))}
  .bottom-nav{padding-bottom:env(safe-area-inset-bottom,0)}
}

/* 图片自适应 */
img{max-width:100%;height:auto}
.goods-card .img{aspect-ratio:auto;object-fit:contain}

/* ===== 订单页增强 ===== */
.lookup-page{padding-bottom:calc(70px + env(safe-area-inset-bottom,0))}
.search-box{display:flex;gap:8px;padding:16px}
.search-box input{flex:1;min-height:44px;padding:12px 16px;font-size:16px;border:1px solid #ddd;border-radius:8px;outline:none;background:#fff}
.search-box input:focus{border-color:#4CAF50;box-shadow:0 0 0 3px rgba(76,175,80,.15)}
.search-box button{min-height:44px;padding:12px 20px;background:#4CAF50;color:#fff;border:none;border-radius:8px;font-size:16px;font-weight:600;cursor:pointer;white-space:nowrap}
.order-card{border-radius:12px;overflow:hidden;margin:0 12px 12px}
.order-card-header{padding:12px 14px;background:#f9fafb;display:flex;justify-content:space-between;align-items:center;font-size:13px}
.order-card-body{padding:4px 14px}
.oc-row{display:flex;justify-content:space-between;padding:8px 0;font-size:13px;border-bottom:1px solid #f5f5f5}
.oc-row span:last-child{color:#555;text-align:right;max-width:60%}
.empty-state{text-align:center;padding:60px 20px;color:#999}
.empty-icon{font-size:48px;margin-bottom:12px}

/* ===== 个人中心 ===== */
.profile-header{padding:32px 20px;background:linear-gradient(135deg,#4CAF50,#66BB6A);color:#fff;text-align:center}
.profile-avatar{width:64px;height:64px;border-radius:50%;background:rgba(255,255,255,.3);margin:0 auto 10px;display:flex;align-items:center;justify-content:center;font-size:32px}
.profile-name{font-size:18px;font-weight:700;margin-bottom:4px}
.menu-list{background:#fff;border-radius:12px;margin:12px 16px;overflow:hidden;box-shadow:0 1px 4px rgba(0,0,0,.04)}
.menu-item{display:flex;align-items:center;padding:14px 16px;gap:12px;border-bottom:1px solid #f5f5f5;text-decoration:none;color:#333;font-size:15px}
.menu-item:last-child{border-bottom:none}
.menu-item:active{background:#f5f5f5}
.menu-icon{font-size:20px;width:24px;text-align:center}
.menu-arrow{margin-left:auto;color:#ccc;font-size:16px}

/* ===== 会员中心 ===== */
.member-card{padding:24px 20px;background:linear-gradient(135deg,#4CAF50,#81C784);color:#fff;border-radius:12px;margin:12px;text-align:center}
.member-level{font-size:14px;opacity:.8;margin-bottom:4px}
.member-points{font-size:36px;font-weight:800;margin:4px 0}
.member-desc{font-size:12px;opacity:.7}
.benefit-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px;padding:0 12px}
.benefit-card{padding:16px;background:#fff;border-radius:12px;text-align:center;box-shadow:0 1px 4px rgba(0,0,0,.04)}
.benefit-icon{font-size:28px;margin-bottom:6px}
.benefit-title{font-size:13px;font-weight:600;color:#333}
.benefit-desc{font-size:11px;color:#999;margin-top:2px}
