@import url('https://fonts.googleapis.com/css2?family=PT+Serif:ital,wght@0,400;0,700;1,400;1,700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

/* ============================================
   全域基礎樣式
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #448899;
    --primary-dark: #366d7a;
    --secondary-color: #67717d;
    --accent-color: #5a9aa8;
    --text-dark: #333333;
    --text-light: #666666;
    --bg-light: #f8f9fa;
    --bg-gradient: radial-gradient(ellipse at bottom right, #e8eef2 25%, #f5f7f9 62%, #ffffff 100%);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
    --border-radius: 12px;
    --transition: all 0.3s ease;
}

/* 分頁樣式 */
.pagination {
    display: inline-flex;
    padding-left: 0;
    margin: 20px 0;
    border-radius: 8px;
    gap: 4px;
}

.pagination > li {
    display: inline;
}

.pagination > li > a,
.pagination > li > span {
    position: relative;
    padding: 8px 14px;
    line-height: 1.5;
    color: var(--primary-color);
    text-decoration: none;
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    transition: var(--transition);
}

.pagination > li > a:hover,
.pagination > li > span:hover {
    color: #fff;
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

.pagination > .active > a,
.pagination > .active > span {
    color: #fff;
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.pagination > .disabled > a,
.pagination > .disabled > span {
    color: #999;
    cursor: not-allowed;
    background-color: #f5f5f5;
}

/* 搜尋框下拉效果 */
.ui-autocomplete {
    text-align: left;
    background-color: rgba(255, 255, 255, 0.98);
    color: var(--text-dark);
    padding: 8px 0;
    font-family: 'Poppins', sans-serif;
    font-size: 15px;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    border: 1px solid #e0e0e0;
    max-height: 300px;
    overflow-y: auto;
}

.ui-menu-item {
    padding: 10px 16px;
    cursor: pointer;
    transition: var(--transition);
}

.ui-menu-item:hover,
.ui-state-active {
    background-color: var(--bg-light);
    color: var(--primary-color);
}

.ui-state-active,
.ui-widget-content .ui-state-active {
    border: none;
    background-color: var(--primary-color);
    color: #fff;
    font-weight: 500;
}

.hr-dashed2 {
    border: 0;
    border-top: 2px dashed #ccd5db;
    margin: 40px 0;
}

/* ============================================
   產品照片卡片
   ============================================ */
.picbox {
    cursor: pointer;
    margin: 12px;
    flex: none;
    display: flex;
    flex-direction: column;
    width: calc(25% - 24px);
    text-align: center;
    height: 280px;
    background: #ffffff;
    border: 1px solid #e8e8e8;
    border-radius: var(--border-radius);
    position: relative;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    overflow: hidden;
}

.picbox:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
}

.picbox:hover .pic_inset {
    box-shadow: inset 0 0 0 3px var(--primary-color);
}

.picbox::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 40%;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.6) 0%, transparent 100%);
    z-index: 5;
    pointer-events: none;
}

.model {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 70px;
    z-index: 1;
    display: flex;
    align-items: center;
    background: linear-gradient(to top, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 0.95) 100%);
}

.model p {
    width: 100%;
    padding: 8px 12px;
    margin: 0;
    font-size: 13px;
    font-weight: 400;
    color: var(--text-light);
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.pic_inset, .pic {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 210px;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    transition: var(--transition);
}

.pic {
    object-fit: contain;
    background: #fafafa;
}

.pic_inset {
    box-shadow: inset 0 -30px 30px -30px rgba(0, 0, 0, 0.05);
    pointer-events: none;
}

.title {
    position: absolute;
    top: 170px;
    width: 100%;
    height: 40px;
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--primary-dark) 100%);
}

