/* ==========================================================================
   AGT Product Catalog — 預設前台樣式
   涵蓋範圍：catalog-wrap.php / catalog-card.php / single-product-content.php
   ========================================================================== */

:root {
    --agt-pv-primary: #1b6ef3;
    --agt-pv-primary-dark: #0f4fc0;
    --agt-pv-text: #1f2430;
    --agt-pv-muted: #6b7280;
    --agt-pv-border: #e5e7eb;
    --agt-pv-bg-card: #ffffff;
    --agt-pv-bg-page: #f7f8fa;
    --agt-pv-radius: 12px;
    --agt-pv-shadow: 0 1px 3px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.04);
    --agt-pv-shadow-hover: 0 8px 24px rgba(16, 24, 40, 0.12);
}

.agt-pv-wrap, .agt-pv-detail {
    color: var(--agt-pv-text);
    font-size: 15px;
    line-height: 1.6;
}

.agt-pv-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 28px;
    align-items: center;
}

.agt-pv-toolbar input[type="text"],
.agt-pv-toolbar input[type="search"] {
    flex: 1 1 240px;
    padding: 10px 14px;
    border: 1px solid var(--agt-pv-border);
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
}

.agt-pv-toolbar select {
    padding: 10px 14px;
    border: 1px solid var(--agt-pv-border);
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    min-width: 160px;
}

.agt-pv-toolbar input:focus,
.agt-pv-toolbar select:focus {
    outline: none;
    border-color: var(--agt-pv-primary);
    box-shadow: 0 0 0 3px rgba(27, 110, 243, 0.15);
}

.agt-pv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.agt-pv-no-results {
    padding: 40px 0;
    text-align: center;
    color: var(--agt-pv-muted);
    font-size: 15px;
}

.agt-pv-card {
    background: var(--agt-pv-bg-card);
    border: 1px solid var(--agt-pv-border);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    display: flex;
    flex-direction: column;
}

.agt-pv-card:hover {
    box-shadow: var(--agt-pv-shadow-hover);
    transform: translateY(-2px);
}

.agt-pv-card > a:first-child {
    display: block;
    text-decoration: none;
    color: inherit;
}

.agt-pv-card-image {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block;
    background: var(--agt-pv-bg-page);
}

/* 用 !important：主題（Divi）對 h3 有全域字體設定，字級/行高不加
   !important 會被蓋掉，跟預期的卡片標題大小格式不一致 */
.agt-pv-card-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 16px 16px 8px;
    font-size: 18px !important;
    font-weight: 600 !important;
    line-height: 1.4 !important;
    min-height: 50px;
    color: var(--agt-pv-text) !important;
}

/* 用 !important：主題對 <p> 有全域字體設定（body p { font-size:20px
   !important; line-height:1.5em !important }），不加會被蓋掉 */
.agt-pv-card-category {
    margin: 0 16px 10px;
    font-size: 17px !important;
    font-weight: 600;
    line-height: 1.4 !important;
    color: var(--agt-pv-muted);
}

.agt-pv-card-meta {
    margin: 0 16px 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 15px !important;
    line-height: 1.4 !important;
}

.agt-pv-card-model,
.agt-pv-card-sku {
    background: var(--agt-pv-bg-page);
    color: var(--agt-pv-muted);
    border-radius: 999px;
    padding: 2px 12px;
    white-space: nowrap;
}

.agt-pv-card-sku {
    font-size: 11pt;
}

/* 前往購買：跟 Buy Now 一樣是文字連結，貼近規格資訊，不是主要 CTA。
   用 !important：主題對 <a> 也有全域字體設定（body a { font-size:20px
   !important; line-height:1.5em !important }），不加會被蓋掉 */
.agt-pv-card-shop-link {
    margin: 0 16px 12px;
    display: inline-block;
    font-size: 13pt !important;
    font-weight: 600;
    line-height: 1.4 !important;
    color: #cbb790;
    text-decoration: none;
}

