/* ==========================================================================
   基本重置與全域設定 (Reset & Global)
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, 'Microsoft JhengHei', sans-serif;
    background-color: #f0f2f5; 
    color: #333;
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ==========================================================================
   頁首與選單 (Header & Navigation)
   ========================================================================== */
.site-header {
    background-color: #1e293b; 
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo a {
    font-size: 24px;
    font-weight: bold;
    color: #fff;
    letter-spacing: 1px;
}

.logo span {
    color: #38bdf8; 
}

.main-nav .nav-menu {
    list-style: none;
    display: flex;
    align-items: center;
}

.nav-menu > li {
    position: relative;
    margin-left: 20px;
}

.nav-menu a {
    display: block;
    padding: 10px 15px;
    transition: color 0.3s;
}

.nav-menu a:hover {
    color: #38bdf8;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #fff;
    color: #333;
    min-width: 160px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    list-style: none;
    border-radius: 4px;
    overflow: hidden;
    z-index: 1000;
}

.dropdown:hover .dropdown-menu {
    display: block;
}

.dropdown-menu a {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
}

.dropdown-menu a:hover {
    background-color: #f8fafc;
    color: #0ea5e9;
}

.menu-toggle, .hamburger-btn {
    display: none;
}

.hamburger-btn span {
    display: block;
    width: 25px;
    height: 3px;
    background-color: #fff;
    transition: 0.3s;
}

/* ==========================================================================
   一般內容頁面排版 (關於我們、最新消息、聯絡我們)
   ========================================================================== */
.main-content {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
}

/* 針對 HTML 缺少外層容器的修復：直接讓 section 限制寬度並置中 */
.content-section {
    background-color: #ffffff; 
    padding: 40px;
    margin: 40px auto; 
    max-width: 1200px; 
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05); 
}

h1, h2 {
    color: #0f172a;
    margin-bottom: 25px;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 10px;
}

/* 公司發展時間軸 */
.timeline {
    border-left: 3px solid #cbd5e1;
    padding-left: 20px;
    margin-left: 10px;
}

.timeline-item {
    position: relative;
    margin-bottom: 20px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -28px;
    top: 6px;
    width: 12px;
    height: 12px;
    background-color: #38bdf8;
    border-radius: 50%;
}

.timeline-item strong {
    color: #0284c7;
}

/* ==========================================================================
   購物車商品列表排版 (ASP.NET DataList 修復)
   ========================================================================== */
.wrapper, #main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 10px; 
    background-color: #f0f2f5; 
}

table {
    border-collapse: collapse;
    width: 100%;
    margin: 0 auto;
}

#MyDataList {
    width: 100% !important; 
    margin: 20px auto;
}

.product_item {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 15px;
    margin: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    vertical-align: top;
    display: inline-block; 
    width: calc(25% - 20px) !important; 
    box-sizing: border-box;
    transition: transform 0.2s, box-shadow 0.2s;
}

.product_item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}

.product_item img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    border-color: #eee !important;
    border-radius: 4px;
}

/* ★ 修正品名字體模糊與擠壓問題 ★ */
span.product_title_link {
    display: block;
    margin-top: 10px;
    margin-bottom: 10px;
    height: 48px; /* 加大高度，讓兩行文字有足夠的呼吸空間 */
}

a.product_title_link {
    display: -webkit-box;
    font-size: 15px; /* 稍微加大字體 */
    color: #0f172a;
    font-weight: bold; /* 加粗，增加清晰度 */
    line-height: 1.6; /* 增加行高，防止上下文字重疊模糊 */
    overflow: hidden;
    text-overflow: ellipsis;
    -webkit-line-clamp: 2; /* 限制顯示兩行 */
    -webkit-box-orient: vertical;
    word-break: break-all; /* 防止長英文單字不換行破壞版面 */
}

.product_item img[src*="icon_product"] {
    display: inline-block;
    vertical-align: middle;
    margin-right: 5px;
    margin-bottom: 2px;
}

.product_item input[type="image"] {
    display: inline-block;
    vertical-align: middle;
    margin: 2px 5px 2px 0; 
    max-width: 48%; 
}

/* ★ 價格標示與標題字體優化 ★ */
.PRODUCT_LIST_PRICE {
    display: block;
    margin-bottom: 3px;
    font-size: 14px;
    color: #64748b;
}

.PRODUCT_LIST_PRICE s {
    color: #94a3b8;
}

.PRODUCT_PRICE {
    color: #e11d48; /* 購物網站常見的紅色促銷價 */
    font-weight: bold;
    font-size: 18px; /* 放大金額數字 */
    display: block;
    margin-bottom: 10px;
}

