* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #FF6B9D;
    --primary-dark: #D64570;
    --secondary: #2C3E50;
    --accent: #FFB6C1;
    --bg: #F5F5F5;
    --card-bg: #FFFFFF;
    --text: #333333;
    --text-light: #666666;
    --border: #E0E0E0;
    --success: #27AE60;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.15);
}

body {
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 24px;
    max-width: 480px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: var(--shadow-lg);
}

.close-btn {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-light);
    cursor: pointer;
    z-index: 10;
}

/* Payment Modal */
#paymentModal .modal-content {
    text-align: center;
}

#paymentModal h2 {
    color: var(--primary);
    margin-bottom: 8px;
}

.subtitle {
    color: var(--text-light);
    margin-bottom: 20px;
}

.highlight {
    color: var(--primary);
    font-weight: 700;
    font-size: 1.2em;
}

.payment-methods {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.payment-option {
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.3s;
}

.payment-option:hover,
.payment-option.selected {
    border-color: var(--primary);
    background: #FFF8E7;
}

.payment-option img {
    width: 100%;
    max-width: 150px;
    border-radius: 8px;
    margin-bottom: 8px;
}

.payment-option span {
    display: block;
    font-size: 14px;
    color: var(--text);
}

.upload-proof {
    margin: 20px 0;
}

.upload-proof p {
    margin-bottom: 12px;
    color: var(--text-light);
}

input[type="file"] {
    display: none;
}

.upload-btn {
    display: inline-block;
    padding: 12px 24px;
    background: var(--secondary);
    color: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.upload-btn:hover {
    background: #1a252f;
}

#proofPreview img {
    max-width: 200px;
    margin-top: 12px;
    border-radius: 8px;
    border: 2px solid var(--border);
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s;
    margin-top: 16px;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Group QR Modal */
.group-qr {
    text-align: center;
    padding: 20px 0;
}

.group-qr img {
    max-width: 250px;
    border-radius: 12px;
    border: 2px solid var(--border);
}

.group-qr .tip {
    margin-top: 12px;
    color: var(--primary);
    font-size: 14px;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 20px 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.header-content {
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    font-size: 24px;
    font-weight: 700;
}

.tagline {
    font-size: 12px;
    opacity: 0.9;
    margin-top: 2px;
}

.header-actions {
    display: flex;
    gap: 12px;
}

.icon-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    position: relative;
    backdrop-filter: blur(10px);
}

.badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: var(--accent);
    color: var(--text);
    font-size: 11px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

/* Category Nav */
.category-nav {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    overflow-x: auto;
    background: white;
    position: sticky;
    top: 72px;
    z-index: 99;
    border-bottom: 1px solid var(--border);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.category-nav::-webkit-scrollbar {
    display: none;
}

.category-btn {
    flex-shrink: 0;
    padding: 8px 16px;
    border: 1px solid var(--border);
    background: white;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.category-btn.active,
.category-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Product Grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 16px;
    max-width: 600px;
    margin: 0 auto;
}

.product-card {
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
}

.product-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.product-card img {
    width: 100%;
    height: 160px;
    object-fit: cover;
}

.product-card .info {
    padding: 12px;
}

.product-card .name {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.product-card .model {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 4px;
}

.product-card .price {
    font-size: 16px;
    color: var(--primary);
    font-weight: 700;
}

.product-card .quoted-badge {
    display: inline-block;
    background: var(--success);
    color: white;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    margin-top: 4px;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    max-width: 400px;
    height: 100%;
    background: var(--card-bg);
    z-index: 200;
    transition: right 0.3s;
    box-shadow: -4px 0 16px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
}

.sidebar.open {
    right: 0;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h3 {
    font-size: 18px;
}

.sidebar-tabs {
    display: flex;
    gap: 8px;
}

.sidebar-tab {
    padding: 8px 16px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 14px;
    cursor: pointer;
    color: var(--text-light);
    margin-bottom: -1px;
}

.sidebar-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 500;
}

.sidebar-panel {
    display: none;
    flex: 1;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar-panel.active {
    display: flex;
}

.cart-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.cart-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: var(--bg);
    border-radius: 10px;
    margin-bottom: 12px;
}

.cart-item img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
}

.cart-item .details {
    flex: 1;
}

.cart-item .name {
    font-weight: 500;
    margin-bottom: 4px;
}

.cart-item .model {
    font-size: 12px;
    color: var(--text-light);
}

.cart-item .qty {
    font-size: 13px;
    color: var(--primary);
    margin-top: 4px;
}

.cart-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
}

/* Product Detail Modal */
.product-detail {
    padding: 0;
    overflow: hidden;
}

.product-detail .close-btn {
    top: 8px;
    right: 12px;
    background: rgba(0,0,0,0.5);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-images {
    position: relative;
}

.product-images img {
    width: 100%;
    height: 300px;
    object-fit: cover;
}

.image-nav {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 16px;
}

.image-nav button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.5);
    color: white;
    font-size: 18px;
    cursor: pointer;
}

.product-info {
    padding: 20px;
}

.product-info h2 {
    font-size: 20px;
    margin-bottom: 8px;
}

.product-info .model,
.product-info .color {
    color: var(--text-light);
    font-size: 14px;
    margin-bottom: 4px;
}

.product-info .price {
    font-size: 24px;
    color: var(--primary);
    font-weight: 700;
    margin: 12px 0;
}

.quantity-control {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0;
}

.qty-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: white;
    font-size: 18px;
    cursor: pointer;
}