.agt-pv-card-shop-link:hover {
    color: #a58a59;
}

/* 查看詳情：主要 CTA 按鈕，margin-top: auto 把它自己推到卡片最底部，
   跟前面緊接在規格資訊下方的「前往購買」文字連結拉開視覺層級 */
.agt-pv-card-link {
    margin: auto 16px 16px;
    display: block;
    text-align: center;
    padding: 10px 16px;
    border-radius: 6px;
    background: #373838;
    color: #fff !important;
    font-size: 18px !important;
    font-weight: 600;
    line-height: 1.4 !important;
    text-decoration: none !important;
    transition: background 0.15s ease;
}

.agt-pv-card-link:hover {
    background: #000;
}

.agt-pv-detail {
    max-width: 860px;
    margin: 0 auto;
}

.agt-pv-detail-image {
    border-radius: var(--agt-pv-radius);
    overflow: hidden;
    background: var(--agt-pv-bg-page);
    box-shadow: var(--agt-pv-shadow);
}

.agt-pv-detail-image img {
    width: 100%;
    display: block;
    object-fit: cover;
}

.agt-pv-detail-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

.agt-pv-detail-gallery-thumb {
    width: 84px;
    height: 84px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--agt-pv-border);
    cursor: pointer;
    transition: border-color 0.15s ease, transform 0.15s ease;
}

.agt-pv-detail-gallery-thumb:hover {
    border-color: var(--agt-pv-primary);
    transform: translateY(-2px);
}

.agt-pv-detail-body {
    margin-top: 28px;
}

.agt-pv-detail-category {
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--agt-pv-primary);
    background: rgba(27, 110, 243, 0.1);
    padding: 4px 10px;
    border-radius: 999px;
    margin-bottom: 10px;
}

/* 用 !important：主題對 h1 有全域字體設定（font-size:80px!important），
   不加 !important 標題會直接被主題蓋成 80px */
.agt-pv-detail-title {
    font-size: 28px !important;
    font-weight: 700;
    line-height: 1.3 !important;
    margin: 0 0 12px;
    color: var(--agt-pv-text);
}

.agt-pv-detail-model,
.agt-pv-detail-sku {
    font-size: 14px;
    color: var(--agt-pv-muted);
    margin: 0 0 4px;
}

.agt-pv-detail-description {
    margin-top: 20px;
    font-size: 15px;
    line-height: 1.75;
    color: var(--agt-pv-text);
}

.agt-pv-detail-description p {
    margin: 0 0 1em;
}

.agt-pv-detail-shop-link {
    display: inline-block;
    margin-top: 24px;
    padding: 14px 28px;
    border-radius: 10px;
    background: var(--agt-pv-primary);
    color: #fff !important;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none !important;
    box-shadow: 0 2px 8px rgba(27, 110, 243, 0.35);
    transition: background 0.15s ease, box-shadow 0.15s ease;
}

.agt-pv-detail-shop-link:hover {
    background: var(--agt-pv-primary-dark);
    box-shadow: 0 4px 14px rgba(27, 110, 243, 0.45);
}

@media (max-width: 600px) {
    .agt-pv-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 14px;
    }

    .agt-pv-detail-title {
        font-size: 22px !important;
    }
}

/* ==========================================================================
   列表頁 — 左側分類側邊欄（大分類 / 子分類樹狀導覽）
   ========================================================================== */

.agt-pv-catalog-wrap {
    display: flex;
    align-items: flex-start;
    gap: 32px;
}

.agt-pv-catalog-sidebar {
    flex: 0 0 220px;
    max-width: 220px;
}

/* 用 !important：主題對 h3 有全域字體設定（body h3 { font-size:30px
   !important; line-height:1.5em !important }），不加會被蓋掉 */
.agt-pv-catalog-sidebar-title {
    margin: 0 0 12px;
    font-size: 13px !important;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    line-height: 1.4 !important;
    color: var(--agt-pv-muted);
}

