/* --- 基础变量 --- */
:root {
    --primary-color: #185A56;        /* 主色：深灰绿 */
    --secondary-color: #FD742D;      /* 辅色：橙橙色 */
    --background-light: #FDF8F4;     /* 浅色背景 */
    --background-dark: #133C38;      /* 深色背景 */
    --text-primary: #2C3E50;         /* 正文文字 */
    --text-secondary: #6B7A90;       /* 次要文字 */
    --border-color: #D9D9D9;         /* 分割线颜色 */
    --success-color: #28A745;        /* 成功状态 */
    --warning-color: #FFC107;        /* 警告状态 */
    --error-color: #DC3545;          /* 错误状态 */
}

/* --- 基础样式 --- */
html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    background-color: var(--background-light);
    color: var(--text-primary);
    font-family: 'Roboto', Arial, sans-serif;
    display: flex;
    flex-direction: column;
    padding-top: calc(2.5rem + 4rem); /* 通知栏高度 + 导航栏高度 */
}

/* 主要内容区域 */
main {
    flex: 1 0 auto;
    width: 100%;
    display: flex;
    flex-direction: column;
}

/* 商品详情页特殊样式 */
body.item-detail-page {
    padding-top: calc(2.5rem + 4rem); /* 保持与其他页面一致 */
}

/* --- 布局组件 --- */
/* 顶部通知栏 */
.notification-bar {
    background-color: var(--primary-color);
    color: white;
    text-align: center;
    padding: 0.5rem 1rem;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    min-height: 2.5rem;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-bar p {
    margin: 0;
    line-height: 1.4;
    font-size: 0.875rem;
    padding: 0.25rem 0;
}

/* 导航栏 */
.navbar {
    background-color: white;
    border-bottom: 1px solid var(--border-color);
    position: fixed;
    top: 2.5rem; /* 通知栏高度 */
    left: 0;
    right: 0;
    z-index: 40;
    box-sizing: border-box;
}

/* 桌面端导航栏 */
@media (min-width: 769px) {
    .navbar {
        padding: 0;
    }

    .navbar .container {
        padding-top: 0;
        padding-bottom: 0;
    }

    .navbar .flex {
        height: 4rem;
    }
}

/* 移动端导航栏 */
@media (max-width: 768px) {
    .navbar {
        padding: 0;
        top: 2.75rem; /* 增加与通知栏的间距 */
    }

    .notification-bar {
        min-height: 2.5rem;
        padding: 0.5rem 1rem;
    }

    .notification-bar p {
        font-size: 0.875rem;
        line-height: 1.4;
        padding: 0.125rem 0;
    }

    .navbar .flex {
        padding: 0.5rem 0;
        height: 3.5rem;
    }

    /* 调整移动端导航栏内容的位置 */
    .navbar .px-4 {
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
    }

    /* 确保Logo和搜索框垂直居中 */
    .navbar .flex.items-center {
        height: 100%;
    }
}

/* 为固定定位的导航栏预留空间 */
body {
    padding-top: calc(2.5rem + 4rem); /* 通知栏高度 + 导航栏高度 */
}

@media (max-width: 768px) {
    body {
        padding-top: calc(2.5rem + 3.5rem + 0.25rem); /* 增加额外的间距 */
    }
}

/* 移动端底部导航栏 */
.fixed.bottom-0 {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: white;
    border-top: 1px solid var(--border-color);
    z-index: 40;
}

/* 页脚 */
.footer {
    background-color: var(--primary-color);
    color: white;
    text-align: center;
    padding: 1rem;
    flex-shrink: 0;
    width: 100%;
    position: relative;
    z-index: 30;
}

/* 移动端页脚样式 */
@media (max-width: 768px) {
    body {
        padding-bottom: 4rem; /* 为底部导航栏预留空间 */
    }

    .fixed.bottom-0 {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background-color: white;
        border-top: 1px solid var(--border-color);
        z-index: 40;
    }

    /* 确保内容区域不会被底部导航栏遮挡 */
    main {
        margin-bottom: 4rem;
    }

    /* 移动端页脚样式 */
    .footer {
        margin-bottom: 4rem; /* 为底部导航栏预留空间 */
        padding-bottom: 2rem;
    }
}

/* --- 通用组件 --- */
/* 按钮基础样式 */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    text-align: center;
    transition: all 0.3s ease;
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
    border: none;
}