.title p {
    height: 40px;
    line-height: 40px;
    font-weight: 600;
    font-size: 14px;
    color: #ffffff;
    padding: 0 12px;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 產品詳情頁 */
.product_picbox {
    max-width: 550px;
    max-height: 550px;
    display: flex;
    overflow: hidden;
    flex: none;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    background-color: white;
    margin-right: 30px;
}

.product_pic {
    width: 100%;
    height: auto;
    object-fit: contain;
    max-height: 550px;
    max-width: 550px;
    margin: auto;
}

.product_box {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin: auto;
    margin-bottom: 20px;
}

.product_detail hr,
.product_detail .p1 {
    margin-top: 6px;
    margin-bottom: 8px;
}

.detail {
    padding: 16px;
    flex: 1 1 auto;
    gap: 12px;
}

.col {
    line-height: 1.8;
    border-bottom: 1px solid #e8e8e8;
    padding: 8px 0;
}

.caption {
    color: var(--primary-dark);
    font-weight: 500;
}

/* 產品規格區塊 */
.fields {
    background: var(--bg-light);
    border-radius: var(--border-radius);
    padding: 16px;
}

.fields .row {
    margin-bottom: 0;
}

.fields .lastFieldRow {
    border-bottom: 1px solid #e0e0e0;
    padding: 10px 0;
}

.fields .lastFieldRow:last-child {
    border-bottom: none;
}

#product_desc {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-light);
    margin-bottom: 20px;
    padding: 16px;
    background: linear-gradient(135deg, #f8fafb 0%, #ffffff 100%);
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
}

/* ============================================
   基礎排版
   ============================================ */
body {
    margin: 0;
    font-size: 16px;
    text-align: center;
    padding-top: 90px;
    font-family: 'Poppins', 'Microsoft JhengHei', sans-serif;
    background: var(--secondary-color);
    color: var(--text-dark);
}

button, input {
    border: none;
    background-color: white;
    border-radius: 6px;
    font-family: inherit;
}

input[disabled], button[disabled] {
    cursor: not-allowed;
    opacity: 0.6;
}

input:focus, button:focus {
    outline: none;
}

.hidden {
    display: none;
}

#page-container {
    background: var(--bg-gradient);
    min-height: calc(100vh - 90px);
}

#go_top {
    cursor: pointer;
    position: fixed;
    right: 0;
    bottom: 12vh;
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border-radius: 8px 0 0 8px;
    opacity: 0.9;
    font-size: 18px;
    color: white;
    font-weight: bold;
    line-height: 48px;
    box-shadow: var(--shadow-md);
    z-index: 100;
    transition: var(--transition);
}

#go_top:hover {
    opacity: 1;
    transform: translateX(-4px);
}

/* ============================================
   導航欄
   ============================================ */
nav {
    position: fixed;
    background: linear-gradient(180deg, #ffffff 0%, #f8f9fa 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.08);
    top: 0;
    width: 100%;
    height: 90px;
    z-index: 1000;
    border: 0;
}

.frame {
    display: flex;
    align-items: center;
    width: 1200px;
    height: 34px;
}

.logo {
    height: 80px;
    cursor: pointer;
    position: relative;
    transition: var(--transition);
}

.logo:hover {
    transform: scale(1.02);
}

[hint]:hover:after {
    opacity: 1;
    transition: all 0.2s ease 0.3s;
    visibility: visible;
}

[hint]:after {
    content: attr(hint);
    position: absolute;
    bottom: -2.5em;
    left: 0;
    padding: 6px 12px;
    color: var(--text-light);
    font-size: 14px;
    white-space: nowrap;
    background-color: #fff;
    border-radius: 6px;
    box-shadow: var(--shadow-md);
    opacity: 0;
    z-index: 999;
    visibility: hidden;
}

[errhint]:after {
    content: attr(errhint);
    position: absolute;
    bottom: 3em;
    right: 0.75em;
    padding: 4px 10px;
    color: #2e7d32;
    line-height: 1.6;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    background-color: #e8f5e9;
    box-shadow: var(--shadow-sm);
    border-radius: 6px;
    z-index: 999;
    visibility: visible;
}

[hint], [errhint] {
    position: relative;
}

.right {
    margin-top: 12px;
    display: flex;
    flex: auto;
    position: relative;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
}

.item {
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    color: var(--text-light);
    padding: 10px 16px;
    border-radius: 8px;
    transition: var(--transition);
}

.item:hover, .active-item {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: #fff;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

/* 手機版導航 */
.mobile {
    display: none;
}

.mobile #search {
    width: 180px;
    box-shadow: inset 1px 2px 4px rgba(0, 0, 0, 0.1);
}

.nav-item {
    cursor: pointer;
    text-align: left;
    padding: 12px 16px;
    margin: 4px 0;
    border-radius: 8px;
    font-size: 16px;
    transition: var(--transition);
}

.nav-item:hover, .active-nav-item {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: #fff;
    font-weight: 600;
}

.offcanvas, .offcanvas-lg, .offcanvas-md, .offcanvas-sm, .offcanvas-xl, .offcanvas-xxl {
    --bs-offcanvas-width: 300px;
    background: linear-gradient(180deg, #ffffff 0%, #f8f9fa 100%);
}

.offcanvas-header {
    padding: 20px;
    border-bottom: 1px solid #e8e8e8;
}

.offcanvas-header img {
    height: 60px;
}

.offcanvas-body {
    padding: 16px;
}

/* ============================================
   歡迎橫幅
   ============================================ */
.welcome {
    background: url(/dist/pic/welcome21.png) no-repeat right;
    background-size: cover;
    height: 180px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 40px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    position: relative;
}

.welcome::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(to top, rgba(248, 249, 250, 0.8) 0%, transparent 100%);
    pointer-events: none;
}

.slogan {
    width: 1200px;
    height: 170px;
    position: relative;
    z-index: 1;
}

.slogan span, .slogan h1 {
    text-align: left;
    display: flex;
    color: #ffffff;
}

.slogan h1 {
    height: 44px;
    margin: 25px auto 20px;
    font-family: "PT Serif", serif;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.3);
    font-style: italic;
    font-size: 2.2rem;
}

