/* =========================================================
   TABACOO 猫灰 - 主样式文件
   适用于：首页、购物车侧栏、通用导航、商品卡片
   ========================================================= */

/* ---------- 基础重置 ---------- */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: Arial, "Microsoft YaHei", sans-serif;
    background: #f5f5f5;
    color: #222;
}

button,
input {
    font: inherit;
}

button {
    border: none;
}

body.cart-open {
    overflow: hidden;
}

/* ---------- 顶部导航 ---------- */

.site-header {
    min-height: 76px;
    background: #111;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 0 36px;
    position: sticky;
    top: 0;
    z-index: 1000;
    overflow: hidden;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    width: auto;
    min-width: 0;
    color: #fff;
    text-decoration: none;
    flex-shrink: 0;
}

.logo img {
    width: 54px;
    height: 54px;
    min-width: 54px;
    max-width: 54px;
    min-height: 54px;
    max-height: 54px;
    object-fit: cover;
    object-position: center;
    display: block;
    border-radius: 50%;
    background: #fff;
}

.logo-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    line-height: 1.05;
}

.logo-text span {
    color: #fff;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 2px;
}

.logo-text small {
    color: #d7b66d;
    font-size: 13px;
    font-weight: bold;
    margin-top: 4px;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 25px;
}

.main-nav a,
.cart-nav-button {
    color: #fff;
    text-decoration: none;
    font-size: 15px;
    background: transparent;
    cursor: pointer;
    white-space: nowrap;
}

.main-nav a:hover,
.cart-nav-button:hover {
    color: #d7b66d;
}

.cart-nav-button {
    display: flex;
    align-items: center;
    gap: 7px;
}

.cart-count {
    min-width: 21px;
    height: 21px;
    border-radius: 50%;
    background: #d7b66d;
    color: #111;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    font-size: 12px;
    font-weight: bold;
}

/* ---------- 首页 Banner ---------- */

.hero {
    width: 100%;
    aspect-ratio: 1547 / 651;
    min-height: 0;
    background-image:
        linear-gradient(rgba(0, 0, 0, 0.28), rgba(0, 0, 0, 0.28)),
        url("../images/banner/banner.png");
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 30px clamp(36px, 7vw, 120px);
    color: #fff;
    text-align: left;
    overflow: hidden;
}

.hero-content {
    width: 100%;
    max-width: 560px;
    margin-right: auto;
}

.hero-label,
.hero-small-title {
    color: #d7b66d;
    letter-spacing: 4px;
    font-size: 13px;
    font-weight: bold;
    margin-bottom: 18px;
}

.hero h1 {
    color: #fff;
    font-size: 52px;
    line-height: 1.25;
    margin-bottom: 20px;
}

.hero-content > p:not(.hero-label):not(.hero-small-title) {
    color: #fff;
    font-size: 18px;
    line-height: 1.8;
    margin-bottom: 28px;
}

.hero-buttons {
    display: flex;
    justify-content: flex-start;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.hero-buttons button,
.hero-secondary-button,
.hero-button {
    min-width: 150px;
    padding: 14px 25px;
    border-radius: 6px;
    font-size: 15px;
    font-weight: bold;
    text-decoration: none;
    cursor: pointer;
    transition: 0.2s;
}

.hero-buttons button,
.hero-button {
    background: #d7b66d;
    color: #111;
}

.hero-buttons button:hover,
.hero-button:hover {
    background: #efcc7c;
    transform: translateY(-2px);
}

.hero-secondary-button {
    background: rgba(0, 0, 0, 0.18);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.8);
}

.hero-secondary-button:hover {
    border-color: #d7b66d;
    color: #d7b66d;
}

.age-notice {
    color: #ddd;
    font-size: 13px;
}

/* ---------- 通用区域 ---------- */

.section {
    width: min(1200px, calc(100% - 40px));
    margin: 0 auto;
    padding: 65px 0;
}

.section-title {
    text-align: center;
    font-size: 32px;
    margin-bottom: 35px;
}

