/* ========================================
   独角数卡 - 首页样式
   商品列表、分类标签、公告区域
   ======================================== */

/* ========================================
   公告栏 - 可折叠
   ======================================== */
.notice-wrapper {
    padding: 20px 0 0;
}

.notice-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: box-shadow var(--transition-base);
}

.notice-card:hover {
    box-shadow: var(--shadow-sm);
}

.notice-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    cursor: pointer;
    user-select: none;
    background: var(--bg-tertiary);
    transition: background var(--transition-fast);
}

.notice-header:hover {
    background: #eee;
}

.notice-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.notice-icon {
    font-size: 16px;
}

.notice-toggle-icon {
    color: var(--text-tertiary);
    transition: transform var(--transition-base);
}

.notice-card.expanded .notice-toggle-icon {
    transform: rotate(180deg);
}

.notice-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.notice-card.expanded .notice-content {
    max-height: 500px;
    transition: max-height 0.4s ease-in;
}

.notice-body {
    padding: 16px 20px;
    font-size: 13px;
    line-height: 1.8;
    color: var(--text-secondary);
    border-top: 1px solid var(--border);
}

.notice-body a {
    color: var(--accent);
    text-decoration: none;
}

.notice-body a:hover {
    text-decoration: underline;
}


/* ========================================
   分类区域
   ======================================== */
.category {
    padding: 48px 0 24px;
    text-align: center;
}

.category h3 {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    margin-bottom: 8px;
}

.category .lead {
    font-size: 15px;
    color: var(--text-tertiary);
    margin-bottom: 32px;
}

/* 分隔线 - 简洁版 */
.separator {
    display: block;
    width: 40px;
    height: 3px;
    margin: 16px auto 12px;
    background: var(--accent);
    border: none;
    border-radius: 2px;
    position: relative;
}

.separator:after {
    display: none;
}

/* 分类菜单 */
.category-menus {
    margin-bottom: 8px;
}

.category-menus .nav {
    gap: 8px;
}

.category-menus li {
    display: inline-block;
}

.category-menus .btn {
    font-size: 13px;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 20px;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    transition: all var(--transition-fast);
}

.category-menus .btn:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
    border-color: var(--border-hover);
    box-shadow: var(--shadow-sm);
}

.category-menus .btn.active {
    color: var(--accent);
    background: var(--accent-subtle);
    border-color: transparent;
}

/* ========================================
   商品列表
   ======================================== */
.goods {
    padding-bottom: 40px;
}

.goods-list {
    margin-bottom: 0;
}

/* 商品卡片 */
.goods .card {
    height: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-secondary);
    transition: all var(--transition-base);
}

.goods .card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
}

/* 商品图片 */
.goods .card-img-top {
    aspect-ratio: 1 / 1;
    object-fit: cover;
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

/* 卡片内容 */
.goods .card-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* 商品标题 */
.goods .card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.4;
}

/* 价格标签 */
.goods .btn-outline-success {
    font-size: 15px;
    font-weight: 600;
    padding: 6px 12px;
    background: var(--success-bg);
    color: var(--success) !important;
    border: none;
    border-radius: var(--radius-sm);
    pointer-events: none;
}

/* 批发标签 */
.goods .btn-outline-warning {
    font-size: 11px;
    font-weight: 500;
    padding: 4px 8px;
    background: var(--warning-bg);
    color: var(--warning) !important;
    border: none;
    border-radius: var(--radius-sm);
    margin-left: 6px;
}

/* 库存信息 */
.goods h6.mt-2 {
    margin: 0 !important;
}

.goods h6 small {
    font-size: 12px;
    color: var(--text-tertiary);
    font-weight: 400;
}

/* 购买按钮 */
.goods .btn-primary {
    width: 100%;
    justify-content: center;
    font-size: 13px;
    font-weight: 500;
    padding: 10px 16px;
    border-radius: var(--radius-md);
    background: var(--accent);
    color: #fff !important;
    border: none;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-fast);
    float: none !important;
    margin-top: auto;
}

