/* ========== Step 1: Base reset ========== */
* {
    box-sizing: border-box;
}

:root {
    --container-max: 1300px;
    --container-pad: 8px;

    --banner-h: 260px;
    --banner-radius: 18px;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #fff;
    color: #111;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

.container {
    max-width: var(--container-max);
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--container-pad);
    padding-right: var(--container-pad);
}

/* ========== Step 2: Header layout ========== */
.site-header {
    background: #fff;
    border-bottom: 1px solid #eee;
}

.header-inner {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 12px var(--container-pad);

    display: flex;
    align-items: center;
    gap: 16px;
}

.brand {
    font-weight: 800;
    font-size: 22px;
}

.search {
    flex: 1;
    display: flex;
    gap: 8px;
}

.search input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 999px;
}

.search button {
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
}

/* Cart button */
.cart-btn {
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 10px;
    padding: 10px 12px;
    cursor: pointer;
    position: relative;
    line-height: 1;
}

.cart-badge {
    display: inline-block;
    margin-left: 6px;
    min-width: 18px;
    height: 18px;
    padding: 0 6px;
    border-radius: 999px;
    background: #111;
    color: #fff;
    font-size: 12px;
    line-height: 18px;
    text-align: center;
}

/* ========== Step 3: Main navigation (horizontal) ========== */
.main-nav {
    border-top: 1px solid #f5f5f5;
}

.main-nav ul {
    list-style: none;
    margin: 0 auto;
    padding: 10px var(--container-pad);
    max-width: var(--container-max);

    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
}

.main-nav a {
    padding: 8px 14px;
    border-radius: 999px;
}

.main-nav a:hover,
.main-nav a.active {
    background: #f4f4f4;
}

/* ========== Step 4: Hover shopping list (cart dropdown) ========== */
.cart {
    margin-left: 5px;
    position: relative;
}

.cart-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);

    width: 320px;
    padding: 12px;

    background: #fff;
    border: 1px solid #eee;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);

    display: none;
    z-index: 999;
}

.cart.open .cart-panel {
    display: block;
}



.cart-title {
    font-weight: 700;
    margin-bottom: 10px;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-top: 1px solid #f2f2f2;
}

.cart-item:first-of-type {
    border-top: 0;
}

.cart-item-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cart-item input {
    width: 70px;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 8px;
}

.checkout-btn {
    width: 100%;
    margin-top: 10px;
    padding: 10px 12px;
    border: 0;
    border-radius: 10px;
    background: #111;
    color: #fff;
    cursor: pointer;
}

.cart-note {
    margin: 8px 0 0;
    font-size: 12px;
    color: #666;
}

/* ========== Step 5: Banner / Carousel ========== */
.banner {
    position: relative;
    max-width: var(--container-max);
    margin: 12px auto 0;
    padding: 0 var(--container-pad);
}

.banner-track {
    border-radius: var(--banner-radius);
    overflow: hidden;

    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;

    scrollbar-width: none;
}

.banner-track::-webkit-scrollbar {
    display: none;
}

.banner-slide {
    flex: 0 0 100%;
    scroll-snap-align: start;
    position: relative;

    min-height: var(--banner-h);
    background: #f5f5f5;
}

.banner-slide img {
    width: 100%;
    height: var(--banner-h);
    object-fit: cover;
    display: block;
}

.banner-text {
    position: absolute;
    left: 16px;
    bottom: 16px;

    max-width: 520px;
    padding: 14px 16px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(6px);
}

.banner-text h1 {
    margin: 0 0 6px;
    font-size: 28px;
    line-height: 1.12;
}

.banner-text p {
    margin: 0 0 10px;
    color: #333;
}

.banner-cta {
    display: inline-block;
    padding: 9px 12px;
    border-radius: 10px;
    background: #111;
    color: #fff;
}

.banner-controls {
    position: absolute;
    right: calc(var(--container-pad) + 14px);
    bottom: 16px;
    display: flex;
    gap: 10px;
    z-index: 5;
}

.banner-btn {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 999px;

    background: rgba(255, 255, 255, 0.92);
    border: 1px solid #e8e8e8;
    font-size: 20px;
    cursor: pointer;
}

button.banner-btn {
    padding: 0;
    appearance: none;
    -webkit-appearance: none;
    font: inherit;
    color: inherit;
}

/* ========== Breadcrumb ========== */
.breadcrumb {
    max-width: var(--container-max);
    margin: 10px auto 0;
    padding: 0 var(--container-pad);
    color: #666;
    font-size: 14px;

    display: flex;
    align-items: center;
    gap: 8px;
}

.breadcrumb .sep {
    color: #aaa;
}

/* ========== Round Categories ========== */
.round-categories {
    max-width: var(--container-max);
    margin: 22px auto 0;
    padding: 0 var(--container-pad);
}

.section-title {
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 16px;
}

.cat-list {
    list-style: none;
    margin: 0;
    padding: 0;

    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 30px;

    flex-wrap: wrap;
    overflow: visible;
}