.section-label {
    font-size: 12px;
    letter-spacing: 3px;
    color: #947936;
    margin-bottom: 8px;
}

.left-title {
    text-align: left;
    margin-bottom: 0;
}

/* ---------- 分类 ---------- */

.categories {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.category {
    background: #fff;
    color: #222;
    padding: 34px 20px;
    text-align: center;
    border-radius: 12px;
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    transition: 0.2s;
}

.category:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}

.category span {
    font-size: 42px;
    display: block;
    margin-bottom: 15px;
}

.category h3 {
    font-size: 17px;
}

.category p {
    color: #777;
    font-size: 13px;
    line-height: 1.6;
    margin-top: 9px;
}

/* ---------- 商品标题与搜索 ---------- */

.products-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 25px;
    margin-bottom: 35px;
}

.search-box {
    width: min(100%, 340px);
}

.search-box input {
    width: 100%;
    height: 46px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 8px;
    padding: 0 15px;
    outline: none;
}

.search-box input:focus {
    border-color: #111;
}

/* ---------- 商品卡片 ---------- */

.products {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 22px;
}

.card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.08);
    transition: 0.2s;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.13);
}

.card-image-box {
    position: relative;
    overflow: hidden;
}

.card img {
    width: 100%;
    height: 230px;
    object-fit: cover;
    display: block;
    transition: 0.3s;
}

.card:hover img {
    transform: scale(1.04);
}

.product-tag {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(17, 17, 17, 0.9);
    color: #fff;
    padding: 6px 9px;
    border-radius: 4px;
    font-size: 12px;
}

.card-content {
    padding: 18px;
}

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

.product-description {
    color: #777;
    font-size: 13px;
    line-height: 1.6;
    min-height: 42px;
    margin-bottom: 12px;
}

.price {
    font-size: 21px;
    font-weight: bold;
    margin-bottom: 15px;
}

.card button {
    width: 100%;
    background: #111;
    color: #fff;
    padding: 12px;
    cursor: pointer;
    border-radius: 5px;
    transition: 0.2s;
}

.card button:hover {
    background: #d7b66d;
    color: #111;
}

.empty-message {
    display: none;
    text-align: center;
    padding: 50px 20px;
    color: #777;
}

/* ---------- 提示区域 ---------- */

.notice {
    background: #111;
    color: #fff;
    text-align: center;
    padding: 55px 20px;
}

.notice h2 {
    margin-bottom: 12px;
}

.notice p {
    color: #bbb;
}

footer {
    background: #222;
    color: #aaa;
    text-align: center;
    padding: 25px;
    font-size: 14px;
}

/* ---------- 购物车遮罩 ---------- */

.cart-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.48);
    z-index: 1998;
    opacity: 0;
    visibility: hidden;
    transition: 0.25s;
}

.cart-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* ---------- 购物车侧边栏 ---------- */

.cart-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: min(430px, 100%);
    height: 100vh;
    background: #fff;
    z-index: 1999;
    transform: translateX(100%);
    transition: 0.3s;
    display: flex;
    flex-direction: column;
    box-shadow: -12px 0 30px rgba(0, 0, 0, 0.2);
}

.cart-panel.open {
    transform: translateX(0);
}