.searchbox {
    position: relative;
    display: flex;
}

#search {
    width: 420px;
    height: 50px;
    border-radius: 8px 0 0 8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 12px 18px;
    background: rgba(255, 255, 255, 0.95);
    font-weight: 500;
    font-size: 15px;
    color: var(--text-dark);
    transition: var(--transition);
}

#search:focus {
    border-color: var(--primary-color);
    box-shadow: 0 4px 20px rgba(68, 136, 153, 0.3);
}

#search::placeholder {
    color: #999;
}

#search_icon {
    height: 50px;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
    width: 60px;
    background: url(/dist/pic/ico_search.png) center center no-repeat;
    background-size: 28px 28px;
    background-color: var(--primary-color);
    transition: var(--transition);
}

#search_icon:hover {
    background-color: var(--primary-dark);
}

/* ============================================
   頁尾
   ============================================ */
footer {
    min-height: 140px;
    width: 100%;
    background: linear-gradient(135deg, var(--secondary-color) 0%, #4a545e 100%);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    display: flex;
    padding: 24px 0;
}

.footer-box {
    width: 90%;
    max-width: 1200px;
    margin: auto;
}

footer p {
    font-weight: 400;
    font-size: 14px;
    position: relative;
    line-height: 1.6;
    padding: 2px 8px;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 0.5rem;
}

footer i {
    color: #a8d4cf;
    margin-right: 6px;
}

.copyright {
    font-family: "PT Serif", serif;
    font-style: italic;
    color: #ffffff;
    font-weight: 600;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.2);
}

a {
    text-decoration: none;
    transition: var(--transition);
}

footer a:link {
    color: #d4f0be;
}

footer a:hover {
    color: #fff;
}

/* ============================================
   主內容區塊
   ============================================ */
#main {
    width: 1200px;
    display: flex;
    flex-wrap: wrap;
    margin: auto;
    justify-content: flex-start;
    padding-bottom: 60px;
}

#line {
    width: 1200px;
    margin: auto;
    padding-bottom: 60px;
}

#line div {
    text-align: left;
}

#line a {
    color: var(--primary-color);
}

#line a:hover {
    color: var(--primary-dark);
}

#line p {
    text-align: left;
    margin-bottom: 16px;
    line-height: 1.7;
}

.p1 {
    font-family: "PT Serif", serif;
    font-size: 22px;
    font-weight: 700;
    font-style: italic;
    color: var(--text-dark);
    margin-bottom: 16px;
}

.p2 {
    color: var(--primary-color);
    font-weight: 700;
}

/* 首頁圖片 */
.home_pic {
    box-shadow: var(--shadow-md);
    object-fit: contain;
    border-radius: var(--border-radius);
}

/* ============================================
   分類卡片
   ============================================ */
.kind_box {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
}

.kind {
    flex: none;
    width: calc(33.333% - 12px);
    padding: 20px 24px;
    font-size: 17px;
    font-weight: 500;
    cursor: pointer;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid #e8e8e8;
    transition: var(--transition);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.kind:hover {
    color: var(--primary-color);
    background: linear-gradient(135deg, #f0f7f9 0%, #e8f4f5 100%);
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
}

.count {
    font-size: 14px;
    color: #999;
    background: #f0f0f0;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 400;
}

.kind:hover .count {
    background: var(--primary-color);
    color: #fff;
}

/* 麵包屑導航 */
.breadcrumb {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    padding: 16px 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
}

.breadcrumb-item a {
    color: var(--primary-color) !important;
    font-weight: 500;
}

.breadcrumb-item a:hover {
    color: var(--primary-dark) !important;
}

.breadcrumb-item.active {
    color: var(--text-dark);
    font-weight: 600;
}

/* ============================================
   Demo 影片區塊
   ============================================ */
section {
    box-sizing: border-box;
    padding: 20px;
    width: 800px;
    text-align: center;
    position: relative;
    background: #ffffff;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    justify-content: center;
    align-items: center;
    margin: auto;
    margin-bottom: 30px;
    transition: var(--transition);
}

section:hover {
    box-shadow: var(--shadow-lg);
}

.demo {
    box-sizing: border-box;
    position: relative;
    width: 100%;
    margin: auto;
    padding-top: 56.25%;
    border-radius: 8px;
    overflow: hidden;
}

.demo iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 8px;
}

.demo_inset {
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.05);
    pointer-events: none;
}

