:root {
    --bg: #f9f5f0;
    --wood-light: #d9c2a7;
    --wood: #b89a78;
    --wood-dark: #8c7152;
    --text: #5d4b3a;
    --text-light: #7a6b5c;
    --accent: #a67c52;
    --border: #e8d9c7;
    --shadow: 0 8px 30px rgba(139, 113, 82, 0.08);
    --card-shadow: 0 6px 20px rgba(139, 113, 82, 0.06);
}

/* === 基礎樣式 === */
body {
    background: var(--bg);
    font-family: 'Noto Sans TC', sans-serif;
    color: var(--text);
    line-height: 1.8;
    font-weight: 400;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    position: relative;
}

#home,
#products,
#contact {
    background: #fdfaf7 !important;
}

/* === 文字與標題 === */
.brand-title {
    font-family: 'ZCOOL XiaoWei', serif;
    font-size: 1.8rem;
    color: var(--wood-dark);
    letter-spacing: 1.5px;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Noto Sans TC', sans-serif !important;
    font-weight: 700;
    color: var(--wood-dark);
}

.text-wood {
    color: var(--wood) !important;
}

/* === 按鈕與互動元素 === */
.btn-wood {
    background: transparent;
    border: 1.5px solid var(--wood);
    color: var(--wood);
    border-radius: 0 !important;
    padding: 0.75rem 2rem;
    font-weight: 500;
    letter-spacing: 1.5px;
    transition: all 0.4s;
    font-size: 0.95rem;
}

.btn-wood:hover {
    background: var(--wood);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(139, 113, 82, 0.2);
}

.cursor-pointer {
    cursor: pointer;
}

/* === 通用元件邊框與陰影 === */
.card,
.card-shadow,
.btn,
.pagination .page-link,
.list-group-item,
.offcanvas,
.form-control,
.swiper-button-prev,
.swiper-button-next {
    border-radius: 0 !important;
}

.card-shadow {
    background: #ffffff;
    box-shadow: var(--card-shadow) !important;
    border: 1px solid var(--border) !important;
    transition: all 0.4s ease;
    overflow: hidden;
}

.card-shadow:hover {
    transform: translateY(-6px);
    box-shadow: 0 15px 35px rgba(139, 113, 82, 0.12) !important;
}

/* === 圖片比例容器 === */
.rect-7-5 {
    position: relative;
    width: 100%;
    padding-bottom: 71.43%;
    overflow: hidden;
}

.rect-7-5 img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s;
}

.rect-7-5 img:hover {
    transform: scale(1.03);
}

.rect-3-4 {
    position: relative;
    width: 100%;
    padding-bottom: 133.33%;
    overflow: hidden;
}

.rect-3-4 img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s;
}

.rect-3-4 img:hover {
    transform: scale(1.03);
}

/* === Swiper 箭頭大小 === */
.swiper-button-next::after,
.swiper-button-prev::after {
    font-size: 18px;
}

/* === 精選輪播 === */
.featured-swiper {
    position: relative;
    padding: 0 40px;
    margin: 0 -40px;
}

.featured-swiper .swiper-button-prev,
.featured-swiper .swiper-button-next {
    width: 36px;
    height: 36px;
    background: var(--wood);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: -18px;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(139, 113, 82, 0.3);
}

.featured-swiper .swiper-button-prev:hover,
.featured-swiper .swiper-button-next:hover {
    background: var(--wood-dark);
    transform: scale(1.1);
}

/* === 導覽列 === */
.navbar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(139, 113, 82, 0.05);
}

.nav-link {
    color: var(--text-light) !important;
    font-weight: 500;
    padding: 0.5rem 1.2rem !important;
    transition: all 0.3s;
    font-size: 0.95rem;
}

.nav-link:hover,
.nav-link.active {
    color: var(--wood) !important;
    background: rgba(184, 154, 120, 0.1);
}

/* === 精選標題 === */
.featured-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--wood-dark);
    margin-bottom: 1.5rem;
    letter-spacing: 1px;
}

/* === 商品格線 === */
#productGrid .col-6 {
    flex: 0 0 50%;
    max-width: 50%;
    padding: 0 6px;
}


/* === 分類選單（Offcanvas）=== */
.category-parent {
    color: var(--text-light) !important;
    font-weight: 600;
    padding: 0.75rem 1.25rem 0.75rem 1.8rem !important;
    border: none !important;
    background: transparent !important;
    display: block;
    font-size: 0.95rem;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
}

.category-parent:hover {
    color: var(--wood) !important;
    background: rgba(184, 154, 120, 0.05);
}