.quantity-control input {
    width: 60px;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px;
    font-size: 16px;
}

/* Quote Modal */
.quote-form {
    margin-top: 20px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    color: var(--text);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
}

.calculation-result {
    background: var(--bg);
    padding: 16px;
    border-radius: 10px;
    margin: 20px 0;
}

.calc-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px dashed var(--border);
}

.calc-row:last-child {
    border-bottom: none;
}

.calc-row.total {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    margin-top: 8px;
    padding-top: 12px;
    border-top: 2px solid var(--primary);
}

/* Customer Pay Modal */
.quote-info {
    text-align: center;
    padding: 20px;
    background: #FFF8E7;
    border-radius: 10px;
    margin-bottom: 20px;
}

.group-section {
    padding: 0 16px;
    max-width: 600px;
    margin: 12px auto 0;
}

.group-card {
    background: linear-gradient(135deg, #FFF0F5 0%, #FFE4ED 100%);
    border: 1px solid #FFB6C1;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
}

.group-card h4 {
    color: var(--primary-dark);
    margin-bottom: 12px;
    font-size: 15px;
}

.group-card img {
    max-width: 180px;
    border-radius: 8px;
    border: 2px solid var(--border);
    margin-bottom: 8px;
}

.group-card p {
    font-size: 13px;
    color: var(--text-light);
}

/* AI 识别结果 */
.recognize-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.recognize-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #FFF0F5;
    border: 1px solid #FFB6C1;
    border-radius: 10px;
    padding: 10px 12px;
}

.recognize-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 13px;
}

.recognize-info strong {
    font-size: 14px;
    color: var(--text);
}

.recognize-info span {
    color: var(--text-light);
}

.recognize-select-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}

.quote-price {
    font-size: 32px;
    color: var(--primary);
    font-weight: 700;
}

.address-section {
    margin-bottom: 20px;
}

.address-section h3 {
    margin-bottom: 12px;
    font-size: 16px;
}

.payment-qr {
    text-align: center;
    margin-bottom: 20px;
}

.payment-qr img {
    max-width: 200px;
    border-radius: 10px;
    border: 2px solid var(--border);
}

/* Admin Panel */
.admin-content {
    max-width: 600px;
    padding: 0;
}

.admin-content .close-btn {
    position: fixed;
    top: 16px;
    right: 16px;
}

.admin-content h2 {
    padding: 20px 20px 0;
}

.admin-tabs {
    display: flex;
    gap: 0;
    padding: 0 20px;
    border-bottom: 1px solid var(--border);
    margin-top: 16px;
}

.stats-bar {
    display: flex;
    gap: 10px;
    padding: 16px 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.stats-bar::-webkit-scrollbar {
    display: none;
}

.stat-card {
    flex: 1;
    min-width: 64px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 6px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.stat-card.active,
.stat-card:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.stat-value {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 12px;
}

.filter-bar {
    display: flex;
    gap: 8px;
    padding: 12px 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.filter-bar::-webkit-scrollbar {
    display: none;
}

.filter-btn {
    flex-shrink: 0;
    padding: 6px 14px;
    border: 1px solid var(--border);
    background: white;
    border-radius: 16px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.filter-btn.active,
.filter-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.tab-btn {
    flex: 1;
    padding: 12px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 14px;
    cursor: pointer;
    color: var(--text-light);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 500;
}

.tab-content {
    display: none;
    padding: 20px;
    max-height: 70vh;
    overflow-y: auto;
}

.tab-content.active {
    display: block;
}

.upload-section {
    background: var(--bg);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.upload-section h3 {
    margin-bottom: 16px;
}

.upload-preview {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin: 12px 0;
}

.upload-preview img {
    width: 100%;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
}

/* Orders List */
.order-card {
    background: var(--bg);
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 12px;
}

.order-card .order-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
}

.order-card .status {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status.pending { background: #FFF3CD; color: #856404; }
.status.paid { background: #D4EDDA; color: #155724; }
.status.purchased { background: #CCE5FF; color: #004085; }
.status.shipped { background: #D1ECF1; color: #0C5460; }

.order-items {
    margin-bottom: 12px;
}

.order-item-row {
    display: flex;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.order-item-row img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
}

.order-item-row .item-info {
    flex: 1;
}

.order-item-row .item-price {
    color: var(--primary);
    font-weight: 500;
}

/* Quoted Products */
.quoted-card {
    background: var(--bg);
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 12px;
    display: flex;
    gap: 12px;
}

.quoted-card img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
}

.quoted-card .quoted-info {
    flex: 1;
}

.quoted-card .quoted-price {
    color: var(--primary);
    font-weight: 700;
    font-size: 16px;
}

/* Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 150;
    display: none;
}

.overlay.show {
    display: block;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
}

.empty-state img {
    width: 120px;
    opacity: 0.5;
    margin-bottom: 16px;
}

/* Responsive */
@media (min-width: 768px) {
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.product-card {
    animation: fadeIn 0.3s ease-out;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}