.cart-header {
    padding: 25px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-small-title {
    font-size: 11px;
    letter-spacing: 2px;
    color: #947936;
    margin-bottom: 5px;
}

.close-cart-button {
    width: 38px;
    height: 38px;
    background: #f1f1f1;
    border-radius: 50%;
    font-size: 25px;
    cursor: pointer;
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.empty-cart {
    height: 100%;
    min-height: 250px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #777;
    text-align: center;
}

.empty-cart-icon {
    font-size: 50px;
    margin-bottom: 12px;
}

.cart-item {
    display: grid;
    grid-template-columns: 78px 1fr;
    gap: 13px;
    padding: 14px 0;
    border-bottom: 1px solid #eee;
}

.cart-item img {
    width: 78px;
    height: 78px;
    object-fit: cover;
    border-radius: 8px;
}

.cart-item-name {
    font-weight: bold;
    margin-bottom: 6px;
}

.cart-item-price {
    color: #8a6d2c;
    margin-bottom: 10px;
}

.cart-item-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.quantity-box {
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 5px;
    overflow: hidden;
}

.quantity-box button {
    width: 31px;
    height: 30px;
    cursor: pointer;
    background: #f3f3f3;
}

.quantity-box span {
    min-width: 34px;
    text-align: center;
    font-size: 14px;
}

.remove-button {
    background: transparent;
    color: #b3261e;
    cursor: pointer;
    font-size: 13px;
}

.cart-bottom {
    border-top: 1px solid #eee;
    padding: 22px;
    background: #fff;
}

.cart-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 17px;
    font-size: 18px;
}

.cart-total-row strong {
    font-size: 23px;
}

.checkout-button {
    width: 100%;
    background: #111;
    color: #fff;
    padding: 14px;
    cursor: pointer;
    border-radius: 6px;
    margin-bottom: 10px;
}

.checkout-button:hover {
    background: #d7b66d;
    color: #111;
}

.clear-cart-button {
    width: 100%;
    background: #eee;
    color: #333;
    padding: 11px;
    cursor: pointer;
    border-radius: 6px;
}

/* ---------- 底部提示 ---------- */

.toast {
    position: fixed;
    left: 50%;
    bottom: 30px;
    transform: translate(-50%, 30px);
    background: #111;
    color: #fff;
    padding: 12px 20px;
    border-radius: 7px;
    z-index: 3000;
    opacity: 0;
    visibility: hidden;
    transition: 0.25s;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
}

.toast.show {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
}

/* ---------- 平板 ---------- */

@media (max-width: 900px) {
    .site-header {
        padding: 0 22px;
    }

    .categories,
    .products {
        grid-template-columns: repeat(2, 1fr);
    }

    .hero h1 {
        font-size: 42px;
    }

    .main-nav {
        gap: 14px;
    }
}

/* ---------- 手机 ---------- */

@media (max-width: 700px) {
    .site-header {
        min-height: 70px;
        height: auto;
        padding: 10px 15px;
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
    }

    .logo img {
        width: 48px;
        height: 48px;
        min-width: 48px;
        max-width: 48px;
        min-height: 48px;
        max-height: 48px;
    }

    .logo-text span {
        font-size: 16px;
    }

    .logo-text small {
        font-size: 11px;
    }

    .main-nav {
        width: 100%;
        gap: 15px;
        overflow-x: auto;
        padding-bottom: 4px;
    }

    .main-nav a,
    .cart-nav-button {
        white-space: nowrap;
        font-size: 13px;
    }

    .hero {
        aspect-ratio: auto;
        height: 430px;
        min-height: 430px;
        background-size: cover;
        background-position: center;
        padding: 40px 18px;
    }


    .hero {
        justify-content: center;
        text-align: center;
    }

    .hero-content {
        max-width: 800px;
        margin-right: 0;
    }

    .hero-buttons {
        justify-content: center;
    }

    .hero h1 {
        font-size: 34px;
    }

    .hero-content > p:not(.hero-label):not(.hero-small-title) {
        font-size: 15px;
    }

    .hero-buttons {
        flex-direction: column;
        align-items: center;
    }

    .hero-buttons button,
    .hero-secondary-button,
    .hero-button {
        width: min(100%, 260px);
    }

    .section {
        width: min(100% - 28px, 1200px);
        padding: 48px 0;
    }

    .section-title {
        font-size: 27px;
    }

    .categories,
    .products {
        grid-template-columns: 1fr;
    }

    .products-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .search-box {
        width: 100%;
    }

    .card img {
        height: 260px;
    }
}


/* ---------- 商品分类字体微调（桌面端） ---------- */
@media (min-width: 721px) {
    .maohui-sidebar-head h2 { font-size: 25px !important; }
    .maohui-primary b { font-size: 16px !important; }
    .maohui-subnav button { font-size: 14px !important; line-height: 1.45; }
    .maohui-all-btn { font-size: 14px !important; }
}
