/**
 * @name: home.css
 * @description: 首頁專用樣式
 * @version: 1.0.0
 */

/* ================================
   Section 通用樣式
   ================================ */
.home-section {
    position: relative;
}

.section-title {
    color: var(--text-primary);
    font-weight: 600;
    position: relative;
    display: inline-block;
}

.section-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 3px;
    background: var(--primary-color);
    margin: 0.5rem auto 0;
}

.section-title.text-center::after {
    margin: 0.5rem auto 0;
}

.section-title:not(.text-center)::after {
    margin: 0.5rem 0 0;
}

/* ================================
   大幻燈片 (Hero Swiper)
   ================================ */
.hero-section {
    margin-bottom: 0;
}

.hero-swiper {
    position: relative;
    width: 100%;
    height: 60vh;
    min-height: 400px;
    max-height: 700px;
}

.hero-swiper .swiper-slide {
    height: 60vh;
    min-height: 400px;
    max-height: 700px;
}

.hero-swiper .carousel-slide-inner {
    position: relative;
    width: 100%;
    height: 100%;
}

.hero-swiper .carousel-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-swiper .carousel-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.hero-swiper .carousel-custom-html {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    pointer-events: auto;
}

.hero-swiper .carousel-content {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    padding: 2rem;
    z-index: 10;
}

.hero-swiper .carousel-content.align-left {
    text-align: left;
    padding-left: 10%;
}

.hero-swiper .carousel-content.align-center {
    text-align: center;
}

.hero-swiper .carousel-content.align-right {
    text-align: right;
    padding-right: 10%;
}

.hero-swiper .carousel-title {
    font-size: 3rem;
    font-weight: 700;
    color: inherit;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    margin-bottom: 1rem;
}

.hero-swiper .carousel-subtitle {
    font-size: 1.5rem;
    color: inherit;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    margin-bottom: 2rem;
}

.hero-swiper .carousel-btn {
    padding: 0.75rem 2rem;
    font-size: 1.1rem;
    border-radius: 50px;
    transition: all var(--transition-speed, 0.3s) ease;
}

.hero-swiper .carousel-btn:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-lg);
}

/* Swiper 導航按鈕 */
.hero-swiper .swiper-button-prev,
.hero-swiper .swiper-button-next {
    color: rgba(255, 255, 255, 0.8);
    transition: all var(--transition-speed, 0.3s) ease;
}

.hero-swiper .swiper-button-prev:hover,
.hero-swiper .swiper-button-next:hover {
    color: #fff;
}

.hero-swiper .swiper-button-prev::after,
.hero-swiper .swiper-button-next::after {
    font-size: 1.5rem;
}

/* Swiper 分頁指示器 */
.hero-swiper .swiper-pagination {
    bottom: 1.5rem;
}

.hero-swiper .swiper-pagination-bullet {
    width: 12px;
    height: 12px;
    background: rgba(255, 255, 255, 0.5);
    opacity: 1;
    transition: all var(--transition-speed, 0.3s) ease;
}

.hero-swiper .swiper-pagination-bullet-active {
    background: #fff;
    transform: scale(1.2);
}

/* 輪播載入狀態 */
.carousel-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 60vh;
    min-height: 400px;
    background: var(--bg-secondary);
}

/* 空輪播佔位 */
.carousel-placeholder {
    height: 60vh;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    color: var(--text-secondary);
}

/* ================================
   產品展示區
   ================================ */
.products-section {
    background-color: var(--bg-secondary);
}

/* 主打商品容器 */
.featured-product-container {
    height: 100%;
    min-height: 400px;
}

.featured-product-card {
    position: relative;
    display: block;
    height: 100%;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-speed, 0.3s) ease;
    text-decoration: none;
    background: var(--bg-primary);
}

.featured-product-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    text-decoration: none;
}

.featured-product-card .featured-image {
    width: 100%;
    height: 60%;
    min-height: 240px;
    object-fit: contain;
    background: var(--bg-tertiary);
    padding: 1rem;
}

