/* ================================================================
   NCOF products.css v2.1 — 無側欄，水平 Tab 導航
   Colour: Professional Blue + Wood Warmth
   ================================================================ */

/* ── Page Hero ───────────────────────────────────────────── */
.prod-hero {
    background: linear-gradient(135deg,
        rgba(11, 37, 48, 0.45) 0%,
        rgba(27, 85, 104, 0.30) 100%
    ), url('../images/ncof_hero.jpg') center 40% / cover no-repeat;
    padding: 3rem 2rem 2.25rem;
    position: relative;
    overflow: hidden;
}
.prod-hero::after {
    content: '';
    position: absolute;
    bottom: -1px; left: 0; right: 0;
    height: 44px;
    background: var(--bg-page);
    clip-path: ellipse(60% 100% at 50% 100%);
}
.prod-hero-inner {
    max-width: 1320px;
    margin: 0 auto;
}
.prod-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    margin-bottom: 0.85rem;
}
.prod-breadcrumb a { color: rgba(255,255,255,0.60); transition: color 0.2s; }
.prod-breadcrumb a:hover { color: var(--wood-light); }  /* 淡木色 hover ，取代舊金色 */
.prod-breadcrumb span { color: rgba(255,255,255,0.90); font-weight: 500; }
.prod-breadcrumb i { font-size: 0.55rem; color: rgba(255,255,255,0.30); }
.prod-hero-title {
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    color: #fff;
    font-weight: 400;
    margin: 0 0 0.4rem;
    letter-spacing: -0.5px;
}
.prod-hero-title span { color: var(--wood-light); font-style: italic; }  /* 淡木色 italic，取代舊金色 */
.prod-hero-count {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.55);
}
.prod-hero-count strong { color: var(--wood-light); }  /* 淡木色 */

/* ── Category Tab Bar ────────────────────────────────────── */
.cat-tab-wrap {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-light);
    box-shadow: 0 2px 12px rgba(0,0,0,0.05);
    position: sticky;
    top: 72px;
    z-index: 100;
}
.cat-tab-inner {
    max-width: 1320px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    gap: 0;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.cat-tab-inner::-webkit-scrollbar { display: none; }
.cat-tab-link {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.85rem 1.1rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    white-space: nowrap;
    border-bottom: 2.5px solid transparent;
    transition: color 0.2s, border-color 0.2s;
    flex-shrink: 0;
}
.cat-tab-link:hover {
    color: var(--primary);
    border-bottom-color: var(--border-mid);
}
.cat-tab-link.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 700;
}
.cat-tab-num {
    background: var(--primary-glow);
    color: var(--primary);
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.1rem 0.45rem;
    line-height: 1.6;
}
.cat-tab-link.active .cat-tab-num {
    background: var(--primary);
    color: #fff;
}

/* ── Main Content Area ───────────────────────────────────── */
.prod-main-wrap {
    max-width: 1320px;
    margin: 2rem auto 5rem;
    padding: 0 2rem;
}

/* ── Sub-category Grid ───────────────────────────────────── */
.subcat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2.5rem;
}
.subcat-card {
    background: var(--bg-white);
    border-radius: var(--r-md);
    border: 1px solid var(--border-light);
    padding: 1.25rem 1rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.65rem;
    color: var(--text-body);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 600;
    transition: var(--ease-decel);
    box-shadow: var(--s-xs);
    position: relative;
    overflow: hidden;
}
.subcat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    /* 頂線：主色 → 木色，溫暖點綴 */
    background: linear-gradient(90deg, var(--primary), var(--wood-light));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.35s ease;
}
.subcat-card:hover::before { transform: scaleX(1); }
.subcat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--s-green-lg);
    border-color: var(--border-mid);
    color: var(--primary);
}
.subcat-card img { max-height: 72px; width: auto; object-fit: contain; }
.subcat-icon { font-size: 1.8rem; color: var(--primary); opacity: 0.25; }

/* ── Toolbar (count + sort) ──────────────────────────────── */
.prod-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    gap: 1rem;
    flex-wrap: wrap;
}
.prod-toolbar-info {
    font-size: 0.85rem;
    color: var(--text-muted);
}
.prod-toolbar-info strong { color: var(--text-main); font-weight: 700; }

