/* AutoShop - 轻量级自动发货平台 */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f5f7;
    color: #1d1d1f;
    min-height: 100vh;
    line-height: 1.6;
}

a { color: #0071e3; text-decoration: none; }
a:hover { color: #005bb5; }

.container { max-width: 800px; margin: 0 auto; padding: 0 16px; }

/* Header */
header { padding: 28px 0 8px; text-align: center; }
header h1 { font-size: 28px; color: #1d1d1f; font-weight: 700; letter-spacing: -0.5px; }
.notice { background: #fff; border-radius: 10px; padding: 10px 16px; margin-top: 12px; font-size: 13px; color: #86868b; box-shadow: 0 1px 3px rgba(0,0,0,0.04); }

/* Category tabs */
.category-tabs { display: flex; gap: 6px; padding: 16px 0 12px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.category-tabs::-webkit-scrollbar { display: none; }
.category-tabs a {
    padding: 7px 16px; background: #fff; color: #86868b; font-size: 13px; font-weight: 500;
    border-radius: 20px; white-space: nowrap; border: 1px solid #e5e5ea; transition: all 0.2s;
}
.category-tabs a:hover { background: #f5f5f7; color: #1d1d1f; text-decoration: none; }
.category-tabs a.active { background: #1d1d1f; color: #fff; border-color: #1d1d1f; }

/* Nav */
.back-nav { display: flex; justify-content: space-between; padding: 12px 0; font-size: 14px; }
.back-nav a { color: #86868b; }
.back-nav a:hover { color: #0071e3; text-decoration: none; }

/* Product Card */
.product-card {
    background: #fff; border-radius: 14px; overflow: hidden; cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    text-decoration: none; color: inherit;
    display: block;
}
.product-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.08); }
.product-card:active { transform: scale(0.97); box-shadow: 0 2px 8px rgba(0,0,0,0.06); transition-duration: 0.06s; }
.product-card:hover * { text-decoration: none; }
.product-card:hover h3 { color: #0071e3; }

/* Detail Overlay - 全屏弹窗 */
.detail-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    z-index: 1000; display: flex; align-items: flex-end; justify-content: center;
    animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.detail-panel {
    background: #fff; border-radius: 16px 16px 0 0;
    width: 100%; max-width: 520px; height: 90vh;
    overflow-y: auto; animation: slideUp 0.25s ease;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.detail-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 20px; position: sticky; top: 0; background: #fff;
    border-bottom: 1px solid #f0f0f0; z-index: 10;
}
.back-btn { background: none; border: none; color: #0071e3; font-size: 16px; cursor: pointer; }
.back-btn:hover { color: #0077ed; }
.detail-actions a { color: #86868b; font-size: 13px; }

.detail-body { padding: 0 0 80px; }

.detail-cover { width: 100%; }
.detail-cover img { width: 100%; height: auto; display: block; }
.detail-info-box { padding: 16px 20px; }

/* Skeleton Loading */
.skeleton { padding: 16px; }
.skeleton-cover { width: 100%; height: 200px; background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: 8px; }
.skeleton-block { height: 16px; background: #f0f0f0; border-radius: 4px; margin: 8px 20px; }
.skeleton-block.w80 { width: 80%; }
.skeleton-block.w60 { width: 60%; }
.skeleton-block.w40 { width: 40%; }
.skeleton-block.w90 { width: 90%; }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }

/* Products Grid */
.products { display: grid; gap: 12px; padding-bottom: 24px; }

/* Category tabs - 加速过渡 */
.category-tabs a { transition: background 0.15s, color 0.15s, border-color 0.15s; }

/* Responsive */
@media (min-width: 768px) {
    .detail-overlay { align-items: center; }
    .detail-panel { height: 85vh; border-radius: 16px; margin: 20px; }
}

.product-cover { width: 100%; height: 180px; overflow: hidden; background: #f5f5f7; }
.product-cover img { width: 100%; height: 100%; object-fit: cover; }
.no-cover { height: 100%; display: flex; align-items: center; justify-content: center; font-size: 40px; color: #c7c7cc; }

.product-info { padding: 14px 16px; }
.product-tags { display: flex; gap: 6px; margin-bottom: 6px; }
.tag-cat { font-size: 11px; color: #86868b; background: #f5f5f7; padding: 2px 8px; border-radius: 4px; }
.tag-type { font-size: 11px; color: #fff; padding: 2px 8px; border-radius: 4px; }
.tag-normal { background: #34c759; }
.tag-card { background: #ff9500; }
.product-info h3 { font-size: 15px; color: #1d1d1f; font-weight: 600; margin-bottom: 4px; line-height: 1.4; }
.summary { font-size: 13px; color: #86868b; margin-bottom: 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.price-row { display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.price { color: #ff3b30; font-size: 22px; font-weight: 700; }
.original { color: #c7c7cc; font-size: 13px; text-decoration: line-through; }

.meta { display: flex; gap: 12px; font-size: 12px; color: #aeaeb2; }

/* Section */
.section { background: #fff; border-radius: 14px; padding: 16px; margin: 12px 0; box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
.section h2 { color: #1d1d1f; font-size: 17px; font-weight: 600; margin-bottom: 10px; }
.section p { color: #48484a; font-size: 14px; }
.content { color: #1d1d1f; font-size: 14px; line-height: 1.8; }
.content img { max-width: 100%; border-radius: 8px; }

/* Detail Page */
.product-cover-detail { margin-bottom: 12px; }
.product-cover-detail img { width: 100%; border-radius: 14px; }
.product-detail-info { background: #fff; border-radius: 14px; padding: 16px; margin-bottom: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
.product-detail-info h1 { color: #1d1d1f; font-size: 20px; font-weight: 700; margin-bottom: 10px; }

/* Buy Section */
.buy-section {
    background: #fff; border-radius: 14px; padding: 16px; margin: 12px 0;
    position: sticky; bottom: 0; z-index: 10; box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
}
.quantity-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; font-size: 14px; color: #48484a; }
.quantity-box { display: flex; align-items: center; border: 1px solid #e5e5ea; border-radius: 8px; overflow: hidden; }
.quantity-box button { width: 36px; height: 36px; background: #f5f5f7; color: #1d1d1f; border: none; cursor: pointer; font-size: 16px; }
.quantity-box button:first-child { border-right: 1px solid #e5e5ea; }
.quantity-box button:last-child { border-left: 1px solid #e5e5ea; }
.quantity-box input { width: 50px; height: 36px; text-align: center; background: #fff; color: #1d1d1f; border: none; font-size: 14px; }
.total { color: #86868b; }
.total b { color: #ff3b30; font-size: 22px; }

.buy-btn {
    width: 100%; padding: 14px; background: #0071e3; color: #fff;
    border: none; border-radius: 10px; font-size: 16px; font-weight: 600; cursor: pointer;
    transition: background 0.2s;
}
.buy-btn:hover { background: #0077ed; }
.buy-btn:disabled { background: #c7c7cc; }

.out-stock { background: #fff3f0; border: 1px solid #ff3b30; color: #ff3b30; text-align: center; padding: 16px; border-radius: 10px; }

/* Pay Check Banner */
.pay-check-banner {
    background: #fff; border: 1px solid #ff9500; border-radius: 10px; padding: 12px 16px;
    margin: 12px 0; display: flex; align-items: center; gap: 10px; font-size: 13px; color: #ff9500;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.pay-check-banner button { padding: 4px 12px; border-radius: 6px; border: none; cursor: pointer; font-size: 12px; font-weight: 500; }
.pay-check-banner button:first-of-type { background: #ff9500; color: #fff; }
.close-btn { background: #f5f5f7 !important; color: #86868b !important; font-size: 14px !important; }

/* Modal */
.modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.4); display: flex; align-items: flex-end; justify-content: center; z-index: 999; }
.modal-content { background: #fff; border-radius: 16px 16px 0 0; width: 100%; max-width: 480px; max-height: 85vh; overflow-y: auto; }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px; border-bottom: 1px solid #f0f0f0; }
.modal-header h3 { color: #1d1d1f; margin: 0; font-size: 17px; font-weight: 600; }
.close { color: #c7c7cc; font-size: 22px; cursor: pointer; line-height: 1; }
.close:hover { color: #86868b; }
.modal-body { padding: 20px; }
.modal-footer { padding: 16px 20px; display: flex; justify-content: flex-end; gap: 10px; border-top: 1px solid #f0f0f0; }

/* Form */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; color: #86868b; font-size: 13px; font-weight: 500; margin-bottom: 4px; }
.form-group input, .form-group textarea, .form-group select {
    width: 100%; padding: 10px 12px; border: 1px solid #e5e5ea; background: #fff; color: #1d1d1f;
    border-radius: 8px; font-size: 15px; outline: none; transition: border-color 0.2s;
}
.form-group input:focus, .form-group textarea:focus { border-color: #0071e3; }
.req { color: #ff3b30; }
.email-hint { color: #34c759; font-size: 11px; margin-top: 4px; display: block; }

/* Order Preview */
.order-preview { background: #f5f5f7; border-radius: 10px; padding: 12px; margin-bottom: 16px; }
.order-preview .price { color: #86868b; font-size: 13px; }
.order-preview b { color: #ff3b30; font-size: 18px; }

/* Buttons */
.btn-cancel { padding: 10px 20px; border: none; background: #f5f5f7; color: #1d1d1f; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 500; }
.btn-buy { padding: 10px 24px; background: #0071e3; color: #fff; border: none; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 500; }
.btn-buy:disabled { opacity: 0.5; }
.btn-pay { padding: 10px 24px; background: #0071e3; color: #fff; border: none; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 500; }
.btn-pay:disabled { opacity: 0.5; }
.btn-check { padding: 12px; background: #0071e3; color: #fff; border: none; border-radius: 10px; cursor: pointer; font-size: 15px; font-weight: 500; width: 100%; margin-bottom: 10px; }
.btn-copy { padding: 10px 20px; background: #0071e3; color: #fff; border: none; border-radius: 8px; cursor: pointer; }
.btn-ok { padding: 10px 20px; background: #34c759; color: #fff; border: none; border-radius: 8px; cursor: pointer; }
.btn-search { width: 100%; padding: 10px; background: #0071e3; color: #fff; border: none; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 500; margin-bottom: 16px; }

/* Pay Methods */
.pay-amount { text-align: center; margin-bottom: 20px; font-size: 14px; color: #86868b; }
.pay-amount b { color: #ff3b30; font-size: 28px; }
.pay-methods { display: flex; gap: 12px; }
.pay-option {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 14px;
    border: 2px solid #e5e5ea; border-radius: 10px; cursor: pointer; color: #86868b; font-size: 14px; font-weight: 500;
    transition: all 0.2s;
}
.pay-option input { display: none; }
.pay-option:has(input:checked) { border-color: #0071e3; color: #0071e3; background: #f0f7ff; }
.pay-icon { font-size: 20px; }

/* Wait Content */
.wait-content { text-align: center; padding: 30px 20px; }
.wait-icon { font-size: 40px; color: #ff9500; animation: spin 2s linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.wait-content h3 { color: #1d1d1f; margin: 16px 0 8px; }
.wait-content p { color: #86868b; font-size: 13px; }
.wait-tip { color: #0071e3 !important; }

/* Delivery Result */
.delivery-content .success-icon { text-align: center; font-size: 40px; margin-bottom: 10px; }
.delivery-content p { text-align: center; color: #86868b; font-size: 13px; margin: 4px 0; }
.delivery-box { background: #f5f5f7; border-radius: 10px; padding: 12px; margin: 10px 0; text-align: left; }
.delivery-box h4 { color: #34c759; font-size: 13px; font-weight: 600; margin: 0 0 8px; }
.delivery-box pre { color: #1d1d1f; font-size: 13px; white-space: pre-wrap; word-break: break-all; margin: 0; font-family: 'SF Mono', monospace; }
.email-sent { color: #34c759 !important; font-size: 12px !important; }

/* Query Results */
.query-result {
    background: #f5f5f7; border-radius: 10px; padding: 12px; margin-bottom: 10px;
    border-left: 3px solid #e5e5ea;
}
.query-result.status-0 { border-left-color: #ff9500; }
.query-result.status-1 { border-left-color: #0071e3; }
.query-result.status-2 { border-left-color: #34c759; }
.qr-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.qr-title { color: #1d1d1f; font-size: 14px; font-weight: 500; }
.qr-status { font-size: 12px; padding: 2px 8px; border-radius: 4px; background: #e5e5ea; color: #86868b; }
.qr-meta { color: #aeaeb2; font-size: 12px; display: flex; gap: 12px; flex-wrap: wrap; }
.qr-delivery { margin-top: 10px; }
.qr-delivery h4 { color: #34c759; font-size: 12px; margin: 0 0 6px; }
.qr-delivery pre { color: #1d1d1f; font-size: 12px; white-space: pre-wrap; word-break: break-all; margin: 0; background: #fff; padding: 8px; border-radius: 6px; }

/* Empty */
.empty { text-align: center; padding: 60px 20px; color: #aeaeb2; }

/* Footer */
footer { text-align: center; padding: 24px 0; color: #c7c7cc; font-size: 12px; }

/* Responsive */
@media (max-width: 480px) {
    .container { padding: 0 12px; }
    header h1 { font-size: 22px; }
    .pay-methods { flex-direction: column; }
    .qr-meta { flex-direction: column; gap: 4px; }
    .modal { align-items: flex-end; }
}