.featured-product-card .featured-content {
    padding: 1.5rem;
    background: var(--bg-primary);
}

.featured-product-card .featured-badge {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: var(--primary-color);
    color: #fff;
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.875rem;
    font-weight: 600;
    z-index: 5;
}

.featured-product-card .product-model {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    margin-bottom: 0.25rem;
}

.featured-product-card h3 {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.featured-product-card .text-muted {
    color: var(--text-secondary) !important;
}

.featured-product-card .product-price {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary-color);
    margin: 0;
}

/* 熱銷產品卡片 */
.product-card {
    display: block;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    overflow: hidden;
    transition: all var(--transition-speed, 0.3s) ease;
    height: 100%;
    text-decoration: none;
}

.product-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
    text-decoration: none;
}

.product-card .product-image-wrapper {
    position: relative;
    padding-top: 75%; /* 4:3 比例 */
    overflow: hidden;
    background: var(--bg-tertiary);
}

.product-card .product-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 0.5rem;
    transition: transform var(--transition-speed, 0.3s) ease;
}

.product-card:hover .product-image {
    transform: scale(1.05);
}

.product-card .product-info {
    padding: 1rem;
}

.product-card .product-model {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-bottom: 0.25rem;
}

.product-card .product-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
    min-height: 2.5em;
}

.product-card .product-price {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-color);
    margin: 0;
}

/* 產品區空狀態 */
.products-empty {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

/* ================================
   大類方塊圖
   ================================ */
.categories-section {
    background-color: var(--bg-primary);
}

/* 連續斜帶容器：卡片並排互相靠攏，斜邊接續成一整條 ///// */
#categoriesGrid.cat-ribbon-wrap {
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: stretch;
    gap: 0;
    padding: 0.75rem 0;
}

/* 單張斜角卡（平行四邊形，由 clip-path 裁切，圖文不變形） */
.cat-skew {
    --slant: 34px;
    position: relative;
    flex: 1 1 0;
    min-width: 0;
    max-width: 230px;
    aspect-ratio: 3 / 4;
    margin-left: calc(-1 * var(--slant) / 2);
    display: flex;
    flex-direction: column;
    text-decoration: none;
    overflow: hidden;
    background: var(--bg-secondary);
    clip-path: polygon(var(--slant) 0, 100% 0, calc(100% - var(--slant)) 100%, 0 100%);
    filter: drop-shadow(var(--shadow-sm));
    transition: transform var(--transition-speed, 0.3s) ease,
                filter var(--transition-speed, 0.3s) ease;
}

.cat-skew:first-child {
    margin-left: 0;
}

.cat-skew:hover {
    transform: translateY(-6px);
    filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.28));
    z-index: 2;
}

/* 上 1/4：名稱條（黑白主軸 — 亮色黑底反白、暗色金底反黑） */
.cat-skew .cat-label {
    flex: 0 0 26%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 14%;
    background: var(--text-primary);
    color: var(--bg-primary);
    font-weight: 700;
    font-size: clamp(0.7rem, 1.05vw, 0.95rem);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-align: center;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background var(--transition-speed, 0.3s) ease,
                color var(--transition-speed, 0.3s) ease;
}

/* hover 才浮現品牌色 */
.cat-skew:hover .cat-label {
    background: var(--primary-color);
    color: var(--text-inverse);
}

/* 下 3/4：滿版圖片 */
.cat-skew .cat-photo {
    flex: 1 1 auto;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: transform var(--transition-speed, 0.4s) ease;
}

.cat-skew:hover .cat-photo {
    transform: scale(1.06);
}

/* 無圖 fallback：置中圖示 */
.cat-skew .cat-photo.is-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 2.75rem;
}

/* ================================
   佈告欄（輕巧風格）
   ================================ */
.bulletin-section {
    background-color: var(--bg-secondary);
}