/* 主要按钮 */
.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--secondary-color);
    color: white;
}

/* 次要按钮 */
.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: var(--primary-color);
    color: white;
}

/* 轮廓按钮 */
.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline:hover {
    background: var(--primary-color);
    color: white;
}

.btn-outline-secondary {
    background: transparent;
    border: 2px solid var(--secondary-color);
    color: var(--secondary-color);
}

.btn-outline-secondary:hover {
    background: var(--secondary-color);
    color: white;
}

/* 按钮尺寸 */
.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

/* 按钮状态 */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-block {
    display: block;
    width: 100%;
}

/* 按钮组 */
.btn-group {
    display: inline-flex;
    gap: 0.5rem;
}

/* 图标按钮 */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-icon svg {
    width: 1.25rem;
    height: 1.25rem;
}


/* 卡片 */
.card {
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    border-left: 4px solid var(--secondary-color);
    padding: 1.5rem;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 500;
    color: #00324D;
}

.card-content {
    margin-top: 1rem;
}
/* --- 功能组件 --- */
/* 轮播图 */
.carousel-container {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 0.5rem;
}

.carousel-wrapper {
    display: flex;
    transition: transform 0.5s ease-in-out;
}

.carousel-item {
    flex: 0 0 100%;
    width: 100%;
    position: relative;
}

.carousel-image {
    width: 100%;
    height: 500px;
    object-fit: cover;
}

.carousel-content {
    background: white;
    padding: 1.5rem;
}

.carousel-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.8);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.3s;
    z-index: 10;
}

.carousel-button:hover {
    background: rgba(255, 255, 255, 0.95);
}

.carousel-button.prev {
    left: 1rem;
}

.carousel-button.next {
    right: 1rem;
}

/* 产品展示 */
.product-scroll-container {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.product-scroll-wrapper {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 0.5rem 0;
    padding: 1rem 0;
    flex-wrap: nowrap; /* 防止换行 */
}

.product-scroll-wrapper::-webkit-scrollbar {
    display: none;
}

.product-card {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-width: 0; /* 防止内容溢出 */
}

.product-card img {
    width: 100%;
    object-fit: cover;
}

.product-card .product-info {
    padding: 0.75rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 38.2%; /* 黄金分割比例 38.2% */
}

.product-card .brand-model {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    height: 25%;
    min-height: 1.5rem;
    width: 100%;
}

.product-card .brand-model .brand {
    font-weight: 500;
    flex: 1;
    min-width: 0;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 0.5rem;
}

.product-card .brand-model .model {
    font-size: clamp(0.55rem, 1.4vw, 0.65rem);
    color: var(--text-secondary);
    opacity: 0.8;
    white-space: nowrap;
    flex-shrink: 0;
}

.product-card .price-info {
    height: 50%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    font-size: clamp(0.8rem, 2.8vw, 1rem);
    margin: 0.25rem 0;
}

.product-card .price-info .flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.product-card .price-info .text-lg {
    font-size: clamp(0.9rem, 3vw, 1.1rem);
}

.product-card .price-info .text-xs {
    font-size: clamp(0.65rem, 2vw, 0.75rem);
}

.product-card .price-info .text-success {
    font-size: clamp(0.7rem, 2.2vw, 0.8rem);
}

.product-card .store-info {
    height: 25%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
    gap: 0.5rem;
    width: 100%;
}

.product-card .store-info .store-name-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}