/* ── Product Grid ────────────────────────────────────────── */
.product-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
}
.prod-card {
    background: var(--bg-white);
    border-radius: var(--r-md);
    border: 1px solid var(--border-light);
    overflow: hidden;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    box-shadow: var(--s-xs);
    transition: var(--ease-decel);
}
.prod-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--s-green-lg);
    border-color: var(--border-mid);
}
.prod-card-img {
    position: relative;
    aspect-ratio: 4/3;
    background: var(--bg-white);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.prod-card-img img {
    width: 100%; height: 100%;
    object-fit: contain;
    padding: 0.75rem;
    transition: transform 0.42s ease;
}
.prod-card:hover .prod-card-img img { transform: scale(1.06); }
.prod-card-img i { font-size: 2.5rem; color: var(--primary); opacity: 0.15; }
.prod-card-overlay {
    position: absolute;
    inset: 0;
    /* 主色半透明 overlay，取代舊青藍 */
    background: rgba(35, 107, 130, 0.82);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.28s ease;
}
.prod-card:hover .prod-card-overlay { opacity: 1; }
.prod-card-overlay span {
    color: #fff;
    font-size: 0.82rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.45rem;
}
.prod-card-body {
    padding: 0.8rem 1rem;
    border-top: 1px solid var(--border-light);
}
.prod-card-code {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 0.2rem;
}
.prod-card-name {
    font-size: 0.85rem;
    color: var(--text-body);
    margin: 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ── Smart Pagination ────────────────────────────────────── */
.pagination-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    margin-top: 2.5rem;
    flex-wrap: wrap;
}
.page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 0.5rem;
    border-radius: var(--r-sm);
    border: 1.5px solid var(--border-light);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-body);
    text-decoration: none;
    transition: var(--ease);
    background: var(--bg-white);
    gap: 0.3rem;
}
.page-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-glow);
}
.page-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: var(--s-green-sm);
}
.page-btn.prev-next {
    padding: 0 0.85rem;
    font-size: 0.82rem;
}
.page-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    color: var(--text-muted);
    font-size: 0.9rem;
    letter-spacing: 2px;
    pointer-events: none;
}

/* ── Empty State ─────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 5rem 2rem;
    color: var(--text-muted);
}
.empty-state i {
    font-size: 3.5rem;
    display: block;
    margin-bottom: 1rem;
    opacity: 0.2;
    color: var(--primary);
}
.empty-state p { font-size: 1rem; margin-bottom: 1.25rem; }
.empty-state a {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--primary);
    color: #fff;
    padding: 0.65rem 1.75rem;
    border-radius: var(--r-pill);
    font-weight: 600;
    font-size: 0.88rem;
    text-decoration: none;
}

/* ── Product Detail ──────────────────────────────────────── */
.detail-wrap {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3.5rem;
    align-items: start;
}

/* 圖片欄 — 桌面版 sticky，讓右側資料欄可獨立捲動 */
.detail-img-col {
    position: sticky;
    top: calc(72px + 1.5rem);   /* header 高度 + 留白 */
    min-width: 0;
}

/* 圖片框 — 固定 1:1 比例，使用 position:relative 作為 img 的定位基準 */
.detail-img-frame {
    border-radius: var(--r-lg);
    background: #fff;
    border: 1px solid var(--border-light);
    overflow: hidden;
    aspect-ratio: 1 / 1;
    width: 100%;
    max-width: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
}

/* 主圖 — 嚴格 100% 寬高搭配 object-fit，徹底防範大圖撐破容器 */
.detail-img-frame img {
    width: 100%;
    height: 100%;
    object-fit: contain;   /* 圖片縮放至完整可見，不裁切 */
    transition: transform 0.4s ease;
}
.detail-img-frame img:hover { transform: scale(1.04); }