/* 輕巧佈告欄列表 */
.bulletin-list-compact {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.bulletin-item-compact {
    display: flex;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px dashed var(--border-color);
    text-decoration: none;
    transition: all var(--transition-speed, 0.3s) ease;
}

.bulletin-item-compact:last-child {
    border-bottom: none;
}

.bulletin-item-compact:hover {
    text-decoration: none;
}

.bulletin-item-compact:hover .bulletin-compact-title {
    color: var(--primary-color);
}

/* 日期 */
.bulletin-item-compact .bulletin-compact-date {
    flex-shrink: 0;
    width: 100px;
    font-size: 0.875rem;
    color: var(--text-tertiary);
    font-weight: 400;
}

/* 標籤 */
.bulletin-item-compact .bulletin-compact-tag {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 140px;
    padding: 0.35rem 0.875rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    color: #fff;
    margin-right: 1.5rem;
    text-align: center;
}

/* 置頂圖標 */
.bulletin-item-compact .bulletin-compact-pinned {
    color: var(--primary-color);
    margin-right: 0.5rem;
    flex-shrink: 0;
}

/* 標題 */
.bulletin-item-compact .bulletin-compact-title {
    flex: 1;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: color var(--transition-speed, 0.3s) ease;
}

/* 公告區空狀態 */
.bulletin-empty {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    background: var(--bg-primary);
    border-radius: 0.5rem;
}

/* 原有的佈告欄列表樣式（保留相容性） */
.bulletin-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.bulletin-item {
    display: flex;
    align-items: center;
    padding: 1rem 1.25rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    text-decoration: none;
    transition: all var(--transition-speed, 0.3s) ease;
}

.bulletin-item:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary-color);
    transform: translateX(5px);
    text-decoration: none;
}

.bulletin-item .bulletin-tag {
    flex-shrink: 0;
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 500;
    color: #fff;
    margin-right: 1rem;
}

.bulletin-item .bulletin-pinned {
    color: var(--primary-color);
    margin-right: 0.5rem;
    flex-shrink: 0;
}

.bulletin-item .bulletin-title {
    flex: 1;
    font-size: 0.95rem;
    color: var(--text-primary);
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bulletin-item .bulletin-date {
    flex-shrink: 0;
    font-size: 0.8rem;
    color: var(--text-tertiary);
    margin-left: 1rem;
}

/* ================================
   支援區（問與答）
   ================================ */
.support-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.support-item {
    display: flex;
    align-items: flex-start;
    padding: 1rem 0;
    border-bottom: 1px dashed var(--border-color);
    text-decoration: none;
    transition: all var(--transition-speed, 0.3s) ease;
}

.support-item:last-child {
    border-bottom: none;
}

.support-item:hover {
    text-decoration: none;
}

.support-item:hover .support-title {
    color: var(--primary-color);
}

.support-item .support-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-color);
    color: #fff;
    border-radius: 50%;
    margin-right: 1rem;
    font-size: 0.875rem;
    font-weight: 600;
}

.support-item .support-content {
    flex: 1;
    min-width: 0;
}

.support-item .support-title {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
    margin: 0 0 0.25rem 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: color var(--transition-speed, 0.3s) ease;
}

.support-item .support-preview {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 支援區空狀態 */
.support-empty {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    background: var(--bg-primary);
    border-radius: 0.5rem;
}

/* ================================
   廠商列表
   ================================ */
.vendors-section {
    background-color: var(--bg-primary);
    border-top: 1px solid var(--border-color);
}

.vendors-carousel {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 2rem;
}

.vendor-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 1.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    transition: all var(--transition-speed, 0.3s) ease;
    text-decoration: none;
}

.vendor-logo:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-sm);
    border-color: var(--primary-color);
    text-decoration: none;
}

.vendor-logo img {
    max-width: 120px;
    max-height: 60px;
    object-fit: contain;
    filter: grayscale(100%);
    opacity: 0.6;
    transition: all var(--transition-speed, 0.3s) ease;
}