.product-card .store-info img {
    width: clamp(18px, 2.5vw, 22px);
    height: clamp(18px, 2.5vw, 22px);
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.product-card .store-info span {
    font-size: clamp(0.6rem, 1.8vw, 0.7rem);
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-card .store-info .likes {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
    color: var(--text-secondary);
    font-size: clamp(0.6rem, 1.8vw, 0.7rem);
}

.product-card .store-info .likes svg {
    width: clamp(14px, 2vw, 16px);
    height: clamp(14px, 2vw, 16px);
    fill: #FF4B4B; /* 统一的红色 */
    stroke: #FF4B4B; /* 统一的红色描边 */
    stroke-width: 1.5;
    transition: transform 0.2s ease;
}

.product-card .store-info .likes:hover svg {
    transform: scale(1.1);
}

.scroll-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: background-color 0.3s;
}

.scroll-button:hover {
    background: white;
}

.scroll-button.prev {
    left: 0;
}

.scroll-button.next {
    right: 0;
}

/* 桌面端滚动按钮显示 */
@media (min-width: 1280px) {
    .scroll-button {
        display: flex !important;
    }
}

/* 移动端隐藏滚动按钮 */
@media (max-width: 1279px) {
    .scroll-button {
        display: none !important;
    }
}

/* --- 响应式设计 --- */
@media (max-width: 767px) {
    /* 移动端样式 */
    .product-card {
        flex: 0 0 calc(50vw - 0.75rem);
        min-width: calc(50vw - 0.75rem);
        max-width: calc(50vw - 0.75rem);
        width: calc(50vw - 0.75rem);
        aspect-ratio: 1/2;
    }

    .product-card img {
        width: 100%;
        height: 61.8%;
        object-fit: cover;
    }

    .product-card .product-info {
        height: 38.2%; /* 剩余部分 */
        padding: 0.5rem;
    }

    /* 移动端导航栏样式 */
    .navbar {
        padding: 0.5rem 1rem;
    }

    /* 移动端搜索栏样式 */
    .search-input {
        font-size: 0.875rem;
        padding: 0.5rem;
    }

    .carousel-image {
        height: 300px;
    }

    .carousel-button {
        display: none;
    }

    .product-scroll-wrapper {
        gap: 0.5rem;
        padding: 0.5rem 0;
    }

    .product-info {
        padding: 0.5rem;
        flex: 1;
        display: flex;
        flex-direction: column;
    }

    .brand-model {
        font-size: 0.7rem;
    }

    .price-info {
        font-size: 0.8rem;
    }

    .store-info {
        padding-top: 0.25rem;
        margin-top: auto; /* 确保店铺信息始终在底部 */
    }

    .store-info img {
        width: 20px;
        height: 20px;
    }

    .store-info span {
        font-size: 0.7rem;
    }

    .scroll-button {
        display: none;
    }

    .carousel-content {
        position: relative;
        background: white;
        padding: 1.5rem;
    }

    .product-scroll-wrapper {
        gap: 0.75rem;
    }

    .product-card .brand-model .brand {
        font-size: clamp(0.95rem, 4vw, 1.15rem);
    }

    .product-card .brand-model .model {
        font-size: clamp(0.9rem, 3.8vw, 1.1rem);
    }

    .product-card .price-info .text-lg {
        font-size: clamp(1.2rem, 4.2vw, 1.4rem);
    }

    .product-card .price-info .text-xs {
        font-size: clamp(0.75rem, 2.8vw, 0.85rem);
    }

    .product-card .price-info .text-success {
        font-size: clamp(1rem, 3.8vw, 1.2rem);
    }

    .product-card .store-info span {
        font-size: clamp(0.9rem, 3.5vw, 1.1rem);
    }

    .product-card .store-info .likes {
        font-size: clamp(0.9rem, 3.5vw, 1.1rem);
    }

    .product-card .store-info .likes svg {
        width: clamp(16px, 3vw, 18px);
        height: clamp(16px, 3vw, 18px);
    }

    .product-card .store-info img {
        width: clamp(26px, 4.5vw, 30px);
        height: clamp(26px, 4.5vw, 30px);
    }
}

@media (min-width: 768px) {
    /* 桌面端样式 */
    .product-card {
        flex: 0 0 160px;
        min-width: 160px;
        max-width: 160px;
        width: 160px;
        aspect-ratio: 1/2;
        margin-bottom: 1.5rem;
    }

    .product-card img {
        width: 100%;
        height: 61.8%;
        object-fit: cover;
    }

    .product-card .product-info {
        height: 38.2%; /* 剩余部分 */
        padding: 0.75rem;
    }

    /* 桌面端导航栏样式 */
    .navbar {
        padding: 1rem 1.5rem;
    }

    /* 桌面端搜索栏样式 */
    .search-input {
        font-size: 1rem;
        padding: 0.75rem;
    }

    .carousel-content {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        background: rgba(255, 255, 255, 0.95);
        padding: 2rem;
    }

    .product-card .brand-model .brand {
        font-size: clamp(0.6rem, 1.6vw, 0.7rem);
    }

    .product-card .brand-model .model {
        font-size: clamp(0.55rem, 1.4vw, 0.65rem);
    }

    .product-card .price-info .text-lg {
        font-size: clamp(0.75rem, 2vw, 0.85rem);
    }

    .product-card .price-info .text-xs {
        font-size: clamp(0.5rem, 1.4vw, 0.6rem);
    }

    .product-card .price-info .text-success {
        font-size: clamp(0.7rem, 2.2vw, 0.8rem);
    }

    .product-card .store-info span {
        font-size: clamp(0.6rem, 1.8vw, 0.7rem);
    }

    .product-card .store-info img {
        width: clamp(18px, 2.5vw, 22px);
        height: clamp(18px, 2.5vw, 22px);
    }
}

/* 商品详情页图片轮播 */
.product-image-slider {
    position: relative;
    width: 100%;
    overflow: hidden;
    display: flex;
}

.product-image-slide {
    flex-shrink: 0;
    width: 100%;
    height: 100%;
    position: relative;
}

.product-image-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background-color: white;
}

