:root {
    /* 主要色系 */
    --primary-color: #df321e;      /* 主要紅色 */
    --primary-dark: #c0392b;       /* 深紅色 */
    --secondary-color: #2c3e50;    /* 深灰色 */
    --dark-color: #1a1a1a;         /* 近黑色 */
    
    /* 中性色系 */
    --gray-dark: #333333;          /* 深灰 */
    --gray-medium: #666666;        /* 中灰 */
    --gray-light: #999999;         /* 淺灰 */
    --gray-lighter: #f5f5f5;       /* 最淺灰 */
    
    /* 文字顏色 */
    --text-color: #333333;         /* 主要文字 */
    --text-light: #ffffff;         /* 淺色文字 */
    --text-gray: #666666;          /* 次要文字 */
    
    /* 背景色 */
    --background-color: #ffffff;    /* 主背景 */
    --background-gray: #f5f5f5;    /* 灰色背景 */
    
    /* 其他 */
    --section-padding: 80px 0;
    --border-color: #e0e0e0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
    overflow-y: overlay;
}

body {
    font-family: "Microsoft JhengHei", Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
}

ul{
    /* list-style: none; */
    padding-left: 30px;
}

/* 自訂捲軸樣式 */
html::-webkit-scrollbar {
    width: 8px;
}

html::-webkit-scrollbar-track {
    background: transparent;
}

html::-webkit-scrollbar-thumb {
    background-color: var(--primary-color);
}

html::-webkit-scrollbar-thumb:hover {
    background-color: var(--primary-dark);
}


.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: center;
    gap: 5px;
}

.footer-container div{
    
}   

.footer-container div a {
    
    text-decoration: none;
    font-weight: 300;
    color: rgb(205, 56, 56);
    transition: 1s;
}

.footer-container div a:hover{
    transition: 1s;
    color: rgb(228, 36, 36);
}

/* 導航欄 */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    padding: 15px 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border-bottom: 1px solid var(--border-color);
    height: 80px;
    display: flex;
    align-items: center;
}

/* Logo 和漢堡按鈕容器 */
.navbar .container {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    width: 100%;
}

/* Logo 固定樣式 */
.logo {
    /* position: fixed;
    left: 20px;
    top: 20px; */
    z-index: 1001;
}

.logo-img {
    height: 40px;
    width: auto;
    vertical-align: middle;
}

.logo a {
    display: block;
    text-decoration: none;
    display: flex; 
    align-items: center;
    gap: 5px;
    color: black;
    font-weight: 700;
    font-size: 24px;
}

/* 右側導航區域 */
.nav-right {
    /* position: fixed;
    right: 20px;
    top: 20px; */
    display: flex;
    align-items: center;
    z-index: 1001;
}

/* 導航連結 */
.nav-links {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    align-items: center;
}

.nav-links li {
    margin-left: 30px;
}

/* 漢堡按鈕 */
.nav-toggle {
    display: none;
    font-size: 24px;
    cursor: pointer;
    margin-left: 20px;
}

.nav-links a {
    text-decoration: none;
    color: var(--gray-dark);
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav-links a:hover {
    color: var(--primary-color);
}

/* 首頁區塊特殊處理 */
.home-section {
    padding: 0;
    height: 100vh;
    position: relative;
    background: #323232;
}

/* 輪播容器 */
.slider-container {
    width: 100%;
    height: 100vh;  /* 設定為全螢幕高度 */
    position: relative;
    overflow: hidden;
    /* margin-top: -80px;   */
    /* 負值等於 navbar 的高度 */
}

/* 輪播基本樣式 */
.slider {
    width: 100%;
    height: 100%;
    position: relative;
}

/* 輪播項目 */
.slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    display: none;
}

.slide.active {
    opacity: 1;
    display: block;
}

/* 輪播圖片 */
.slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 輪播內容 */
.slide-content {
    position: absolute;
    top: 55%;  /* 稍微往下調整，避免被導航欄遮擋 */
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: var(--text-light);
    z-index: 2;
    width: 80%;
    max-width: 800px;
    padding-top: 80px;  /* 添加上方間距，等於導航欄高度 */
}

.slide-content h2 {
    font-size: 3em;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.slide-content p {
    font-size: 1.5em;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

/* 輪播導航按鈕 */
.slider-nav button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 3;
    transition: background 0.3s ease;
}

.slider-nav button:hover {
    background: rgba(231, 76, 60, 0.8);
}

.prev-slide {
    left: 20px;
}

.next-slide {
    right: 20px;
}

/* 輪播指示點 */
.slider-dots {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 3;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: background 0.3s ease;
}

.dot.active {
    background: var(--primary-color);
}

/* 為圖片添加暗色遮罩 */
.slide::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1;
}

