* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif; }
body { background-color: #f5f5f5; color: #333; line-height: 1.6; }
a { text-decoration: none; color: inherit; }

.container { max-width: 1400px; margin: 0 auto; padding: 0 20px; }

/* Top Navigation */
.top-nav { background-color: #f8f8f8; border-bottom: 1px solid #e5e5e5; font-size: 13px; color: #666; padding: 10px 0; }
.top-nav .container { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.top-nav-links { display: flex; gap: 20px; flex-wrap: wrap; }
.top-nav-links span, .top-nav-links a { cursor: pointer; transition: color 0.2s; }
.top-nav-links span:hover, .top-nav-links a:hover { color: #2ecc71; }

/* Header */
.header { display: flex; align-items: center; padding: 22px 20px; background-color: #fff; flex-wrap: wrap; gap: 16px; }
.logo { font-size: 28px; font-weight: bold; color: #2ecc71; flex-shrink: 0; }
.search-container { flex: 1; min-width: 280px; display: flex; }
.search-input { flex: 1; padding: 13px 18px; border: 2px solid #2ecc71; border-right: none; outline: none; border-radius: 22px 0 0 22px; font-size: 14px; }
.search-btn { background-color: #2ecc71; color: white; border: none; padding: 0 30px; font-weight: bold; cursor: pointer; border-radius: 0 22px 22px 0; font-size: 15px; }
.user-rewards { display: flex; gap: 12px; align-items: center; }

.location-pill {
    background: #e8f5e9; color: #2e7d32; padding: 5px 14px; border-radius: 20px; font-size: 12.5px; display: flex; align-items: center; gap: 5px;
}

/* Main Top Grid */
.main-top { display: grid; grid-template-columns: 210px 1fr 270px; gap: 18px; margin-top: 18px; }
@media (max-width: 1100px) {
    .main-top { grid-template-columns: 1fr 1fr; }
    .right-panel { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
}
@media (max-width: 768px) {
    .main-top { grid-template-columns: 1fr; }
    .right-panel { grid-template-columns: 1fr; }
}

/* Categories */
.categories { background: #fff; padding: 20px; border-radius: 12px; font-size: 14px; box-shadow: 0 1px 4px rgba(0,0,0,0.05); }
.categories h3 { font-size: 17px; margin-bottom: 14px; color: #222; }
.categories li { padding: 10px 0; cursor: pointer; display: flex; gap: 10px; color: #555; list-style: none; }
.categories li:hover { color: #2ecc71; }

/* Banners */
.center-banners { display: flex; flex-direction: column; gap: 16px; }
.main-banner { background: linear-gradient(135deg, #e74c3c, #c0392b); color: white; min-height: 265px; border-radius: 14px; padding: 42px 40px; display: flex; flex-direction: column; justify-content: center; }
.main-banner h2 { font-size: 34px; margin-bottom: 10px; }
.main-banner p { font-size: 17px; opacity: 0.95; }

.sub-banners { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 900px) { .sub-banners { grid-template-columns: repeat(2, 1fr); } }
.sub-banner { background: #fff; padding: 16px 14px; border-radius: 12px; text-align: center; font-size: 13.5px; border: 1px solid #eee; cursor: pointer; transition: all 0.2s; }
.sub-banner:hover { box-shadow: 0 4px 14px rgba(0,0,0,0.08); transform: translateY(-2px); }
.sub-banner strong { font-size: 14.5px; color: #333; display: block; margin-bottom: 5px; }
.sub-banner span { color: #e74c3c; font-size: 12.5px; }

/* Right Panel */
.right-panel { display: flex; flex-direction: column; gap: 16px; }
.livestream-widget { background: #1a1a1a; color: white; min-height: 175px; border-radius: 12px; display: flex; align-items: flex-end; padding: 18px; font-size: 14px; background-image: linear-gradient(to top, rgba(0,0,0,0.85), transparent); cursor: pointer; }
.daily-deal { background: #fffaf0; min-height: 190px; border-radius: 12px; padding: 20px; text-align: center; border: 1px solid #f9e7d0; }
.daily-deal h3 { color: #d35400; margin-bottom: 10px; }
.daily-deal-btn { background: #f39c12; color: white; border: none; padding: 10px 22px; border-radius: 22px; margin-top: 10px; cursor: pointer; width: 100%; font-weight: bold; transition: background 0.2s; }
.daily-deal-btn:hover { background: #e67e22; }

/* Product Navigation */
.product-nav { display: flex; gap: 10px; padding: 20px 0; font-size: 14.5px; font-weight: 600; overflow-x: auto; scrollbar-width: none; }
.product-nav::-webkit-scrollbar { display: none; }
.product-nav span { cursor: pointer; padding: 9px 18px; border-radius: 22px; white-space: nowrap; transition: all 0.2s; }
.product-nav span.active { background: #2ecc71; color: white; box-shadow: 0 2px 8px rgba(46, 204, 113, 0.3); }
.product-nav span:hover:not(.active) { background: #f0f0f0; }

/* Product Grid */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 18px; margin-bottom: 55px; }
.product-card { background: #fff; border-radius: 12px; padding: 16px; transition: all 0.25s ease; border: 1px solid #eee; cursor: pointer; display: flex; flex-direction: column; }
.product-card:hover { transform: translateY(-5px); box-shadow: 0 10px 22px rgba(0,0,0,0.09); }
.product-img { width: 100%; height: 158px; background-color: #f8f8f8; border-radius: 10px; margin-bottom: 13px; overflow: hidden; }
.product-img img { width: 100%; height: 100%; object-fit: cover; }
.product-title { font-size: 14px; color: #222; margin-bottom: 7px; line-height: 1.35; min-height: 36px; }
.product-desc { font-size: 12px; color: #888; margin-bottom: 11px; }
.product-price-row { display: flex; align-items: baseline; justify-content: space-between; margin-top: auto; }
.price { color: #e74c3c; font-size: 19px; font-weight: 700; }
.price::before { content: '$'; font-size: 13px; margin-right: 1px; }
.sales { font-size: 11.5px; color: #999; }

/* Modal */
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.55); z-index: 1000; align-items: center; justify-content: center; }
.modal-content { background: white; width: 92%; max-width: 540px; border-radius: 16px; overflow: hidden; box-shadow: 0 12px 35px rgba(0,0,0,0.2); }
.modal-header { padding: 18px 22px; border-bottom: 1px solid #eee; display: flex; justify-content: space-between; align-items: center; }
.modal-body { padding: 24px; }
.modal-img { width: 100%; height: 230px; object-fit: cover; border-radius: 10px; margin-bottom: 18px; }
.modal-price { font-size: 27px; font-weight: 700; color: #e74c3c; margin: 12px 0; }
.qty-selector { display: flex; align-items: center; gap: 14px; margin: 18px 0; }
.qty-btn { width: 38px; height: 38px; border: 1px solid #ddd; background: white; font-size: 22px; cursor: pointer; border-radius: 10px; }
.qty-btn:hover { background: #f5f5f5; }
.add-to-cart-btn { background: #2ecc71; color: white; border: none; padding: 15px; width: 100%; font-size: 16px; font-weight: 700; border-radius: 12px; cursor: pointer; margin-top: 8px; transition: background 0.2s; }
.add-to-cart-btn:hover { background: #27ae60; }

.cart-modal .modal-content { max-width: 480px; }
.cart-item { display: flex; justify-content: space-between; align-items: center; padding: 14px 0; border-bottom: 1px solid #f0f0f0; }
.cart-total { font-size: 19px; font-weight: 700; padding-top: 14px; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #333; color: white; padding: 13px 26px; border-radius: 30px; font-size: 14px; box-shadow: 0 4px 14px rgba(0,0,0,0.3); z-index: 2000; display: none; }

footer { background: #222; color: #aaa; padding: 32px 0; margin-top: 45px; font-size: 13.5px; }
footer .container { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 22px; }

/* ---- Shared page chrome (cart / checkout / order / product) ---- */
.page { max-width: 1000px; margin: 24px auto; padding: 0 20px; }
.breadcrumb { font-size: 13px; color: #888; margin: 18px 0; }
.breadcrumb a:hover { color: #2ecc71; }
.page-title { font-size: 24px; font-weight: 700; margin-bottom: 18px; color: #222; }
.panel { background: #fff; border: 1px solid #eee; border-radius: 14px; padding: 24px; box-shadow: 0 1px 4px rgba(0,0,0,0.05); }
.empty-state { text-align: center; padding: 60px 20px; color: #999; }
.empty-state a { color: #2ecc71; font-weight: 600; }

.btn { display: inline-block; border: none; border-radius: 12px; padding: 13px 26px; font-size: 15px; font-weight: 700; cursor: pointer; text-align: center; transition: background 0.2s; }
.btn-primary { background: #2ecc71; color: #fff; }
.btn-primary:hover { background: #27ae60; }
.btn-ghost { background: #f0f0f0; color: #444; }
.btn-ghost:hover { background: #e6e6e6; }
.btn-block { width: 100%; }

/* Cart / order line rows */
.line-row { display: flex; align-items: center; gap: 16px; padding: 16px 0; border-bottom: 1px solid #f0f0f0; }
.line-row:last-child { border-bottom: none; }
.line-img { width: 70px; height: 70px; border-radius: 10px; object-fit: cover; background: #f5f5f5; flex-shrink: 0; }
.line-main { flex: 1; min-width: 0; }
.line-main strong { display: block; font-size: 14.5px; color: #222; }
.line-unit { font-size: 12.5px; color: #999; margin-top: 3px; }
.line-qty { display: flex; align-items: center; gap: 8px; }
.line-qty .qty-btn { width: 32px; height: 32px; font-size: 18px; }
.line-qty span { min-width: 26px; text-align: center; font-weight: 600; }
.line-amount { width: 90px; text-align: right; font-weight: 700; color: #e74c3c; }
.line-del { background: none; border: none; color: #bbb; cursor: pointer; font-size: 18px; }
.line-del:hover { color: #e74c3c; }

.summary-row { display: flex; justify-content: space-between; padding: 8px 0; font-size: 14px; color: #555; }
.summary-total { display: flex; justify-content: space-between; padding: 14px 0 4px; font-size: 20px; font-weight: 700; }
.summary-total span:last-child { color: #e74c3c; }

/* Forms */
.form-grid { display: grid; gap: 16px; }
.form-field label { display: block; font-size: 13px; color: #666; margin-bottom: 6px; }
.form-field input, .form-field select, .form-field textarea {
    width: 100%; padding: 12px 14px; border: 1px solid #ddd; border-radius: 10px; font-size: 14px; outline: none;
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus { border-color: #2ecc71; }

.checkout-grid { display: grid; grid-template-columns: 1fr 360px; gap: 22px; align-items: start; }
@media (max-width: 820px) { .checkout-grid { grid-template-columns: 1fr; } }

/* Product detail */
.detail-grid { display: grid; grid-template-columns: 440px 1fr; gap: 30px; align-items: start; }
@media (max-width: 820px) { .detail-grid { grid-template-columns: 1fr; } }
.detail-img { width: 100%; border-radius: 14px; background: #f5f5f5; aspect-ratio: 1/1; object-fit: cover; }
.detail-info h1 { font-size: 24px; color: #222; margin-bottom: 12px; }
.detail-price { font-size: 32px; font-weight: 800; color: #e74c3c; margin: 14px 0; }
.detail-price::before { content: '$'; font-size: 18px; margin-right: 2px; }
.detail-meta { color: #888; font-size: 13.5px; margin-bottom: 10px; }
.badge { display: inline-block; background: #e8f5e9; color: #2e7d32; padding: 3px 12px; border-radius: 20px; font-size: 12px; }

/* ---- Home: real hot-rank + today's deal ---- */
.hot-rank { background: #fff; border: 1px solid #eee; border-radius: 12px; padding: 16px 16px 8px; box-shadow: 0 1px 4px rgba(0,0,0,0.05); }
.hot-rank h3 { font-size: 16px; margin-bottom: 10px; color: #222; }
.hot-list { list-style: none; }
.hot-list li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid #f5f5f5; cursor: pointer; }
.hot-list li:last-child { border-bottom: none; }
.hot-list li:hover .hot-title { color: #2ecc71; }
.hot-num { width: 18px; text-align: center; font-weight: 800; font-style: italic; color: #ccc; flex-shrink: 0; }
.hot-list li:nth-child(1) .hot-num { color: #e74c3c; }
.hot-list li:nth-child(2) .hot-num { color: #e67e22; }
.hot-list li:nth-child(3) .hot-num { color: #f1c40f; }
.hot-list img { width: 42px; height: 42px; border-radius: 8px; object-fit: cover; background: #f5f5f5; flex-shrink: 0; }
.hot-info { flex: 1; min-width: 0; }
.hot-title { font-size: 13px; color: #333; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hot-meta { font-size: 11px; color: #999; margin-top: 2px; }
.hot-price { font-size: 13.5px; font-weight: 700; color: #e74c3c; flex-shrink: 0; }

.deal-img { width: 100%; height: 130px; object-fit: cover; border-radius: 10px; }
.deal-title { font-size: 13px; color: #333; margin: 8px 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deal-price { font-size: 22px; font-weight: 800; color: #e74c3c; margin-bottom: 4px; }
.muted { color: #aaa; font-size: 13px; text-align: center; padding: 20px 0; }

/* ---- Visual polish + tactile buttons ---- */
.header { box-shadow: 0 1px 0 #eee; }
.btn:active, .daily-deal-btn:active, .add-to-cart-btn:active, .search-btn:active { transform: translateY(1px); }
.top-nav-links a:hover { color: #2ecc71; }

/* ---- Mobile ---- */
@media (max-width: 768px) {
    .top-nav { font-size: 12px; }
    .header { padding: 14px 16px; gap: 12px; }
    .logo { font-size: 24px; }
    .search-container { order: 3; min-width: 100%; }
    .user-rewards { gap: 8px; }
    .main-banner { min-height: 180px; padding: 28px 24px; }
    .main-banner h2 { font-size: 26px; }
    .page-title { font-size: 20px; }
    .detail-price { font-size: 26px; }
    .line-amount { width: 70px; }
}
@media (max-width: 480px) {
    .product-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .product-img { height: 132px; }
    .product-title { min-height: 34px; font-size: 13px; }
    .checkout-grid, .detail-grid { gap: 16px; }
}

/* ---- Sale zone (home strip + tags) ---- */
.sale-strip { background: linear-gradient(135deg,#fff5e6,#ffe9e6); border:1px solid #ffd9c2; border-radius:14px; padding:16px 18px; margin-top:18px; }
.sale-head { display:flex; align-items:center; justify-content:space-between; margin-bottom:12px; }
.sale-head h3 { font-size:17px; color:#d35400; }
.sale-more { font-size:13px; color:#e67e22; font-weight:600; }
.sale-more:hover { color:#d35400; }
.sale-row { display:flex; gap:12px; overflow-x:auto; scrollbar-width:none; padding-bottom:2px; }
.sale-row::-webkit-scrollbar { display:none; }
.sale-card { flex:0 0 140px; background:#fff; border:1px solid #ffe0cc; border-radius:12px; padding:10px; position:relative; transition:all .2s; }
.sale-card:hover { transform:translateY(-3px); box-shadow:0 8px 18px rgba(231,76,60,.12); }
.sale-card img { width:100%; height:110px; object-fit:cover; border-radius:8px; background:#f5f5f5; }
.sale-name { font-size:12.5px; color:#333; margin:8px 0 4px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.sale-price { font-size:17px; font-weight:800; color:#e74c3c; }
.sale-price::before { content:'$'; font-size:12px; margin-right:1px; }
.sale-tag { background:#e74c3c; color:#fff; font-size:11px; font-weight:700; padding:2px 8px; border-radius:6px; position:absolute; top:8px; left:8px; }

/* ---- Discount: strikethrough original + card tag ---- */
.sale-orig, .card-orig { color: #bbb; font-weight: 500; font-size: 12px; margin-left: 4px; }
.card-orig::before { content: ''; }
.product-img { position: relative; }
.card-tag { position: absolute; top: 8px; left: 8px; z-index: 2; background: #e74c3c; color: #fff; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 6px; }

/* ---- Pager (search results) ---- */
.pager { display:flex; align-items:center; justify-content:center; gap:16px; margin:24px 0 50px; }
.pager-info { font-size:13px; color:#888; }

/* ---- Smoother checkout: actions, validation, sticky bars ---- */
.modal-actions { display: flex; gap: 10px; margin-top: 8px; }
.toast-action { color: #5fe08a; font-weight: 700; margin-left: 16px; }
.err-msg { color: #e74c3c; font-size: 12px; display: block; margin-top: 4px; min-height: 0; }
.hint { color: #888; font-size: 12px; display: block; margin-top: 4px; }
.form-field input.invalid, .form-field textarea.invalid, .form-field select.invalid { border-color: #e74c3c; background: #fff7f7; }
.checkout-summary { position: sticky; top: 16px; }

.cart-sticky { display: none; }
@media (max-width: 768px) {
    .cart-sticky {
        display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
        background: #fff; border-top: 1px solid #eee; padding: 10px 16px;
        align-items: center; justify-content: space-between; gap: 12px;
        box-shadow: 0 -2px 12px rgba(0,0,0,0.07);
    }
    .cart-sticky-total { font-size: 13px; color: #555; }
    .cart-sticky-total strong { color: #e74c3c; font-size: 16px; }
    .cart-sticky .btn { padding: 11px 26px; }
    .page { padding-bottom: 84px; }
    .checkout-summary { position: static; }
}

/* ---- Animations ---- */
@keyframes cardIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(.94) translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 16px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes bump { 0% { transform: scale(1); } 30% { transform: scale(1.45); } 60% { transform: scale(.9); } 100% { transform: scale(1); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

html { scroll-behavior: smooth; }
body { animation: fadeIn .25s ease; }

/* staggered product cards */
.product-grid .product-card { animation: cardIn .4s ease both; }
.product-grid .product-card:nth-child(1) { animation-delay: .02s; }
.product-grid .product-card:nth-child(2) { animation-delay: .06s; }
.product-grid .product-card:nth-child(3) { animation-delay: .10s; }
.product-grid .product-card:nth-child(4) { animation-delay: .14s; }
.product-grid .product-card:nth-child(5) { animation-delay: .18s; }
.product-grid .product-card:nth-child(6) { animation-delay: .22s; }
.product-grid .product-card:nth-child(7) { animation-delay: .26s; }
.product-grid .product-card:nth-child(8) { animation-delay: .30s; }
.product-grid .product-card:nth-child(n+9) { animation-delay: .34s; }

/* modal & toast & banners */
.modal-content { animation: pop .26s cubic-bezier(.2, .8, .3, 1.2); }
.sale-strip, .hot-rank, .daily-deal { animation: slideDown .4s ease both; }
[data-cart-count] { display: inline-block; }
[data-cart-count].bump { animation: bump .4s ease; }
.product-nav span, .sub-banner, .sale-card, .btn, .add-to-cart-btn { transition: all .2s ease; }

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---- Category page layout ---- */
.category-layout { display: grid; grid-template-columns: 210px 1fr; gap: 18px; margin: 18px 0; align-items: start; }
.cat-side { position: sticky; top: 16px; }
.categories li.active { color: #2ecc71; font-weight: 700; }
.cat-main .product-grid { margin-top: 8px; }
@media (max-width: 768px) {
    .category-layout { grid-template-columns: 1fr; }
    .cat-side { position: static; }
}

/* ---- Account (login / register) ---- */
.auth-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: start; }
@media (max-width: 768px) { .auth-grid { grid-template-columns: 1fr; } }