.agt-pv-category-tree,
.agt-pv-category-children {
    list-style: none;
    margin: 0;
    padding: 0;
}

.agt-pv-category-children {
    display: none;
    margin-top: 4px;
    margin-left: 14px;
    border-left: 1px solid var(--agt-pv-border);
    padding-left: 10px;
}

.agt-pv-category-item.is-expanded > .agt-pv-category-children {
    display: block;
}

.agt-pv-category-item {
    margin-bottom: 2px;
}

/* 用 !important：主題對 <a> 有全域字體設定（body a { font-size:20px
   !important; line-height:1.5em !important }），不加會被蓋掉 */
.agt-pv-category-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 20px !important;
    line-height: 1.4 !important;
    color: var(--agt-pv-text);
    text-decoration: none !important;
    transition: background 0.15s ease, color 0.15s ease;
}

.agt-pv-category-item .agt-pv-category-children .agt-pv-category-link {
    padding: 6px 10px;
    font-size: 16px !important;
    color: var(--agt-pv-muted);
}

.agt-pv-category-link:hover {
    background: var(--agt-pv-bg-page);
    color: var(--agt-pv-primary);
}

.agt-pv-category-item.is-active > .agt-pv-category-link {
    background: rgba(27, 110, 243, 0.1);
    color: var(--agt-pv-primary);
    font-weight: 700;
}

.agt-pv-category-toggle {
    flex: 0 0 auto;
    width: 8px;
    height: 8px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(-45deg);
    transition: transform 0.15s ease;
    opacity: 0.5;
}

.agt-pv-category-item.is-expanded > .agt-pv-category-link .agt-pv-category-toggle {
    transform: rotate(45deg);
}

.agt-pv-catalog-main {
    flex: 1 1 auto;
    min-width: 0;
}

.agt-pv-catalog-heading-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

/* 用 !important：主題對 h2 有全域字體設定（h2 { font-size:28px
   !important }），不加會被蓋掉 */
.agt-pv-catalog-current-category {
    margin: 0;
    font-size: 20px !important;
    font-weight: 700;
    color: var(--agt-pv-text);
}

/* 搜尋列已移除分類下拉選單，input 直接佔滿寬度 */
.agt-pv-catalog-filters input[type="text"] {
    width: 100%;
    padding: 14px 18px;
    font-size: 15px;
    color: var(--agt-pv-text);
    background: #fff;
    border: 1px solid var(--agt-pv-border);
    border-radius: 10px;
    outline: none;
    box-sizing: border-box;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.agt-pv-catalog-filters input[type="text"]::placeholder {
    color: var(--agt-pv-muted);
}

.agt-pv-catalog-filters input[type="text"]:hover {
    border-color: #c9c9c9;
}

.agt-pv-catalog-filters input[type="text"]:focus {
    border-color: var(--agt-pv-primary);
    box-shadow: 0 0 0 3px rgba(27, 110, 243, 0.12);
}

.agt-pv-pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

.agt-pv-grid + .agt-pv-pagination {
    margin-top: 28px;
}

/* 用 !important：主題對 <a> 有全域字體設定，見上面 .agt-pv-category-link 的說明 */
.agt-pv-page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: 8px;
    border: 1px solid var(--agt-pv-border);
    font-size: 14px !important;
    line-height: 1.4 !important;
    color: var(--agt-pv-text);
    text-decoration: none !important;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.agt-pv-page-link:hover {
    background: var(--agt-pv-bg-page);
    border-color: var(--agt-pv-primary);
    color: var(--agt-pv-primary);
}

.agt-pv-page-link.is-active {
    background: var(--agt-pv-primary);
    border-color: var(--agt-pv-primary);
    color: #fff;
    font-weight: 700;
}

@media (max-width: 780px) {
    .agt-pv-catalog-wrap {
        flex-direction: column;
    }

    .agt-pv-catalog-sidebar {
        flex: 1 1 auto;
        max-width: none;
        width: 100%;
    }
}