/* 區段樣式 */
.section {
    padding: var(--section-padding);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.section-title {
    text-align: center;
    margin-bottom: 50px;
    color: var(--dark-color);
    font-size: 2.5em;
    position: relative;
    padding-bottom: 15px;
    margin-top: 50px;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 3px;
    background: var(--primary-color);
}

.company-intro{
    display: flex;
    justify-content: center;
}

/* 關於我們 */
.about-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
}

.timeline {
    position: relative;
    padding: 20px 0;
}

.timeline-item {
    position: relative;
    padding: 20px 0;
    border-left: 2px solid var(--primary-color);
    margin-left: 20px;
}

.timeline-item .year {
    position: absolute;
    left: -50px;
    background: var(--primary-color);
    color: var(--text-light);
    padding: 5px 10px;
    border-radius: 4px;
}

/* 產品介紹 */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.product-card {
    background: var(--background-color);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
    border: 1px solid var(--border-color);
    aspect-ratio: 3/4;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-color);
}

.product-card img {
    width: 100%;
    height: 60%;
    object-fit: cover;
}

.product-card h3,
.product-card p {
    padding: 10px 15px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-card h3 {
    margin-top: 10px;
    font-size: 1.2em;
}

.product-card p {
    font-size: 0.9em;
    color: var(--text-gray);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 設備廠區 */
.facility-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.facility-item {
    background: var(--background-color);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
}

.facility-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(231, 76, 60, 0.1);
    border-color: var(--primary-color);
}

/* 聯絡區塊基本樣式 */
.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    width: 100%;
}

.contact-form-wrapper,
.contact-info-wrapper {
    width: 100%;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: var(--text-color);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--gray-light);
    border-radius: 4px;
    font-size: 16px;
    background: var(--background-color);
}

.form-group textarea {
    height: 150px;
    resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--primary-color);
    outline: none;
}

button[type="submit"] {
    background: var(--primary-color);
    color: var(--text-light);
    padding: 12px 30px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s ease;
}

button[type="submit"]:hover {
    background: var(--primary-dark);
}

/* 公司/聯絡資訊 */
.contact-info {
    background: var(--background-color);
    padding: 30px;
    border-radius: 8px;
    /* box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); */
    box-shadow: 0 0 6px 5px rgba(0, 0, 0, 0.1);
}

.info-item {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.info-item i {
    font-size: 24px;
    color: var(--primary-color);
    margin-right: 15px;
}

.map-container {
    margin-top: 30px;
    border-radius: 8px;
    overflow: hidden;
}

/* 頁尾 */
footer {
    background: var(--dark-color);
    color: var(--text-light);
    padding: 20px 0;
    text-align: center;
}

/* 動畫效果 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.fade-in {
    animation: fadeIn 1s ease-in;
}

/* 新增：hover 效果 */
.nav-links a::after {
    content: '';
    display: block;
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: width 0.3s ease;
}

.nav-links a:hover::after {
    width: 100%;
}

/* 新增：卡片效果 */
.facility-item {
    background: var(--background-color);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.facility-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(231, 76, 60, 0.1);
    border-color: var(--primary-color);
}

/* 新增：按鈕動畫 */
.btn {
    background: var(--primary-color);
    color: var(--text-light);
    padding: 12px 30px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    transition: left 0.3s ease;
}

.btn:hover::after {
    left: 100%;
}

/* 新增：表單焦點效果 */
.form-group input:focus,
.form-group textarea:focus {
    box-shadow: 0 0 0 2px rgba(231, 76, 60, 0.1);
}

/* 新增：滾動進度條 */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0;
    height: 3px;
    background: var(--primary-color);
    z-index: 1001;
    transition: width 0.3s ease;
}

/* 確保圖片覆蓋範圍正確 */
.slide img,
.facility-item img,
.cert-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}


/* 關於我們區塊的背景特效 */
.section#about {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, var(--background-color) 0%, var(--background-gray) 100%);
}

/* 粒子背景容器 */
.particles-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.particles-bg::before,
.particles-bg::after {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--primary-color);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--primary-color);
    animation: float 8s infinite;
    opacity: 0.5;
}

.particles-bg::before {
    left: 10%;
    animation-delay: -4s;
}

.particles-bg::after {
    right: 10%;
    animation-delay: -2s;
}

/* 確保內容在粒子之上 */
.section#about .container {
    position: relative;
    z-index: 2;
}

/* 粒子動畫 */
@keyframes float {
    0%, 100% {
        transform: translateY(0) translateX(0);
        opacity: 0.5;
    }
    25% {
        transform: translateY(-100px) translateX(50px);
        opacity: 0.8;
    }
    50% {
        transform: translateY(-50px) translateX(100px);
        opacity: 0.3;
    }
    75% {
        transform: translateY(-150px) translateX(-50px);
        opacity: 0.7;
    }
}

/* 添加更多粒子 */
.particles-bg::before {
    box-shadow: 
        0 0 10px var(--primary-color),
        200px 300px 0 var(--primary-color),
        400px 100px 0 var(--primary-color),
        600px 200px 0 var(--primary-color),
        800px 400px 0 var(--primary-color),
        1000px 500px 0 var(--primary-color);
}