.detail-img-placeholder {
    text-align: center;
    color: var(--text-muted);
    opacity: 0.3;
}
.detail-img-placeholder i { font-size: 4rem; display: block; margin-bottom: 0.5rem; }
.detail-thumb-row {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}
.detail-thumb {
    width: 64px; height: 64px;
    object-fit: contain;
    border-radius: var(--r-sm);
    border: 2px solid var(--border-light);
    cursor: pointer;
    padding: 4px;
    background: #fff;
    transition: var(--ease);
}
.detail-thumb:hover, .detail-thumb.active {
    border-color: var(--primary);
    background: var(--primary-glow);
}
.detail-info-col { padding-top: 0.25rem; min-width: 0; }
.detail-badge {
    display: inline-block;
    background: var(--primary-glow);
    color: var(--primary);
    border: 1px solid var(--border-mid);
    border-radius: var(--r-pill);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 0.28rem 0.85rem;
    margin-bottom: 0.9rem;
}
.detail-code {
    font-family: 'Inter', sans-serif;
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-main);
    margin: 0 0 0.35rem;
    letter-spacing: -0.5px;
    word-break: break-word;
}
.detail-name {
    font-size: 1.05rem;
    font-weight: 400;
    color: var(--text-muted);
    margin: 0 0 1.5rem;
    word-break: break-word;
}
.detail-divider {
    height: 1px;
    background: var(--border-light);
    margin: 1.5rem 0;
}
.detail-desc {
    background: var(--bg-page);
    border-radius: var(--r-md);
    padding: 1.25rem 1.5rem;
    border: 1px solid var(--border-light);
    font-size: 0.92rem;
    line-height: 1.9;
    color: var(--text-body);
    margin-bottom: 2rem;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
    overflow-x: auto;
}
.detail-desc img {
    max-width: 100% !important;
    height: auto !important;
}
.detail-actions { display: flex; flex-wrap: wrap; gap: 0.85rem; }
.btn-detail-enquiry {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    padding: 0.85rem 2rem;
    border-radius: var(--r-pill);
    font-weight: 700;
    font-size: 0.92rem;
    text-decoration: none;
    box-shadow: var(--s-green-sm);
    transition: var(--ease-bounce);
}
.btn-detail-enquiry:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: var(--s-green-lg);
    color: #fff;
}
.btn-detail-back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-white);
    border: 1.5px solid var(--border-mid);
    color: var(--text-body);
    padding: 0.85rem 1.75rem;
    border-radius: var(--r-pill);
    font-weight: 600;
    font-size: 0.92rem;
    text-decoration: none;
    transition: var(--ease);
}
.btn-detail-back:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-glow);
}

/* ── Hero 返回按鈕（單品頁，顯示在深色 Hero 內）─────────── */
.prod-hero-back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    padding: 0.5rem 1.25rem;
    border-radius: var(--r-pill);
    border: 1.5px solid rgba(255,255,255,0.35);
    background: rgba(255,255,255,0.10);
    color: rgba(255,255,255,0.80);
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    backdrop-filter: blur(4px);
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.prod-hero-back i { font-size: 0.75rem; }
.prod-hero-back:hover {
    background: rgba(255,255,255,0.22);
    border-color: rgba(255,255,255,0.70);
    color: #fff;
}

/* ── Responsive ──────────────────────────────── */
/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 1024px) {
    .product-grid { grid-template-columns: repeat(3, 1fr); }
    /* 移除平板的 aspect-ratio 限制，維持 1:1 */
}
@media (max-width: 768px) {
    .prod-hero-title { font-size: 1.5rem; }
    .cat-tabs { gap: 0.5rem; }
    .cat-tab-link { padding: 0.5rem 0.9rem; font-size: 0.85rem; }
}

/* ── Cart UI ─────────────────────────────────────────────── */
.prod-card-actions {
    margin-top: 0.85rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-light);
    padding-top: 0.75rem;
}
.btn-view {
    font-size: 0.85rem;
    color: var(--text-muted);
    transition: var(--ease);
}
.prod-card:hover .btn-view { color: var(--primary); }

.btn-toggle-cart {
    background: #f1f5f9;
    color: #64748b;
    border: none;
    padding: 0.4rem 0.85rem;
    border-radius: var(--r-md);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--ease);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.btn-toggle-cart:hover {
    background: #e2e8f0;
    color: var(--primary);
}
.btn-toggle-cart.in-cart {
    background: var(--primary-glow);
    color: var(--primary-dark);
}