.category-parent.active {
    color: var(--wood) !important;
    background: rgba(184, 154, 120, 0.08);
    font-weight: 700;
}

.category-parent.active::before {
    content: '';
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 18px;
    background: var(--wood);
    border-radius: 1.5px;
}

.category-parent::after {
    content: '\f107';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    transition: transform 0.3s;
    color: var(--text-light);
    font-size: 0.8rem;
}

.category-parent.collapsed::after {
    transform: translateY(-50%) rotate(-90deg);
}

.subcategory-item {
    color: var(--text-light) !important;
    font-weight: 500;
    padding: 0.6rem 1.25rem 0.6rem 2.8rem !important;
    font-size: 0.9rem;
    display: none;
    transition: all 0.3s ease;
    border-bottom: 1px solid #eee;
    position: relative;
}

.subcategory-item.show {
    display: block;
}

.subcategory-item:hover {
    color: var(--wood) !important;
    background: rgba(184, 154, 120, 0.05);
}

.subcategory-item.active {
    color: var(--wood) !important;
    font-weight: 600;
    background: rgba(184, 154, 120, 0.1);
    border-radius: 6px;
}

.offcanvas .category-parent,
.offcanvas .subcategory-item {
    border-bottom: 1px solid #eee;
}

.offcanvas .category-parent:last-of-type,
.offcanvas .subcategory-item:last-of-type {
    border-bottom: none;
}

.all-products-item {
    padding: 0.75rem 1.25rem !important;
    font-weight: 600;
    color: var(--text-light) !important;
    border-bottom: 1px solid #eee;
}

.all-products-item:hover,
.all-products-item.active {
    color: var(--wood) !important;
    background: rgba(184, 154, 120, 0.08);
    font-weight: 700;
}

/* === 分頁 === */
.pagination .page-link {
    color: var(--wood);
    border: 1px solid var(--border);
    font-weight: 500;
}

.pagination .page-item.active .page-link {
    background: var(--wood);
    border-color: var(--wood);
    color: white;
}

/* === Modal 通用 === */
.modal-content {
    border-radius: 0 !important;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    max-height: 80vh;
}

.modal img {
    box-shadow: 0 20px 50px rgba(139, 113, 82, 0.2);
}

/* === 正方形 X 按鈕（通用）=== */
.btn-close-square {
    position: absolute !important;
    top: 1rem !important;
    right: 1rem !important;
    width: 40px;
    height: 40px;
    background: var(--wood);
    color: white;
    border: none;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(139, 113, 82, 0.3);
    transition: all 0.3s;
    z-index: 1080;
    border-radius: 0;
}

.btn-close-square:hover {
    background: var(--wood-dark);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(139, 113, 82, 0.4);
}

.btn-close-square::before,
.btn-close-square::after {
    content: '';
    position: absolute;
    width: 50%;
    height: 2px;
    background: white;
    top: 50%;
    left: 25%;
}

.btn-close-square::before {
    transform: translateY(-50%) rotate(45deg);
}

.btn-close-square::after {
    transform: translateY(-50%) rotate(-45deg);
}

/* === 小圖 Modal (#smallImgModal) === */
#smallImgModal .modal-content {
    position: relative !important;
    overflow: visible !important;
    border-radius: 16px;
    background: white;
}

#smallImgModal .position-relative {
    width: 400px;
    height: 600px;
    margin: 20px auto;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.12);
}

#smallModalImg {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    display: block;
}

#smallImgModal .btn-close-square {
    position: absolute !important;
    top: 12px !important;
    right: 12px !important;
    width: 36px;
    height: 36px;
    /* 改回木質色 */
    background: var(--wood) !important;
    color: white !important;
    border: none !important;
    /* 正方形 */
    border-radius: 0 !important;
    font-weight: bold;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 12px rgba(139, 113, 82, 0.3);
    z-index: 1050 !important;
    transition: all 0.25s ease;
}

#smallImgModal .btn-close-square:hover {
    background: #f8f8f8 !important;
    border-color: #ccc;
    transform: scale(1.1);
    box-shadow: 0 5px 16px rgba(0, 0, 0, 0.22);
    color: #333 !important;
}

/* === Lightbox 全螢幕 === */
#imageLightbox .modal-content {
    background: rgba(0, 0, 0, 0.9) !important;
}