.vendor-logo:hover img {
    filter: grayscale(0%);
    opacity: 1;
}

/* ================================
   載入狀態
   ================================ */
.section-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

/* ================================
   響應式設計
   ================================ */
@media (max-width: 992px) {
    .hero-swiper,
    .hero-swiper .swiper-slide,
    .carousel-loading,
    .carousel-placeholder {
        height: 50vh;
        min-height: 350px;
    }

    .hero-swiper .carousel-title {
        font-size: 2rem;
    }

    .hero-swiper .carousel-subtitle {
        font-size: 1.1rem;
    }

    .featured-product-container {
        min-height: 300px;
        margin-bottom: 1.5rem;
    }

    .featured-product-card .featured-image {
        height: 200px;
        min-height: 200px;
    }
}

@media (max-width: 768px) {
    .hero-swiper,
    .hero-swiper .swiper-slide,
    .carousel-loading,
    .carousel-placeholder {
        height: 40vh;
        min-height: 280px;
    }

    .hero-swiper .carousel-title {
        font-size: 1.5rem;
    }

    .hero-swiper .carousel-subtitle {
        font-size: 1rem;
        margin-bottom: 1rem;
    }

    .hero-swiper .carousel-btn {
        padding: 0.5rem 1.5rem;
        font-size: 1rem;
    }

    .hero-swiper .carousel-content {
        padding: 1rem;
    }

    .hero-swiper .carousel-content.align-left,
    .hero-swiper .carousel-content.align-right {
        padding-left: 5%;
        padding-right: 5%;
    }

    .hero-swiper .swiper-button-prev,
    .hero-swiper .swiper-button-next {
        display: none;
    }

    .section-title {
        font-size: 1.25rem;
    }

    /* 斜帶在手機改為橫向滑動，保留斜角不擠壓 */
    #categoriesGrid.cat-ribbon-wrap {
        justify-content: flex-start;
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 1rem;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }

    .cat-skew {
        --slant: 26px;
        flex: 0 0 auto;
        width: 46vw;
        max-width: none;
    }

    .bulletin-item {
        flex-wrap: wrap;
    }

    .bulletin-item .bulletin-date {
        width: 100%;
        margin-left: 0;
        margin-top: 0.5rem;
    }

    /* 輕巧佈告欄響應式 */
    .bulletin-item-compact {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .bulletin-item-compact .bulletin-compact-date {
        width: auto;
        order: 1;
    }

    .bulletin-item-compact .bulletin-compact-tag {
        min-width: auto;
        margin-right: 0;
        order: 2;
    }

    .bulletin-item-compact .bulletin-compact-title {
        width: 100%;
        order: 3;
        margin-top: 0.25rem;
    }

    .bulletin-item-compact .bulletin-compact-pinned {
        order: 0;
    }

    .vendors-carousel {
        gap: 1rem;
    }

    .vendor-logo {
        padding: 0.75rem 1rem;
    }

    .vendor-logo img {
        max-width: 140px;
        max-height: 40px;
    }
}

@media (max-width: 576px) {
    .hero-swiper,
    .hero-swiper .swiper-slide,
    .carousel-loading,
    .carousel-placeholder {
        height: 35vh;
        min-height: 250px;
    }

    .hero-swiper .carousel-title {
        font-size: 1.25rem;
    }

    .hero-swiper .carousel-subtitle {
        font-size: 0.9rem;
    }

    .product-card .product-info {
        padding: 0.75rem;
    }

    .product-card .product-name {
        font-size: 0.85rem;
    }

    .bulletin-item .bulletin-tag {
        font-size: 0.7rem;
        padding: 0.2rem 0.5rem;
    }

    .bulletin-item-compact .bulletin-compact-tag {
        font-size: 0.7rem;
        padding: 0.25rem 0.5rem;
    }

    .bulletin-item-compact .bulletin-compact-date {
        font-size: 0.8rem;
    }
}