h6 {
    font-weight: 600;
    text-align: center;
    margin-top: 12px;
    color: var(--text-dark);
}

/* ============================================
   eBook 圖片對話框
   ============================================ */
[pic_dialog], [pic_dialog] img {
    cursor: pointer;
    width: 300px;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

[pic_dialog]:hover img {
    transform: scale(1.03);
    box-shadow: var(--shadow-lg);
}

.dialog {
    box-sizing: border-box;
    position: relative;
    margin: auto;
    box-shadow: var(--shadow-lg);
    border: none;
    outline: none;
    border-top: 4px solid var(--primary-color);
    border-radius: var(--border-radius);
    padding: 0;
    overflow: auto;
    resize: both;
}

dialog::backdrop {
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.dialog_title {
    height: 40px;
    position: sticky;
    top: 0;
    left: 0;
    width: 100%;
    background: white;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    box-sizing: border-box;
    border-bottom: 1px solid #e8e8e8;
}

.dialog img {
    top: 40px;
    width: 640px;
    margin: 12px;
}

.dialog h6 {
    flex: auto;
    text-align: center;
    margin: 0;
}

.close {
    cursor: pointer;
    flex: none;
    width: 24px;
    height: 24px;
    background: url(/dist/pic/ico_close.png) center center no-repeat;
    background-size: 16px 16px;
    border-radius: 50%;
    transition: var(--transition);
}

.close:hover {
    background-color: #f0f0f0;
}

/* ============================================
   地圖區塊
   ============================================ */
.map_box {
    width: 100%;
    height: 420px;
    position: relative;
    margin: auto;
}

.map_box iframe, .map_inset {
    width: 100%;
    height: 420px;
    border-radius: var(--border-radius);
}

.map_box iframe {
    position: absolute;
    left: 0;
    border: none;
    margin: 0;
}

.map_inset {
    position: absolute;
    left: 0;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.05);
    pointer-events: none;
}

/* 按鈕樣式 */
.btn-success {
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--primary-dark) 100%);
    border: none;
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 500;
    transition: var(--transition);
}

.btn-success:hover {
    background: linear-gradient(135deg, #4a8a98 0%, #2d6670 100%);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-primary {
    background: linear-gradient(135deg, #6a89cc 0%, #4a69bd 100%);
    border: none;
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 500;
    transition: var(--transition);
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #5a79bc 0%, #3a59ad 100%);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ============================================
   工具類別
   ============================================ */
.offset-top-20 {
    margin-top: 20px;
}

.text-left {
    text-align: left;
}

/* ============================================
   響應式設計
   ============================================ */
@media (max-width: 1200px) {
    .slogan {
        margin: 0 20px;
        width: auto;
    }
    
    #main, #line {
        width: 95%;
    }
    
    .picbox {
        width: calc(33.333% - 24px);
    }
    
    .kind {
        width: calc(50% - 8px);
    }
    
    .product_picbox {
        max-width: 450px;
    }
    
    #go_top {
        width: 40px;
        height: 40px;
        line-height: 40px;
    }
}

@media (max-width: 992px) {
    .picbox {
        width: calc(50% - 24px);
    }
    
    .product_picbox {
        max-width: 100%;
        margin: 0 auto 24px;
    }
    
    .product_box {
        flex-direction: column;
        align-items: center;
    }
    
    section {
        width: 95%;
    }
}

@media (max-width: 768px) {
    body {
        padding-top: 80px;
    }
    
    nav {
        height: 80px;
    }
    
    .mobile {
        display: block;
    }
    
    .item {
        display: none;
    }
    
    .home_pic {
        width: 90%;
    }
    
    footer {
        min-height: 180px;
    }
    
    .welcome {
        height: 160px;
        margin-bottom: 30px;
    }
    
    .slogan h1 {
        font-size: 1.8rem;
    }
    
    #search {
        width: 280px;
    }
    
    .kind {
        width: 100%;
    }
}

@media (max-width: 576px) {
    .picbox {
        width: calc(100% - 24px);
        margin: 12px auto;
    }
    
    #search {
        width: 220px;
        height: 44px;
    }
    
    #search_icon {
        height: 44px;
        width: 50px;
    }
    
    .p1 {
        font-size: 18px;
    }
    
    .welcome {
        height: 140px;
    }
    
    .slogan h1 {
        font-size: 1.5rem;
    }
    
    [pic_dialog], [pic_dialog] img {
        width: 90%;
    }
}

@media (max-width: 400px) {
    nav {
        height: 70px;
    }
    
    .logo {
        height: 60px;
    }
    
    footer p, .copyright {
        font-size: 0.85rem;
    }
    
    .slogan h1 {
        font-size: 1.3rem;
    }
}