.goods .btn-primary:hover {
    background: var(--accent-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

/* 商品状态徽章 */
.goods .badge {
    font-size: 10px;
    font-weight: 500;
    padding: 5px 8px;
    border-radius: 0 0 var(--radius-sm) 0;
    z-index: 1;
}

.goods .badge.bg-success {
    background: rgba(48, 161, 78, 0.9) !important;
    color: #fff;
}

.goods .badge.bg-warning {
    background: rgba(191, 135, 0, 0.9) !important;
    color: #fff;
}

/* ========================================
   购买表单页
   ======================================== */
.buy-form label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.goods-buy {
    line-height: 1.6;
    font-size: 14px;
}

/* 商品介绍截断 */
.goods-introduction-cate {
    display: -webkit-box;
    overflow: hidden;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    color: var(--text-secondary);
    font-size: 13px;
}

/* ========================================
   响应式调整
   ======================================== */
@media (max-width: 768px) {
    .category {
        padding: 32px 0 16px;
    }

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

    .category-menus .btn {
        font-size: 12px;
        padding: 6px 12px;
    }

    .goods .card-body {
        padding: 12px;
    }

    .goods .card-title {
        font-size: 13px;
    }

    .goods .btn-primary {
        font-size: 12px;
        padding: 8px 12px;
    }
}

/* ========================================
   Grid 间距优化
   ======================================== */
.row.g-4 {
    --bs-gutter-x: 20px;
    --bs-gutter-y: 20px;
}

@media (max-width: 768px) {
    .row.g-4 {
        --bs-gutter-x: 12px;
        --bs-gutter-y: 12px;
    }
}

/* ========================================
   返回顶部按钮
   ======================================== */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 44px;
    height: 44px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all var(--transition-base);
    box-shadow: var(--shadow-md);
    z-index: 1000;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.back-to-top svg {
    width: 20px;
    height: 20px;
    color: var(--text-secondary);
    transition: color var(--transition-fast);
}

.back-to-top:hover svg {
    color: #fff;
}

/* ========================================
   分类标签横向滚动 (移动端)
   ======================================== */
@media (max-width: 768px) {
    .category-menus {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        margin: 0 -15px;
        padding: 0 15px;
    }

    .category-menus::-webkit-scrollbar {
        display: none;
    }

    .category-menus .nav {
        flex-wrap: nowrap;
        padding-bottom: 8px;
    }

    .category-menus li {
        flex-shrink: 0;
    }
}

/* ========================================
   商品缺货样式
   ======================================== */
.goods .card.out-of-stock {
    position: relative;
}

.goods .card.out-of-stock::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.6);
    border-radius: var(--radius-lg);
    pointer-events: none;
}

.goods .card.out-of-stock .card-img-top {
    filter: grayscale(80%);
}

.goods .card.out-of-stock:hover {
    transform: none;
    box-shadow: var(--shadow-sm);
}

.out-of-stock-badge {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    z-index: 2;
}

/* ========================================
   价格样式增强
   ======================================== */
.price-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.price-original {
    font-size: 12px;
    color: var(--text-tertiary);
    text-decoration: line-through;
}

.price-current {
    font-size: 16px;
    font-weight: 700;
    color: var(--success);
}

/* ========================================
   搜索框增强
   ======================================== */
.search-wrapper {
    position: relative;
}

.search-wrapper .form-control {
    padding-right: 40px;
    transition: all var(--transition-base);
}

.search-wrapper .form-control:focus {
    width: 280px;
}

.search-clear {
    position: absolute;
    right: 50px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--text-tertiary);
    color: #fff;
    font-size: 12px;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.search-wrapper.has-value .search-clear {
    display: flex;
}

/* ========================================
   骨架屏加载
   ======================================== */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius-md);
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.skeleton-card {
    height: 280px;
}

.skeleton-img {
    height: 150px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.skeleton-text {
    height: 14px;
    margin-bottom: 8px;
}

.skeleton-text.short {
    width: 60%;
}

.skeleton-btn {
    height: 36px;
    margin-top: 12px;
}

/* ========================================
   图片懒加载占位
   ======================================== */
.lazy-image {
    background: var(--bg-tertiary);
    transition: opacity var(--transition-base);
}

.lazy-image.loading {
    opacity: 0.6;
}

.lazy-image.loaded {
    opacity: 1;
}

/* ========================================
   页面过渡动画
   ======================================== */
.fade-in {
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 卡片入场动画 */
.goods .col {
    opacity: 0;
    animation: cardFadeIn 0.5s ease-out forwards;
}

.goods .col:nth-child(1) {
    animation-delay: 0.05s;
}

.goods .col:nth-child(2) {
    animation-delay: 0.1s;
}

.goods .col:nth-child(3) {
    animation-delay: 0.15s;
}

.goods .col:nth-child(4) {
    animation-delay: 0.2s;
}

.goods .col:nth-child(5) {
    animation-delay: 0.25s;
}

.goods .col:nth-child(6) {
    animation-delay: 0.3s;
}

.goods .col:nth-child(7) {
    animation-delay: 0.35s;
}

.goods .col:nth-child(8) {
    animation-delay: 0.4s;
}

.goods .col:nth-child(9) {
    animation-delay: 0.45s;
}

.goods .col:nth-child(10) {
    animation-delay: 0.5s;
}

@keyframes cardFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   导航栏滚动效果
   ======================================== */
.header.scrolled {
    box-shadow: var(--shadow-md);
}

/* ========================================
   按钮波纹效果
   ======================================== */
.btn-ripple {
    position: relative;
    overflow: hidden;
}

.btn-ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
}

.btn-ripple:active::after {
    width: 200px;
    height: 200px;
}

/* ========================================
   商品快速预览悬浮
   ======================================== */
.goods .card .quick-info {
    position: absolute;
    bottom: -100%;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 12px;
    border-top: 1px solid var(--border);
    transition: bottom var(--transition-base);
    font-size: 12px;
    color: var(--text-secondary);
}

.goods .card:hover .quick-info {
    bottom: 0;
}

/* ========================================
   滚动条美化
   ======================================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* ========================================
   选中文字样式
   ======================================== */
::selection {
    background: var(--accent-subtle);
    color: var(--accent);
}