/* ============================================
   JuPay Shop - Main Stylesheet
   ============================================ */

/* ---------- Navbar ---------- */
.navbar-shop {
    position: relative; top: 0; left: 0; right: 0; z-index: 100;
    background: var(--primary-color); padding: 16px 40px;
}
.navbar-shop.scrolled {
    position: fixed; background: var(--primary-color); box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}
.navbar-inner {
    display: flex; justify-content: space-between; align-items: center;
    max-width: 1200px; margin: 0 auto;
}
.navbar-shop .logo { font-size: 24px; font-weight: 700; color: #fff; text-decoration: none; }
.navbar-shop .logo-img { height: 36px; }
.nav-links { display: flex; gap: 30px; }
.nav-links a { text-decoration: none; color: rgba(255,255,255,0.9); font-weight: 500; font-size: 15px; }
.nav-links a:hover { color: #fff; }
.nav-icons { display: flex; gap: 20px; align-items: center; }
.nav-icons a { color: rgba(255,255,255,0.9); font-size: 20px; text-decoration: none; position: relative; }
.nav-icons a:hover { color: #fff; }
.cart-badge {
    position: absolute; top: -6px; right: -8px; background: #e63946; color: #fff;
    font-size: 11px; width: 18px; height: 18px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
}

/* ---------- Hero ---------- */
.hero-section { position: relative; width: 100%; overflow: hidden; }
.hero-section .hero-bg { width: 100%; height: auto; display: block; }
.hero-section .hero-placeholder {
    width: 100%; height: 400px;
    background: linear-gradient(135deg, color-mix(in srgb, var(--primary-color) 40%, black) 0%, var(--primary-color) 40%, color-mix(in srgb, var(--primary-color) 80%, white) 100%);
}
.banner-slider { position: relative; width: 100%; }
.banner-slider .banner-slide { position: absolute; top: 0; left: 0; width: 100%; height: auto; opacity: 0; transition: opacity 1s ease-in-out; }
.banner-slider .banner-slide.active { position: relative; opacity: 1; }
.hero-overlay {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center; padding: 20px;
}
.hero-overlay h1 { font-size: 48px; font-weight: 700; color: #fff; margin-bottom: 12px; text-shadow: 0 2px 8px rgba(0,0,0,0.4); }
.hero-overlay p { font-size: 18px; color: rgba(255,255,255,0.9); margin-bottom: 28px; max-width: 600px; text-shadow: 0 1px 4px rgba(0,0,0,0.3); }
.btn-hero {
    padding: 14px 36px; background: #fff; color: var(--primary-color); border: none;
    border-radius: 6px; font-size: 16px; font-weight: 600; cursor: pointer;
    text-decoration: none; display: inline-block; transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}
.btn-hero:hover { background: var(--primary-color); color: #fff; }

/* ---------- Page Header ---------- */
.page-header { padding: 40px; text-align: center; background: #f8f9fa; margin-top: 0; }
.page-header h1 { font-size: 28px; font-weight: 700; color: #1a1a2e; }

/* ---------- Products Section ---------- */
.products-section { padding: 80px 40px; max-width: 1200px; margin: 0 auto; }
.section-title { text-align: center; font-size: 32px; font-weight: 700; margin-bottom: 12px; }
.section-subtitle { text-align: center; color: #666; font-size: 16px; margin-bottom: 40px; }

/* Category Tabs */
.category-tabs { display: flex; justify-content: center; gap: 12px; margin-bottom: 40px; flex-wrap: wrap; }
.category-tabs .tab {
    padding: 8px 22px; border: 2px solid #e0e0e0; border-radius: 30px;
    background: #fff; cursor: pointer; font-size: 14px; font-weight: 500;
    transition: all 0.3s; text-decoration: none; color: #555;
}
.category-tabs .tab:hover, .category-tabs .tab.active { border-color: var(--primary-color); background: var(--primary-color); color: #fff; }

/* Product Cards */
.products-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 30px; }
.product-card {
    background: #fff; border-radius: 12px; overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06); transition: transform 0.3s, box-shadow 0.3s;
}
.product-card:hover { transform: translateY(-4px); box-shadow: 0 8px 30px rgba(0,0,0,0.12); }
.card-img-link { display: block; }
.card-img { width: 100%; height: 240px; background: #f0f4f0; display: flex; align-items: center; justify-content: center; color: #999; overflow: hidden; }
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.card-body { padding: 20px; }
.card-body h3 { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.card-body h3 a { color: #1a1a2e; text-decoration: none; }
.card-body h3 a:hover { color: var(--primary-color); }
.price-row { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.price-current { font-size: 20px; font-weight: 700; color: var(--primary-color); }
.price-original { font-size: 14px; color: #999; text-decoration: line-through; }
.btn-add {
    width: 100%; padding: 10px; background: var(--primary-color); color: #fff; border: none;
    border-radius: 6px; font-size: 14px; font-weight: 600; cursor: pointer; transition: background 0.3s;
}
.btn-add:hover { opacity: 0.85; }

/* ---------- Shop Page ---------- */
.shop-section { max-width: 1200px; margin: 0 auto; padding: 40px; }
.shop-layout { display: grid; grid-template-columns: 240px 1fr; gap: 40px; }
.shop-sidebar {}
.sidebar-block { margin-bottom: 30px; }
.sidebar-block h4 { font-size: 16px; font-weight: 600; margin-bottom: 12px; }
.search-form { display: flex; gap: 8px; }
.btn-search { background: var(--primary-color); color: #fff; border: none; border-radius: 6px; padding: 8px 12px; cursor: pointer; }
.category-list { list-style: none; padding: 0; }
.category-list li { margin-bottom: 8px; }
.category-list a { text-decoration: none; color: #555; font-size: 14px; }
.category-list a.active, .category-list a:hover { color: var(--primary-color); font-weight: 600; }

/* Mobile Filter Bar */
.mobile-filter-bar { display: none; }

/* Shop Pagination */
.shop-pagination { display: flex; justify-content: center; gap: 6px; margin-top: 40px; flex-wrap: wrap; }
.shop-pagination .page-btn {
    display: inline-block; padding: 8px 14px; border: 1px solid #ddd; border-radius: 6px;
    text-decoration: none; color: #555; font-size: 14px; transition: all 0.2s;
}
.shop-pagination .page-btn:hover { border-color: var(--primary-color); color: var(--primary-color); }
.shop-pagination .page-btn.active { background: var(--primary-color); color: #fff; border-color: var(--primary-color); }

/* ---------- Product Detail ---------- */
.product-detail-section { max-width: 1200px; margin: 0 auto; padding: 40px; }
.product-detail-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 60px; margin-bottom: 60px; }
.main-image img, .no-image { width: 100%; border-radius: 12px; }
.no-image { height: 400px; background: #f0f4f0; display: flex; align-items: center; justify-content: center; border-radius: 12px; color: #999; }
.thumb-list { display: flex; gap: 10px; margin-top: 12px; }
.thumb-img { width: 60px; height: 60px; object-fit: cover; border-radius: 6px; cursor: pointer; border: 2px solid transparent; }
.thumb-img:hover { border-color: var(--primary-color); }
.product-title { font-size: 28px; font-weight: 700; margin-bottom: 12px; }
.product-tags { margin-bottom: 16px; }
.tag { display: inline-block; padding: 4px 12px; background: #f0f4f0; border-radius: 20px; font-size: 12px; color: #555; margin-right: 8px; }
.product-price { margin-bottom: 20px; }
.product-price .price-current { font-size: 28px; }
.product-price .price-original { font-size: 18px; }
.product-meta { margin-bottom: 20px; color: #666; font-size: 14px; }
.quantity-selector { margin-bottom: 24px; }
.quantity-selector label { display: block; margin-bottom: 8px; font-weight: 600; }
.qty-controls { display: flex; align-items: center; gap: 0; }
.qty-btn { width: 36px; height: 36px; border: 1px solid #ddd; background: #f8f9fa; cursor: pointer; font-size: 18px; }
.qty-input { width: 50px; height: 36px; text-align: center; border: 1px solid #ddd; border-left: none; border-right: none; }
.product-actions { display: flex; gap: 12px; margin-bottom: 24px; }
.btn-add-cart { flex: 1; padding: 12px; background: #fff; color: var(--primary-color); border: 2px solid var(--primary-color); border-radius: 6px; font-size: 15px; font-weight: 600; cursor: pointer; }
.btn-buy-now { flex: 1; padding: 12px; background: var(--primary-color); color: #fff; border: none; border-radius: 6px; font-size: 15px; font-weight: 600; cursor: pointer; }
.payment-methods { padding-top: 20px; border-top: 1px solid #eee; }
.payment-methods p { font-size: 13px; color: #666; margin-bottom: 8px; }
.payment-icons { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.payment-img { height: 56px; }
.product-description { border-top: 1px solid #eee; padding-top: 40px; }
.product-description h3 { font-size: 20px; margin-bottom: 16px; }
.desc-content { line-height: 1.8; color: #555; }

/* ---------- Cart ---------- */
.cart-section { max-width: 1000px; margin: 0 auto; padding: 40px; }
.cart-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.cart-table th { text-align: left; padding: 12px; border-bottom: 2px solid #eee; font-size: 14px; color: #666; }
.cart-table td { padding: 16px 12px; border-bottom: 1px solid #f0f0f0; vertical-align: middle; overflow: hidden; }
.cart-product-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cart-product-cell img { width: 50px; height: 50px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.cart-product-cell span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cart-summary { margin-top: 30px; text-align: right; }
.cart-total { font-size: 20px; font-weight: 700; margin-bottom: 20px; }
.total-amount { color: var(--primary-color); margin-left: 12px; }
.cart-actions { display: flex; justify-content: flex-end; gap: 12px; }
.btn-continue { padding: 12px 24px; border: 2px solid #ddd; border-radius: 6px; text-decoration: none; color: #333; font-weight: 600; }
.btn-checkout { padding: 12px 24px; background: var(--primary-color); color: #fff; border-radius: 6px; text-decoration: none; font-weight: 600; }

/* ---------- Checkout ---------- */
.checkout-section { max-width: 1100px; margin: 0 auto; padding: 40px; }
.checkout-layout { display: grid; grid-template-columns: 1.4fr 1fr; gap: 50px; }
.checkout-form h3, .checkout-summary h3 { font-size: 20px; margin-bottom: 24px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.form-group { margin-bottom: 16px; }
.form-group.full-width { grid-column: 1 / -1; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: #555; margin-bottom: 6px; }
.form-control { width: 100%; padding: 10px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; }
.form-control:focus { outline: none; border-color: var(--primary-color); }
.checkbox-label { font-size: 13px; color: #555; cursor: pointer; display: flex; align-items: flex-start; gap: 8px; }
.checkbox-label input { margin-top: 2px; }
.checkbox-label a { color: var(--primary-color); }
.order-items { border-bottom: 1px solid #eee; padding-bottom: 16px; margin-bottom: 16px; }
.order-total { display: flex; justify-content: space-between; font-size: 18px; font-weight: 700; margin-bottom: 24px; }
.agreement-check { margin-bottom: 20px; }
.btn-pay { width: 100%; padding: 14px; background: var(--primary-color); color: #fff; border: none; border-radius: 6px; font-size: 16px; font-weight: 700; cursor: pointer; }
.btn-pay:hover { opacity: 0.9; }
.btn-link-create { width: 100%; padding: 14px; background: #fff; color: var(--primary-color); border: 2px solid var(--primary-color); border-radius: 6px; font-size: 15px; font-weight: 600; cursor: pointer; margin-top: 10px; }
.btn-link-create:hover { background: var(--primary-color); color: #fff; }

/* ---------- Auth Pages ---------- */
.auth-section { max-width: 1200px; margin: 0 auto; padding: 60px 40px; display: flex; justify-content: center; }
.auth-card { width: 400px; background: #fff; padding: 40px; border-radius: 12px; box-shadow: 0 4px 20px rgba(0,0,0,0.08); }
.auth-card-wide { width: 600px; }
.auth-card h2 { font-size: 24px; margin-bottom: 24px; text-align: center; }
.btn-auth { width: 100%; padding: 12px; background: var(--primary-color); color: #fff; border: none; border-radius: 6px; font-size: 15px; font-weight: 600; cursor: pointer; margin-top: 8px; }
.auth-links { text-align: center; margin-top: 16px; }
.auth-links a { color: var(--primary-color); font-size: 14px; }
.alert-error { background: #ffe6e6; color: #c0392b; padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; font-size: 14px; }

/* ---------- Orders ---------- */
.orders-section { max-width: 1000px; margin: 0 auto; padding: 40px; }
.orders-table { width: 100%; border-collapse: collapse; }
.orders-table th { text-align: left; padding: 12px; border-bottom: 2px solid #eee; }
.orders-table td { padding: 14px 12px; border-bottom: 1px solid #f0f0f0; }
.status-pending { color: #f39c12; font-weight: 600; }
.status-paid { color: #27ae60; font-weight: 600; }
.status-cancelled { color: #999; }
.status-refunded { color: #e74c3c; }

/* ---------- Agreement ---------- */
.agreement-section { max-width: 800px; margin: 0 auto; padding: 40px; }
.agreement-content { line-height: 1.8; color: #444; }

/* ---------- Empty State ---------- */
.empty-state { text-align: center; padding: 60px 20px; color: #999; }
.empty-state p { margin: 16px 0; font-size: 16px; }

/* ---------- Footer ---------- */
.footer { background: #1a1a2e; color: #ccc; padding: 60px 40px 30px; }
.footer-grid { max-width: 1200px; margin: 0 auto; display: grid; gap: 40px; margin-bottom: 40px; }
.footer-cols-1 { grid-template-columns: 1fr; }
.footer-cols-2 { grid-template-columns: 1fr 1fr; }
.footer-cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.footer-cols-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }
.footer-column {}
.footer h4 { color: #fff; font-size: 16px; margin-bottom: 16px; }
.footer p, .footer a { font-size: 14px; color: #aaa; line-height: 2; text-decoration: none; display: block; }
.footer p i, .footer a i { margin-right: 6px; }
.footer a:hover { color: #fff; }
.footer-bottom { max-width: 1200px; margin: 0 auto; border-top: 1px solid #333; padding-top: 20px; text-align: center; font-size: 13px; color: #666; }

/* ---------- Back to Top ---------- */
.back-to-top {
    position: fixed; bottom: 30px; right: 30px; width: 44px; height: 44px;
    background: var(--primary-color); color: #fff; border: none; border-radius: 50%;
    font-size: 18px; cursor: pointer; display: none; align-items: center;
    justify-content: center; box-shadow: 0 4px 12px rgba(0,0,0,0.2); z-index: 999;
}
.back-to-top.visible { display: flex; }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .navbar-shop { padding: 12px 20px; }
    .hero-overlay h1 { font-size: 28px; }
    .hero-overlay p { font-size: 15px; }
    .products-section { padding: 50px 20px; }
    .products-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
    .card-img { height: 180px; }
    .shop-layout { grid-template-columns: 1fr; }
    .shop-sidebar { display: none; }
    .mobile-filter-bar {
        display: block; padding: 0 20px 16px; margin-top: -10px;
    }
    .mobile-search-form { display: flex; gap: 8px; margin-bottom: 10px; }
    .mobile-search-form .form-control { flex: 1; padding: 8px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; }
    .mobile-search-form .btn-search { padding: 8px 14px; }
    .mobile-filter-selects { display: flex; gap: 8px; }
    .mobile-filter-selects .form-control { flex: 1; padding: 8px; border: 1px solid #ddd; border-radius: 6px; font-size: 13px; }
    .product-detail-layout { grid-template-columns: 1fr; gap: 30px; }
    .checkout-layout { grid-template-columns: 1fr; }
    .footer-grid { grid-template-columns: 1fr 1fr !important; }
    .footer { padding: 40px 20px 20px; }
    /* Cart responsive */
    .cart-section { padding: 20px; }
    .cart-table { table-layout: auto; }
    .cart-table thead { display: none; }
    .cart-table, .cart-table tbody { display: block; width: 100%; }
    .cart-table tr { display: flex; flex-wrap: wrap; align-items: center; margin-bottom: 16px; padding: 16px; border: 1px solid #eee; border-radius: 8px; position: relative; box-sizing: border-box; }
    .cart-table td { display: block; padding: 0; border-bottom: none; box-sizing: border-box; }
    /* 第1列：商品图+名称，占满宽度减去删除按钮 */
    .cart-table td:nth-child(1) { width: calc(100% - 36px); }
    /* 第5列：删除按钮，固定右侧 */
    .cart-table td:nth-child(5) { position: absolute; top: 16px; right: 12px; width: 30px; }
    /* 第2/3/4列：价格、数量、小计 - 等宽排列 */
    .cart-table td:nth-child(2),
    .cart-table td:nth-child(3),
    .cart-table td:nth-child(4) { width: 33.33%; margin-top: 12px; font-size: 14px; color: #555; }
    .cart-table td:nth-child(2)::before { content: 'Price: '; font-weight: 600; color: #999; font-size: 12px; display: block; }
    .cart-table td:nth-child(3)::before { content: 'Qty: '; font-weight: 600; color: #999; font-size: 12px; display: block; }
    .cart-table td:nth-child(4)::before { content: 'Subtotal: '; font-weight: 600; color: #999; font-size: 12px; display: block; }
    .cart-table td:nth-child(4) { font-weight: 700; color: var(--primary-color); }
    .cart-product-cell { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .cart-product-cell span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .cart-actions { flex-direction: column; align-items: stretch; }
    .btn-continue, .btn-checkout { text-align: center; }
}
@media (max-width: 480px) {
    .hero-overlay h1 { font-size: 24px; }
    .products-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .footer-grid { grid-template-columns: 1fr !important; }
}
