/* ==============================
   家梦 (JiaMeng) - 亚马逊风格电商
   ============================== */

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans SC', Roboto, Arial, sans-serif;
    background: #eaeded;  /* 亚马逊灰 */
    color: #0f1111;
    line-height: 1.6;
    overflow-x: hidden;
}

a { text-decoration: none; color: #007185; }
a:hover { color: #c7511f; }

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

/* --- 顶部导航 (亚马逊黑条) --- */
.nav-top .container {
    display: flex;
    align-items: center;
    gap: 20px;
}
@media (max-width: 768px) {
    .nav-top .container { flex-wrap: wrap; gap: 10px; }
    .nav-top .logo { font-size: 18px !important; }
    .nav-top .search-bar { order: 3; flex-basis: 100%; }
    .nav-top .nav-right { gap: 10px; }
    .nav-top .nav-right .nav-link .line1,
    .nav-top .nav-right .nav-link .line2 { font-size: 11px; }
}
/* --- 顶部导航 (亚马逊黑条) --- */
.nav-top {
    background: #131921;
    color: #fff;
    padding: 10px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.nav-top .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

/* Logo */
.logo {
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 6px;
}
.logo .accent { color: #ff9900; }
.logo-icon { font-size: 24px; }

/* 搜索栏 */
.search-bar {
    flex: 1;
    max-width: 650px;
    min-width: 200px;
    display: flex;
}
.search-bar input {
    flex: 1;
    padding: 10px 15px;
    border: none;
    border-radius: 4px 0 0 4px;
    font-size: 15px;
    outline: none;
}
.search-bar button {
    background: #febd69;
    border: none;
    padding: 10px 18px;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    font-size: 16px;
    color: #131921;
    transition: background 0.2s;
}
.search-bar button:hover { background: #f3a847; }

.nav-right {
    display: flex;
    align-items: center;
    gap: 20px;
}
.nav-link {
    color: #ddd;
    font-size: 13px;
    cursor: pointer;
    transition: color 0.2s;
}
.nav-link:hover { color: #fff; }
.nav-link .line1 { font-size: 12px; color: #999; }
.nav-link .line2 { font-size: 14px; font-weight: 700; }
.cart-icon { font-size: 24px; position: relative; }
.cart-badge {
    position: absolute;
    top: -8px;
    right: -10px;
    background: #ff9900;
    color: #131921;
    font-size: 12px;
    font-weight: 700;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- 子导航 --- */
.nav-sub {
    background: #232f3e;
    color: #fff;
    padding: 0;
    overflow-x: auto;
    white-space: nowrap;
}
.nav-sub .container { display: flex; gap: 0; }
.nav-sub a {
    color: #ddd;
    padding: 8px 16px;
    font-size: 13px;
    display: inline-block;
    transition: background 0.2s;
}
.nav-sub a:hover { background: #3a4553; color: #fff; }

/* --- 主横幅 --- */
.hero {
    background: linear-gradient(135deg, #232f3e 0%, #131921 100%);
    color: #fff;
    padding: 60px 0;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 50%, rgba(255,153,0,0.08) 0%, transparent 50%);
    animation: heroGlow 8s ease-in-out infinite alternate;
}
@keyframes heroGlow {
    0% { transform: translate(0, 0); }
    100% { transform: translate(-20%, 10%); }
}
.hero .container { position: relative; z-index: 1; }
.hero h1 {
    font-size: 42px;
    font-weight: 700;
    margin-bottom: 12px;
}
.hero h1 .highlight { color: #ff9900; }
.hero p {
    font-size: 18px;
    color: #bbb;
    margin-bottom: 30px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}
.hero-btn {
    display: inline-block;
    background: #ff9900;
    color: #131921;
    padding: 14px 36px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
}
.hero-btn:hover { background: #f08804; color: #131921; transform: translateY(-1px); }

/* --- 分类标签 --- */
.category-bar {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin: -30px auto 30px;
    position: relative;
    z-index: 2;
}
.category-tag {
    background: #fff;
    border-radius: 8px;
    padding: 14px 28px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
    border: 2px solid transparent;
}
.category-tag:hover, .category-tag.active {
    border-color: #ff9900;
    box-shadow: 0 4px 16px rgba(255,153,0,0.2);
    transform: translateY(-2px);
}
.category-tag .tag-icon { margin-right: 6px; }

/* --- 产品区域 --- */
.section-title {
    font-size: 24px;
    font-weight: 700;
    margin: 30px 0 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.section-title .see-all {
    font-size: 14px;
    font-weight: 400;
}

/* 产品网格 */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}
.product-card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.25s;
    cursor: pointer;
    position: relative;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.product-card:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    transform: translateY(-4px);
}
.product-card .badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: #ff9900;
    color: #131921;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    z-index: 2;
}
.product-card .badge.hot { background: #e47911; color: #fff; }
.product-card .badge.new { background: #232f3e; color: #fff; }

.product-image {
    width: 100%;
    height: 280px;
    object-fit: contain;
    padding: 20px;
    background: #f8f8f8;
    display: block;
    transition: transform 0.3s;
}
.product-card:hover .product-image { transform: scale(1.05); }

.product-info {
    padding: 16px;
}
.product-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
    min-height: 42px;
}
.product-rating {
    color: #ff9900;
    font-size: 14px;
    margin-bottom: 6px;
}
.product-rating .count {
    color: #007185;
    font-size: 13px;
    margin-left: 4px;
}
.product-price {
    font-size: 22px;
    font-weight: 700;
    color: #b12704;
}
.product-price .original {
    font-size: 14px;
    color: #999;
    text-decoration: line-through;
    margin-left: 6px;
    font-weight: 400;
}
.product-price .tax-info {
    font-size: 12px;
    color: #666;
    font-weight: 400;
}
.add-to-cart {
    width: 100%;
    padding: 10px;
    margin-top: 12px;
    background: #ffd814;
    border: 1px solid #fcd200;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.add-to-cart:hover { background: #f7ca00; border-color: #f2c200; }

/* --- 详细展示区 --- */
.featured-section {
    background: #fff;
    border-radius: 8px;
    padding: 40px;
    margin: 30px 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.featured-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: center;
}
.featured-image img {
    width: 100%;
    border-radius: 8px;
}
.featured-info h2 {
    font-size: 28px;
    margin-bottom: 16px;
}
.featured-info ul {
    list-style: none;
    padding: 0;
}
.featured-info ul li {
    padding: 8px 0;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}
.featured-info ul li::before {
    content: '✓';
    color: #ff9900;
    font-weight: 700;
}

/* --- 产品详情弹窗 (Modal) --- */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 2000;
    padding: 40px 20px;
    overflow-y: auto;
}
.modal-overlay.active { display: block; }
.modal {
    background: #fff;
    max-width: 1000px;
    margin: 0 auto;
    border-radius: 8px;
    padding: 40px;
    position: relative;
    animation: modalIn 0.3s ease;
}
@keyframes modalIn {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.modal-close {
    position: absolute;
    top: 16px;
    right: 20px;
    font-size: 28px;
    cursor: pointer;
    color: #666;
    background: none;
    border: none;
    transition: color 0.2s;
}
.modal-close:hover { color: #131921; }
.modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
}
.modal-image img {
    width: 100%;
    border-radius: 8px;
}
.modal-info h2 {
    font-size: 24px;
    margin-bottom: 12px;
}
.modal-price {
    font-size: 28px;
    font-weight: 700;
    color: #b12704;
    margin-bottom: 16px;
}
.modal-desc {
    color: #555;
    line-height: 1.8;
    margin-bottom: 20px;
}
.modal-specs {
    background: #f8f8f8;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}
.modal-specs h4 { margin-bottom: 10px; font-size: 16px; }
.modal-specs table { width: 100%; border-collapse: collapse; }
.modal-specs td {
    padding: 8px 6px;
    border-bottom: 1px solid #e0e0e0;
    font-size: 14px;
}
.modal-specs td:first-child { font-weight: 600; color: #555; width: 100px; }
.quantity-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}
.quantity-selector button {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid #ddd;
    background: #f8f8f8;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
}
.quantity-selector button:hover { background: #e0e0e0; }
.quantity-selector span {
    font-size: 18px;
    font-weight: 600;
    min-width: 30px;
    text-align: center;
}
.btn-add-cart {
    width: 100%;
    padding: 14px;
    background: #ffd814;
    border: 1px solid #fcd200;
    border-radius: 24px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-add-cart:hover { background: #f7ca00; }
.btn-buy-now {
    width: 100%;
    padding: 14px;
    margin-top: 10px;
    background: #ffa41c;
    border: 1px solid #ff8f00;
    border-radius: 24px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    color: #131921;
    transition: all 0.2s;
}
.btn-buy-now:hover { background: #f08804; }

/* Toast 通知 */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #232f3e;
    color: #fff;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    z-index: 3000;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.4s ease;
}
.toast.show { transform: translateY(0); opacity: 1; }

/* --- 页脚 --- */
.footer {
    background: #232f3e;
    color: #ddd;
    padding: 40px 0;
    margin-top: 40px;
}
.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}
.footer h4 { color: #fff; margin-bottom: 12px; font-size: 16px; }
.footer ul { list-style: none; }
.footer ul li { margin-bottom: 6px; }
.footer ul li a { color: #999; font-size: 13px; transition: color 0.2s; }
.footer ul li a:hover { color: #fff; }
.footer-bottom {
    border-top: 1px solid #3a4553;
    padding-top: 20px;
    text-align: center;
    font-size: 12px;
    color: #666;
}

/* --- 购物车弹窗 --- */
.cart-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 380px;
    height: 100%;
    background: #fff;
    box-shadow: -4px 0 20px rgba(0,0,0,0.15);
    z-index: 1500;
    transition: right 0.3s ease;
    padding: 20px;
    overflow-y: auto;
}
.cart-panel.open { right: 0; }
.cart-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1499;
}
.cart-overlay.open { display: block; }
.cart-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.cart-close {
    font-size: 24px;
    cursor: pointer;
    color: #666;
    background: none;
    border: none;
}
.cart-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #eee;
}
.cart-item img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    border-radius: 4px;
}
.cart-item-info { flex: 1; }
.cart-item-title { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.cart-item-price { font-size: 16px; font-weight: 700; color: #b12704; }
.cart-item-qty { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.cart-item-qty button {
    width: 24px; height: 24px;
    border-radius: 50%;
    border: 1px solid #ddd;
    background: #f8f8f8;
    cursor: pointer;
    font-size: 14px;
}
.cart-item-remove {
    color: #c7511f;
    font-size: 12px;
    cursor: pointer;
    align-self: flex-start;
}
.cart-total {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 2px solid #ddd;
    text-align: right;
}
.cart-total .total-label { font-size: 14px; color: #555; }
.cart-total .total-amount { font-size: 24px; font-weight: 700; color: #b12704; }
.btn-checkout {
    width: 100%;
    padding: 14px;
    margin-top: 16px;
    background: #ffd814;
    border: 1px solid #fcd200;
    border-radius: 24px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}
.btn-checkout:hover { background: #f7ca00; }
.cart-empty {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}
.cart-empty .icon { font-size: 48px; margin-bottom: 12px; }

/* --- 响应式 --- */
@media (max-width: 768px) {
    .hero h1 { font-size: 28px; }
    .nav-top .container { flex-direction: column; }
    .search-bar { max-width: 100%; }
    .product-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
    .product-image { height: 180px; }
    .featured-grid { grid-template-columns: 1fr; }
    .modal-grid { grid-template-columns: 1fr; }
    .modal { padding: 20px; }
    .cart-panel { width: 100%; right: -100%; }
}