.thumbnail {
    transition: all 0.2s ease-in-out;
    border: 2px solid transparent;
    cursor: pointer;
}

.thumbnail:hover {
    transform: scale(1.05);
}

.thumbnail.active {
    border-color: var(--primary-color);
}

.product-slider-button {
    opacity: 0.8;
    transition: opacity 0.2s ease-in-out;
    z-index: 10;
    background: rgba(255, 255, 255, 0.8);
}

.product-slider-button:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.95);
}

@media (max-width: 768px) {
    .product-image-slider {
        min-height: 300px;
    }
    
    .product-slider-button {
        opacity: 0.8;
        background: rgba(255, 255, 255, 0.8);
    }
}

/* 缩略图容器 */
.thumbnail-container {
    position: relative;
    width: 100%;
    margin-top: 1rem;
}

.thumbnail-wrapper {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 0.5rem 0;
}

.thumbnail-wrapper::-webkit-scrollbar {
    display: none;
}

.thumbnail {
    flex: 0 0 80px;
    height: 80px;
    border-radius: 0.5rem;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease-in-out;
}

.thumbnail:hover {
    transform: scale(1.05);
}

.thumbnail.active {
    border-color: var(--primary-color);
}

.thumbnail-scroll-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.thumbnail-scroll-button:hover {
    background: white;
}

.thumbnail-scroll-button.prev {
    left: 0;
}

.thumbnail-scroll-button.next {
    right: 0;
}

@media (max-width: 768px) {
    .thumbnail {
        flex: 0 0 60px;
        height: 60px;
    }
}
/* 在 base_frontend.css 中添加 */
.category-group {
    position: relative;
}

.category-group:not(:last-child) {
    border-bottom: 1px solid #f0f0f0;
}

.category-group > a:first-child {
    font-weight: 500;
}

/* 子类别的缩进和连接线 */
.category-group > a:not(:first-child) {
    position: relative;
}

.category-group > a:not(:first-child)::before {
    content: '';
    position: absolute;
    left: 1rem;
    top: 0;
    bottom: 0;
    width: 1px;
    background-color: #e5e7eb;
}

/* 商品详情页特殊样式 */
@media (max-width: 768px) {
    body.item-detail-page {
        padding-top: calc(2.5rem + 3.5rem + 0.25rem); /* 与其他页面保持一致 */
        padding-bottom: 4rem; /* 为底部导航条预留空间 */
    }

    body.item-detail-page .notification-bar,
    body.item-detail-page .md\\:hidden .navbar {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 50;
    }

    body.item-detail-page .md\\:hidden .navbar {
        top: 2.75rem;
    }

    /* 确保底部导航条始终可见 */
    body.item-detail-page .fixed.bottom-0 {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background-color: white;
        border-top: 1px solid var(--border-color);
        z-index: 40;
        transform: none; /* 移除任何可能的transform */
    }
}