.btn-detail-cart {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    border: none;
    padding: 0.85rem 2rem;
    border-radius: var(--r-pill);
    font-weight: 700;
    font-size: 0.92rem;
    cursor: pointer;
    transition: var(--ease-bounce);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: var(--s-green-sm);
}
.btn-detail-cart span {
    color: #fff;
}
.btn-detail-cart:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: var(--s-green-lg);
    color: #fff;
}
.btn-detail-cart.in-cart {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #fff;
    border: none;
}

.floating-cart {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--primary);
    color: #fff;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 10px 25px rgba(35, 107, 130, 0.4);
    z-index: 1000;
    text-decoration: none;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
}
.floating-cart:hover {
    transform: translateY(-5px) scale(1.05);
    color: #fff;
    box-shadow: 0 15px 35px rgba(35, 107, 130, 0.5);
}
.cart-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #e11d48;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
}
.floating-cart.pop {
    animation: cartPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes cartPop {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

@media (max-width: 768px) {
    .floating-cart {
        bottom: 1.5rem;
        right: 1.5rem;
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
}

/* ── Toast Notification ────────────────────────────────────────── */
.cart-toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #fff;
    border-radius: var(--r-md);
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.2rem;
    width: 90%;
    max-width: 400px;
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border-left: 4px solid var(--primary);
}
.cart-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    visibility: visible;
}
.cart-toast-content {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}
.toast-icon {
    font-size: 1.5rem;
    color: var(--primary);
}
.toast-text {
    display: flex;
    flex-direction: column;
}
.toast-text strong {
    font-size: 0.95rem;
    color: var(--text-color);
}
.toast-text span {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.toast-btn {
    background: var(--primary-glow);
    color: var(--primary-dark);
    padding: 0.4rem 0.8rem;
    border-radius: var(--r-sm);
    font-size: 0.8rem;
    font-weight: 700;
    text-decoration: none;
    transition: var(--ease);
    white-space: nowrap;
}
.toast-btn:hover {
    background: var(--primary);
    color: #fff;
}
@media (max-width: 768px) {
    .cart-toast {
        bottom: 5.5rem;
    }
    .prod-main-wrap { padding: 0 1rem; margin-top: 1.5rem; }
    .cat-tab-inner { padding: 0 1rem; }
    .cat-tab-link { padding: 0.75rem 0.85rem; font-size: 0.8rem; }
    /* 單品頁：手機改單欄 */
    .detail-wrap { grid-template-columns: 1fr; gap: 1.5rem; }
    /* 手機上取消 sticky */
    .detail-img-col { position: static; }
    /* 手機圖片框維持 1:1，透過內距調整留白為左右各 0.75rem */
    .detail-img-frame { padding: 0.75rem; }
    .subcat-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
    .product-grid { grid-template-columns: repeat(3, 1fr); gap: 0.85rem; }
}
@media (max-width: 480px) {
    .product-grid { grid-template-columns: repeat(2, 1fr); gap: 0.65rem; }
    .prod-hero { padding: 2.5rem 1rem 2rem; }
    .prod-hero-title { font-size: 1.5rem; }
    .pagination-wrap { gap: 0.25rem; }
    .page-btn { min-width: 34px; height: 34px; font-size: 0.8rem; }
    /* 小型手機：維持 1:1，透過內距調整留白為左右各 0.5rem */
    .detail-img-frame { padding: 0.5rem; }
}

/* ── Image Lightbox ────────────────────────────────────────────── */
.lightbox {
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}
.lightbox.show {
    opacity: 1;
    visibility: visible;
}
.lightbox-content {
    max-width: 90vw;
    max-height: 80vh;
    object-fit: contain;
    border-radius: var(--r-md);
    transform: scale(0.95);
    transition: transform 0.3s ease;
}
.lightbox.show .lightbox-content {
    transform: scale(1);
}
.lightbox-close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #f8fafc;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
    z-index: 10000;
}
.lightbox-close:hover {
    color: var(--primary);
    transform: scale(1.1);
}
@media (max-width: 768px) {
    .lightbox-close {
        top: 15px;
        right: 20px;
        font-size: 35px;
    }
}