.particles-bg::after {
    box-shadow: 
        0 0 10px var(--primary-color),
        -200px -300px 0 var(--primary-color),
        -400px -100px 0 var(--primary-color),
        -600px -200px 0 var(--primary-color),
        -800px -400px 0 var(--primary-color),
        -1000px -500px 0 var(--primary-color);
}

/* 添加漸變背景效果 */
.section#about::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #ffffff;
    /* background: linear-gradient(45deg, 
        rgba(223, 50, 30, 0.05) 0%,
        rgba(255, 255, 255, 0) 50%,
        rgba(223, 50, 30, 0.05) 100%); */
    animation: gradientMove 15s ease infinite;
}

@keyframes gradientMove {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* RWD 調整 */
@media (max-width: 768px) {
    .particles-bg::before,
    .particles-bg::after {
        animation-duration: 12s;
    }
} 

/* RWD 調整 */
@media (max-width: 768px) {
    .slide-content h2 {
        font-size: 2em;
    }

    .slide-content p {
        font-size: 1.2em;
    }

    .slider-nav button {
        width: 40px;
        height: 40px;
    }

    .nav-toggle {
        display: block;
    }

    .nav-links {
        display: none;
        position: fixed;
        top: 80px;
        right: 0;
        width: 200px;
        background: white;
        padding: 20px;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
        border-radius: 0 0 4px 4px;
    }

    .nav-links.active {
        display: block;
    }

    .nav-links li {
        margin: 15px 0;
    }

    .nav-right {
        order: 2;
    }

    .about-grid,
    .contact-grid {
        grid-template-columns: 1fr;
    }

    .section-title {
        font-size: 2em;
    }

    /* 修改聯絡表單區塊在手機版的排列方式 */
    .contact-grid {
        grid-template-columns: 1fr;  /* 改為單欄 */
        gap: 30px;  /* 稍微縮小間距 */
    }

    /* 調整表單和公司/聯絡資訊的間距 */
    .contact-form {
        margin-bottom: 30px;  /* 添加底部間距 */
    }

    /* 調整地圖容器的響應式高度 */
    .map-container {
        height: 300px;  /* 設定固定高度 */
        margin-top: 20px;  /* 調整上方間距 */
    }

    /* 調整公司/聯絡資訊區塊的內距 */
    .contact-info {
        padding: 20px;  /* 稍微減少內距 */
    }

    /* 調整粒子大小和動畫 */
    .particles-bg::before,
    .particles-bg::after {
        width: 6px;  /* 調整粒子大小 */
        height: 6px;
        animation-duration: 12s;
    }

    /* 增加手機版的粒子密度 */
    .particles-bg::before {
        box-shadow: 
            0 0 10px var(--primary-color),
            50px 80px 0 var(--primary-color),
            100px 30px 0 var(--primary-color),
            150px 60px 0 var(--primary-color),
            200px 100px 0 var(--primary-color),
            250px 150px 0 var(--primary-color),
            300px 80px 0 var(--primary-color),
            350px 120px 0 var(--primary-color),
            400px 60px 0 var(--primary-color),
            450px 90px 0 var(--primary-color);
    }

    .particles-bg::after {
        box-shadow: 
            0 0 10px var(--primary-color),
            -50px -80px 0 var(--primary-color),
            -100px -30px 0 var(--primary-color),
            -150px -60px 0 var(--primary-color),
            -200px -100px 0 var(--primary-color),
            -250px -150px 0 var(--primary-color),
            -300px -80px 0 var(--primary-color),
            -350px -120px 0 var(--primary-color),
            -400px -60px 0 var(--primary-color),
            -450px -90px 0 var(--primary-color);
    }

    /* 調整動畫範圍，使其更適合手機螢幕 */
    @keyframes float {
        0%, 100% {
            transform: translateY(0) translateX(0);
            opacity: 0.5;
        }
        25% {
            transform: translateY(-50px) translateX(25px);
            opacity: 0.8;
        }
        50% {
            transform: translateY(-25px) translateX(50px);
            opacity: 0.3;
        }
        75% {
            transform: translateY(-75px) translateX(-25px);
            opacity: 0.7;
        }
    }
}

/* RWD 設定 - 使用更具體的選擇器 */
@media screen and (max-width: 768px) {
    .contact-grid {
        display: block !important;  /* 強制改為區塊排列 */
    }

    .contact-form-wrapper {
        margin-bottom: 30px;
    }

    .contact-info-wrapper {
        width: 100%;
    }

    .contact-info {
        margin-top: 0;
    }

    .map-container {
        margin-top: 20px;
        height: 300px;
    }

    .contact-form,
    .contact-info {
        width: 100%;
    }

    .footer-container {
        flex-direction: column;
        align-items: center;
    }
}