.lightbox-swiper .swiper-slide {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.lightbox-swiper .swiper-slide img {
    max-width: 100%;
    max-height: 100vh;
    object-fit: contain;
    border-radius: 0 !important;
}

.lightbox-swiper .swiper-button-next,
.lightbox-swiper .swiper-button-prev {
    width: 50px;
    height: 50px;
    background: rgba(139, 113, 82, 0.7);
    border-radius: 0;
    margin-top: -25px;
    transition: all 0.3s;
}

.lightbox-swiper .swiper-button-next:hover,
.lightbox-swiper .swiper-button-prev:hover {
    background: var(--wood);
    transform: scale(1.1);
}

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

/* === 商品頁圖片縮圖 === */
#mainProductImg {
    width: 100%;
    height: auto;
    max-height: 70vh;
    object-fit: contain;
    border-radius: 0 !important;
    display: block;
    margin: 0 auto;
}

#thumbnailContainer img {
    width: 73px;
    height: 73px;
    object-fit: cover;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s;
    flex-shrink: 0;
    border-radius: 0 !important;
}

#thumbnailContainer img.active {
    border-color: var(--wood) !important;
    box-shadow: 0 0 0 1px var(--wood);
}

#thumbnailContainer img:hover {
    border-color: var(--wood-light);
}

/* === 聯絡頁面 === */
#contact .map-container {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 66.66%;
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: var(--card-shadow);
}

#contact .map-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.contact-info h3 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--wood-dark);
}

.contact-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.contact-item i {
    color: var(--wood);
    width: 20px;
    margin-right: 12px;
    font-size: 1.1rem;
    margin-top: 2px;
}

.social-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--wood);
    color: white;
    font-size: 1.1rem;
    margin-right: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(139, 113, 82, 0.15);
}

.social-links a:hover {
    background: var(--wood-dark);
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(139, 113, 82, 0.25);
}

/* === 右下角浮動按鈕 === */
.floating-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    background: var(--wood);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 6px 20px rgba(139, 113, 82, 0.3);
    cursor: pointer;
    z-index: 1000;
    transition: all 0.3s ease;
}

.floating-btn:hover {
    background: var(--wood-dark);
    transform: scale(1.1);
    box-shadow: 0 10px 25px rgba(139, 113, 82, 0.4);
}

.quick-panel {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 260px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(139, 113, 82, 0.15);
    padding: 1rem;
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.quick-panel.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.quick-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 0.5rem;
    color: var(--text);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 1px solid #eee;
}

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

.quick-item:hover {
    color: var(--wood);
    background: #f8f5f0;
    border-radius: 6px;
}

.quick-item i {
    width: 36px;
    height: 36px;
    background: var(--wood);
    color: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    margin-right: 12px;
}

.copy-feedback {
    position: fixed;
    bottom: 90px;
    right: 20px;
    background: var(--wood-dark);
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.85rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 1001;
    opacity: 0;
    transition: opacity 0.3s;
}

.copy-feedback.show {
    opacity: 1;
}

/* === 頁尾 === */
footer {
    background: #f5f0e8;
    color: var(--text-light);
    padding: 1.5rem 0;
    font-size: 0.85rem;
    border-top: 1px solid var(--border);
    margin-top: auto;
    text-align: center;
}

/* ================================================================== */
/* ====================== 手機版統一集中區塊 ====================== */
/* ================================================================== */


@media (min-width: 992px) {
    #productGrid .col-lg-3 {
        flex: 0 0 25%;
        max-width: 25%;
    }
}

@media (max-width: 768px) {

    /* 精選輪播 */
    .featured-swiper {
        padding: 0 30px;
        margin: 0 -30px;
    }

    .featured-swiper .swiper-button-prev,
    .featured-swiper .swiper-button-next {
        width: 32px;
        height: 32px;
    }

    /* Lightbox 箭頭隱藏 */
    .lightbox-swiper .swiper-button-next,
    .lightbox-swiper .swiper-button-prev {
        display: none;
    }

    /* 商品縮圖 */
    #thumbnailContainer {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }

    #thumbnailContainer img {
        width: 80px;
        height: 80px;
    }

    #mainProductImg {
        max-height: 60vh;
    }

    /* 小圖 Modal */
    #smallImgModal .modal-content {
        width: 90vw !important;
        border-radius: 14px;
    }

    #smallImgModal .position-relative {
        width: 85vw !important;
        height: 127.5vw !important;
        max-height: 500px;
        margin: 15px auto;
    }

    #smallImgModal .btn-close-square {
        width: 34px;
        height: 34px;
        top: 10px !important;
        right: 10px !important;
        font-size: 1rem;
    }

    /* 通用 X 按鈕（小尺寸） */
    .btn-close-square {
        width: 44px;
        height: 44px;
        font-size: 1.3rem;
    }
}

@media (max-width: 576px) {
    /* 超小螢幕額外調整（如需要） */
}