@media (max-width: 760px) {
    .cat-list {
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .cat-list::-webkit-scrollbar {
        display: none;
    }
}

.cat-list::-webkit-scrollbar {
    display: none;
}

.cat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;

    min-width: 80px;
    padding: 8px 6px;
    border-radius: 14px;
}

.cat:hover {
    background: #f4f4f4;
}

.cat img {
    width: 70px;
    height: 70px;
    border-radius: 999px;
    object-fit: cover;
    border: 1px solid #eee;
    background: #fafafa;
}

.cat span {
    font-size: 14px;
    font-weight: 700;
}

/* ========== Side promo cards (left & right of categories) ========== */
.home-highlights {
    max-width: var(--container-max);
    margin: 18px auto 0;
    padding: 0 var(--container-pad);

    display: grid;
    grid-template-columns: 320px minmax(0, 1fr) 320px;
    gap: 18px;
    align-items: start;
}

.promo-card {
    border: 1px solid #eee;
    border-radius: 16px;
    background: #fafafa;
    padding: 14px 16px;

    min-height: 140px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.promo-card h3 {
    margin: 0 0 8px;
    font-size: 18px;
}

.promo-card p {
    margin: 0 0 10px;
    color: #555;
    font-size: 14px;
    line-height: 1.45;
}

.promo-link {
    font-weight: 700;
}

/* ========== Products ========== */
.products {
    max-width: var(--container-max);
    margin: 26px auto 0;
    padding: 0 var(--container-pad);
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.product-card {
    border: 1px solid #eee;
    border-radius: 16px;
    overflow: hidden;
    background: #fff;
    padding: 12px;
}

.product-link h3 {
    margin: 10px 0 6px;
    font-size: 16px;
}

.product-price {
    margin: 0 0 10px;
    color: #333;
    font-weight: 700;
}

.add-btn {
    width: 100%;
    padding: 10px 12px;
    border: 0;
    border-radius: 12px;
    background: #111;
    color: #fff;
    cursor: pointer;
}

/* ========== Footer ========== */
.site-footer {
    border-top: 1px solid #eee;
    margin-top: 40px;
    padding: 20px 0;
}

.footer-inner {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--container-pad);

    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    color: #666;
}

.footer-inner nav {
    display: flex;
    gap: 14px;
}

/* ========== Responsive ========== */
@media (max-width: 980px) {
    :root {
        --banner-h: 220px;
        --container-pad: 12px;
    }

    .product-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }


    .home-highlights {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 520px) {
    .product-grid {
        grid-template-columns: 1fr;
    }

    .search button {
        display: none;
    }
}

@media (max-width: 760px) {
    .cat-list {
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .cat-list::-webkit-scrollbar {
        display: none;
    }
}

@media (hover: hover) and (pointer: fine) {
    .cart:hover .cart-panel {
        display: block;
    }
}

@media (hover: hover) and (pointer: fine) {
    .cart::after {
        content: "";
        position: absolute;
        left: 0;
        right: 0;
        top: 100%;
        height: 10px;
        /* 覆盖按钮和面板之间的空隙(8px) */
    }
}

/* ========== Product page layout ========== */
.product-page {
    max-width: var(--container-max, 1100px);
    margin: 14px auto 40px;
    padding: 0 var(--container-pad, 16px);

    display: grid;
    grid-template-columns: 560px 1fr 320px;
    gap: 22px;
    align-items: start;
}

.product-page>* {
    min-width: 0;
}

/* Responsive */
@media (max-width: 1100px) {
    .product-page {
        grid-template-columns: 1fr;
    }
}

/* ========== Gallery (Main + Thumbs under) ========== */
.product-gallery {
    display: flex;
    flex-direction: row;
    position: relative;
    z-index: 5;
    gap: 12px;
    align-items: flex-start;
}

.product-main {
    width: 100%;
    flex: 1;
    aspect-ratio: 3 / 4;
    border: 1px solid #eee;
    border-radius: 16px;
    background: #fafafa;
    overflow: hidden;
    position: relative;
    z-index: 1;
    min-width: 0;

}

.product-main .swiper-slide {
    display: grid;
    place-items: center;
}

.product-main img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

/* Thumbs row */
.swiper.product-thumbs {
    width: 96px !important;
    flex: 0 0 96px !important;
    margin-top: 0 !important;
    order: -1;
    box-sizing: border-box;
    position: relative;
    position: relative;
    z-index: 10;
    max-height: 560px;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    overscroll-behavior: contain;
    padding-right: 2px;
}

.product-thumbs .swiper-slide {
    width: 100% !important;
    height: 128px !important;
    border-radius: 12px;
    overflow: hidden;

    border: 1px solid #eee;
    background: #fff;
    overflow: hidden;
    opacity: 0.7;
    cursor: pointer;

    display: grid;
    place-items: center;
}

.product-thumbs .swiper-wrapper {
    display: flex;
    justify-content: flex-start;
    flex-direction: column;
    gap: 10px;
}

.product-thumbs .swiper-slide-thumb-active {
    opacity: 1;
    border-color: #bbb;
}

.product-thumbs img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.product-main .swiper-button-prev,
.product-main .swiper-button-next {
    width: 40px;
    height: 40px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid #e8e8e8;
    z-index: 2;
}

.product-main .swiper-button-prev::after,
.product-main .swiper-button-next::after {
    font-size: 18px;
    color: #111;
}

/* ========== Middle info ========== */
.product-title {
    margin: 0 0 10px;
    font-size: 28px;
    line-height: 1.15;
}

.product-desc {
    margin: 0 0 14px;
    color: #444;
    line-height: 1.6;
}

.product-details {
    border-top: 1px solid #eee;
    padding-top: 14px;
}

.product-details h3 {
    margin: 0 0 10px;
    font-size: 16px;
}

.product-details ul {
    margin: 0;
    padding-left: 18px;
    color: #333;
    line-height: 1.7;
}

/* ========== Buy box ========== */
.buy-box {
    border: 1px solid #eee;
    border-radius: 16px;
    background: #fafafa;
    padding: 16px;
}

.product-price-big {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 8px;
}

.buy-note {
    margin: 0 0 14px;
    color: #666;
    font-size: 13px;
}

.add-btn-lg {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
}

.buy-meta {
    margin-top: 14px;
    color: #444;
    font-size: 14px;
    line-height: 1.6;
}

@media (max-width: 768px) {
    .product-gallery {
        flex-direction: column;
    }

    .product-thumbs {
        width: 100%;
    }

    .product-thumbs .swiper-wrapper {
        display: flex;
        flex-direction: row;
    }
}

/* ===== Phase 3 Cart UI Polish ===== */

.cart-empty {
    padding: 40px 0;
    text-align: center;
    font-size: 14px;
    letter-spacing: 1px;
    color: #888;
    font-weight: 400;
}

.cart-empty::before {
    content: "🛍";
    display: block;
    font-size: 28px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.cart-summary {
    border-top: 1px solid #eee;
    padding-top: 16px;
    margin-top: 16px;
}

.cart-total {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    letter-spacing: 1px;
    font-weight: 500;
}

#cartTotal {
    font-weight: 600;
    font-size: 15px;
}

.checkout-btn {
    margin-top: 14px;
    width: 100%;
    padding: 12px 0;
    background: #111;
    color: #fff;
    border: none;
    font-size: 13px;
    letter-spacing: 1px;
    cursor: pointer;
    transition: 0.2s ease;
}

.checkout-btn:hover {
    background: #333;
}

/* ===== Premium Add to Cart Button ===== */

.add-to-cart {
    width: 100%;
    padding: 14px 0;
    margin-top: 14px;

    background: #111;
    color: #fff;

    border: none;
    border-radius: 10px;

    font-size: 15px;
    letter-spacing: 1.5px;
    font-weight: 600;

    cursor: pointer;
    transition: all 0.25s ease;
}

/* Hover effect */
.add-to-cart:hover {
    background: #333;
    transform: translateY(-1px);
}

/* Click effect */
.add-to-cart:active {
    transform: translateY(0);
    background: #000;
}

/* Disabled state */
.add-to-cart:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.cat-actions {
    display: flex;
    justify-content: center;
    margin-top: 10px;
}

.cat-clear {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    min-width: 100px;
    font-size: 14px;
    font-weight: 700;
    color: #111;
    text-decoration: none;
    padding: 6px 10px;
    border-radius: 14px;
}

.cat-clear:hover {
    background: #f4f4f4;
}

.user-entry {
    display: flex;
    align-items: center;
    margin-left: 5px;
}

.user-entry-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 10px;
    background: #fff;
    color: #111;
    text-decoration: none;
    cursor: pointer;
    line-height: 1;
    font-size: 14px;
    font-weight: 400;
    box-sizing: border-box;
    white-space: nowrap;
}

.user-entry-link:hover {
    background: #fff;
}

.admin-top-links {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 16px;
}

.admin-home-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 10px;
    background: #fff;
    color: #111;
    text-decoration: none;
    line-height: 1;
}

.admin-home-link:hover {
    background: #f7f7f7;
}

.user-entry {
    position: relative;
    display: flex;
    align-items: center;
    margin-left: 8px;
}

.user-entry-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 10px;
    background: #fff;
    color: #111;
    text-decoration: none;
    cursor: pointer;
    line-height: 1;
    font-size: 14px;
    font-weight: 400;
    box-sizing: border-box;
    white-space: nowrap;
}

.user-entry-link:hover {
    background: #f7f7f7;
}

.user-menu-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 220px;
    background: #fff;
    border: 1px solid #e6e6e6;
    border-radius: 18px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.10);
    padding: 16px;
    z-index: 120;
    display: none;
}

.user-entry.open .user-menu-panel {
    display: block;
}

.user-menu-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 14px;
    color: #111;
}

.user-menu-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.user-menu-action {
    width: 100%;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 12px;
    padding: 12px 14px;
    text-align: left;
    font: inherit;
    cursor: pointer;
    color: #111;
}

.user-menu-action:hover {
    background: #f7f7f7;
}

.user-menu-action.danger {
    color: #b42318;
}