/* 修正「定價:」與「售價:」字太小的問題，並保持同行顯示 */
.PRODUCT_PRICE span[id*="title"],
.PRODUCT_LIST_PRICE span[id*="title"] {
    color: #475569;
    font-size: 15px; /* 放回正常大小的 15px */
    font-weight: normal;
    display: inline-block; /* 防止不正常斷行 */
    margin-right: 5px;
}

.PRODUCT_PRICE span[id*="dollar"],
.PRODUCT_LIST_PRICE span[id*="dollar"] {
    font-size: 14px;
    font-weight: normal;
    margin-left: 2px;
}

/* ==========================================================================
   全域表單元件優化 (搜尋框、留言板)
   ========================================================================== */
.FIELD {
    background-color: #ffffff;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 20px;
    text-align: center;
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-family: inherit;
    font-size: 14px;
    background-color: #ffffff;
    color: #333;
    outline: none;
    display: inline-block;
    vertical-align: middle;
    max-width: 100%;
    transition: border-color 0.3s, box-shadow 0.3s;
    margin: 5px;
}

/* 針對留言板大區塊的自動撐滿 */
.content-section input[type="text"],
.content-section input[type="email"],
.content-section textarea {
    display: block;
    width: 100%;
    margin: 10px 0;
}

select {
    height: 38px;
    cursor: pointer;
}

input[type="text"]:focus, textarea:focus, select:focus {
    border-color: #38bdf8;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}

.submit-btn,
button,
input[type="submit"],
input[type="button"] {
    background-color: #0ea5e9;
    color: #ffffff;
    border: none;
    padding: 8px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    display: inline-block;
    vertical-align: middle;
    transition: background-color 0.3s, transform 0.1s;
    margin: 5px;
}

input[type="submit"]:hover, .submit-btn:hover {
    background-color: #0284c7;
}

/* 分頁連結優化 */
.next_page {
    margin: 30px 0;
}
.next_page a {
    display: inline-block;
    padding: 5px 12px;
    background-color: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    color: #333;
    transition: 0.3s;
}
.next_page a:hover {
    background-color: #0ea5e9;
    color: #fff;
    border-color: #0ea5e9;
}

/* ==========================================================================
   頁尾 (Footer)
   ========================================================================== */
.site-footer {
    background-color: #0f172a;
    color: #94a3b8;
    text-align: center;
    padding: 20px;
    margin-top: auto;
}

/* ==========================================================================
   響應式設計 (RWD - 手機與平板版)
   ========================================================================== */
@media screen and (max-width: 992px) {
    .product_item {
        width: calc(33.333% - 20px) !important;
    }
}

@media screen and (max-width: 768px) {
    .product_item {
        width: calc(50% - 20px) !important;
        padding: 10px;
        margin: 10px;
    }
    
    .product_item input[type="image"] {
        max-width: 48%;
        margin-right: 2%;
    }

    .FIELD input[type="text"], .FIELD select, .FIELD input[type="submit"] {
        display: block;
        width: 100%;
        margin: 10px 0;
        box-sizing: border-box;
    }

    .header-container {
        justify-content: flex-start;
        position: relative;
    }

    .hamburger-btn {
        display: flex;
        cursor: pointer;
        flex-direction: column;
        gap: 5px;
        margin-right: 20px; 
        z-index: 1001;
    }

    .logo {
        flex-grow: 1;
        text-align: center;
        margin-right: 45px; 
    }

    .main-nav {
        position: absolute;
        top: 70px;
        left: -100%; 
        width: 100%;
        background-color: #1e293b;
        transition: left 0.3s ease-in-out;
        box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    }

    .main-nav .nav-menu {
        flex-direction: column;
        align-items: flex-start;
        padding: 0;
    }

    .nav-menu > li {
        width: 100%;
        margin-left: 0;
        border-top: 1px solid #334155;
    }

    .nav-menu a {
        padding: 15px 20px;
    }

    .dropdown-menu {
        display: none;
        position: static;
        width: 100%;
        box-shadow: none;
        background-color: #0f172a;
        border-radius: 0;
    }
    
    .dropdown-menu a {
        padding-left: 40px;
        border-bottom: 1px solid #1e293b;
        color: #e2e8f0;
    }

    .dropdown-menu a:hover {
        background-color: #1e293b;
    }

    .menu-toggle:checked ~ .main-nav {
        left: 0;
    }

    .menu-toggle:checked ~ .main-nav .dropdown-menu {
        display: block;
    }
    
    /* 手機版內頁排版修正 */
    .content-section {
        padding: 20px;
        margin: 20px 10px;
    }
}

@media screen and (max-width: 480px) {
    .product_item {
        width: calc(100% - 20px) !important;
    }
}