/* =========================================
   1. CSS 變數：全站配色規範
   ========================================= */
:root {
    --bg-main: #EAEEFA;
    --brand-primary: #5F6ACB;
    --brand-secondary: #9E9FD0;
    --tech-light-blue: #BCC6E6;
    --tech-purple: #C8A9D2;
    --text-dark: #1A1A2E;
    --text-light: #666680;
    --white: #FFFFFF;
}

/* =========================================
   2. 全域基礎設定
   ========================================= */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: 'Inter', 'Noto Sans TC', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-dark);
    line-height: 1.6;
    background-image: linear-gradient(var(--tech-light-blue) 1px, transparent 1px),
    linear-gradient(90deg, var(--tech-light-blue) 1px, transparent 1px);
    background-size: 50px 50px;
    background-position: center center;
    background-attachment: fixed;
    overflow-x: hidden;
}
*:focus-visible { outline: 3px solid var(--brand-primary); outline-offset: 2px; }

/* =========================================
   3. 導覽列 Header
   ========================================= */
header { position: fixed; top: 0; width: 100%; background-color: rgba(255, 255, 255, 0.9); backdrop-filter: blur(10px); z-index: 1000; border-bottom: 1px solid rgba(95, 106, 203, 0.1); transition: all 0.3s ease; }
.nav-container { max-width: 1200px; margin: 0 auto; padding: 15px 20px; display: flex; justify-content: space-between; align-items: center; }
.logo { font-size: 24px; font-weight: 700; color: var(--brand-primary); text-decoration: none; letter-spacing: 1px; }
.nav-links { display: flex; gap: 30px; align-items: center; }
.nav-links .nav-item {
    text-decoration: none; color: var(--text-dark); font-weight: 500; transition: color 0.3s; position: relative;
}
.nav-links .nav-item:hover, .nav-links .nav-item.active { color: var(--brand-primary); }
/* 導覽列 Active 狀態指示器 */
.nav-links .nav-item.active::after {
    content: ''; position: absolute; bottom: -6px; left: 50%; transform: translateX(-50%);
    width: 20px; height: 3px; background-color: var(--brand-primary); border-radius: 2px;
}
.mobile-menu-btn { display: none; background: none; border: none; font-size: 24px; color: var(--brand-primary); cursor: pointer; }

/* 共用按鈕 */
.btn { padding: 10px 24px; border-radius: 8px; font-weight: 600; text-decoration: none; transition: all 0.3s ease; cursor: pointer; border: none; display: inline-block; }
.btn-primary { background-color: var(--brand-primary); color: var(--white); box-shadow: 0 4px 15px rgba(95, 106, 203, 0.3); }
.btn-primary:hover:not(:disabled) { background-color: #4A55A2; transform: translateY(-2px); box-shadow: 0 6px 20px rgba(95, 106, 203, 0.4); }
.btn-outline { background-color: var(--white); color: var(--brand-primary); border: 2px solid var(--brand-primary); }
.btn-outline:hover:not(:disabled) { background-color: var(--bg-main); }

/* =========================================
   4. 科技動效特效層
   ========================================= */
.hover-glow { transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease; }
.hover-glow:hover { transform: translateY(-5px); box-shadow: 0 15px 35px rgba(95, 106, 203, 0.2), 0 0 15px rgba(188, 198, 230, 0.5); border-color: rgba(95, 106, 203, 0.4) !important; }
.light-beam-bg { position: relative; overflow: hidden; z-index: 1; }
.light-beam-bg::before { content: ''; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%; background: linear-gradient(45deg, transparent 40%, rgba(255,255,255,0.6) 45%, rgba(188, 198, 230, 0.3) 50%, transparent 55%); transform: rotate(15deg); animation: lightSweep 8s linear infinite; pointer-events: none; z-index: -1; }
@keyframes lightSweep { 0% { transform: translate(-50%, -50%) rotate(15deg); } 100% { transform: translate(50%, 50%) rotate(15deg); } }

/* =========================================
   5. 區塊共用與版面
   ========================================= */
/* ✨ 修正錨點被 Fixed Header 蓋住的問題 */
section {
    padding: 100px 20px;
    max-width: 1200px;
    margin: 0 auto;
    scroll-margin-top: 100px;
}
.section-title { text-align: center; font-size: 32px; color: var(--brand-primary); margin-bottom: 40px; }
.section-subtitle { color: var(--text-light); font-size: 16px; margin-bottom: 30px; }

/* Hero */
#hero { display: flex; align-items: center; justify-content: space-between; min-height: 100vh; padding-top: 80px; }
.hero-content { flex: 1; padding-right: 40px; }
.hero-content h1 { font-size: 48px; line-height: 1.2; margin-bottom: 20px; color: var(--text-dark); }
.hero-content p { font-size: 18px; color: var(--text-light); margin-bottom: 30px; }
.hero-image { flex: 1; background-color: rgba(255, 255, 255, 0.7); border: 1px solid var(--white); border-radius: 20px; height: 400px; display: flex; align-items: center; justify-content: center; box-shadow: 0 20px 40px rgba(95, 106, 203, 0.1); backdrop-filter: blur(5px); color: var(--brand-secondary); }

/* Team / Strengths / Features / Plans */
.team-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 30px; }
.team-card { background-color: var(--white); padding: 40px 20px; border-radius: 16px; text-align: center; border: 1px solid rgba(95, 106, 203, 0.05); }
.team-icon { width: 70px; height: 70px; background-color: var(--bg-main); color: var(--brand-primary); border-radius: 16px; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 24px; }
.team-card h3 { font-size: 20px; color: var(--brand-primary); margin-bottom: 12px; }
.team-card p { font-size: 15px; color: var(--text-light); margin: 0; }

.strengths-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 30px; }
.strength-card { background: linear-gradient(145deg, var(--white) 0%, rgba(255,255,255,0.95) 100%); padding: 35px 30px; border-radius: 16px; border-left: 5px solid var(--brand-primary); box-shadow: 0 5px 15px rgba(0,0,0,0.03); }
.strength-card h3 { font-size: 20px; color: var(--text-dark); margin-bottom: 12px; display: flex; align-items: center; gap: 10px; }
.strength-card h3::before { content: ''; display: inline-block; width: 8px; height: 8px; background-color: var(--tech-light-blue); border-radius: 50%; box-shadow: 0 0 8px var(--brand-primary); }
.strength-card p { font-size: 15px; color: var(--text-light); }

.features-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 30px; }
.feature-card { background-color: var(--white); padding: 40px; border-radius: 16px; border: 1px solid rgba(95, 106, 203, 0.05); display: flex; flex-direction: column; }
.feature-icon { width: 60px; height: 60px; background-color: var(--bg-main); color: var(--brand-primary); border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 20px; }
.feature-card h3 { font-size: 22px; color: var(--brand-primary); margin-bottom: 15px; }
.feature-card p { font-size: 16px; color: var(--text-light); line-height: 1.6; }

.plans-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }
.plan-card { background-color: var(--white); padding: 40px; border-radius: 16px; box-shadow: 0 10px 30px rgba(0,0,0,0.05); border-top: 5px solid var(--brand-primary); }
.plan-card ul { list-style: none !important; padding-left: 0; margin-top: 20px; }
.plan-card ul li:not(.plan-note) { list-style: none !important; margin-bottom: 10px; padding-left: 25px; position: relative; }
.plan-card ul li.plan-note { list-style: none !important; font-size: 13px; color: #888; padding-left: 0; margin-top: 5px; position: relative; }
.plan-card ul li:not(.plan-note)::before { content: '✓'; position: absolute; left: 0; color: var(--brand-primary); font-weight: bold; }

/* DEMO */
.demo-header { text-align: center; margin-bottom: 40px; }
.demo-tabs { display: flex; justify-content: center; gap: 15px; margin-bottom: 40px; flex-wrap: wrap; }
.tab-btn { padding: 8px 20px; border-radius: 30px; border: 1px solid var(--tech-light-blue); background: transparent; color: var(--text-light); font-weight: 500; cursor: pointer; transition: all 0.3s ease; }
.tab-btn:hover, .tab-btn.active { background: var(--brand-primary); color: var(--white); border-color: var(--brand-primary); box-shadow: 0 4px 10px rgba(95, 106, 203, 0.2); }
.demo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 30px; }
.demo-card { background: var(--white); border-radius: 16px; overflow: hidden; border: 1px solid rgba(95, 106, 203, 0.05); display: flex; flex-direction: column; transition: opacity 0.4s ease, transform 0.4s ease; }
.demo-card.hidden { display: none; }
.demo-thumb { width: 100%; height: 200px; background: var(--tech-light-blue); display: flex; align-items: center; justify-content: center; color: var(--white); font-size: 14px; position: relative; cursor: pointer; }
.demo-thumb::after { content: '▶'; position: absolute; font-size: 24px; color: var(--brand-primary); background: rgba(255,255,255,0.8); width: 50px; height: 50px; border-radius: 50%; display: flex; align-items: center; justify-content: center; padding-left: 4px; box-shadow: 0 4px 10px rgba(0,0,0,0.1); }
.demo-info { padding: 25px; display: flex; flex-direction: column; flex: 1; }
.demo-tags { margin-bottom: 12px; }
.demo-tag { font-size: 12px; padding: 4px 12px; border-radius: 20px; background: var(--bg-main); color: var(--brand-primary); font-weight: 600; }
.demo-info h3 { font-size: 20px; color: var(--text-dark); margin-bottom: 10px; }
.demo-info p { font-size: 14px; color: var(--text-light); margin-bottom: 20px; flex: 1; line-height: 1.5; }

/* =========================================
   6. Modal 彈窗 (共用結構與捲動優化)
   ========================================= */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(26, 26, 46, 0.8); backdrop-filter: blur(8px); display: flex; align-items: center; justify-content: center; z-index: 2000; opacity: 0; visibility: hidden; transition: opacity 0.3s ease, visibility 0.3s; padding: 20px; }
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal-content {
    background: var(--white); width: 100%; max-width: 800px; border-radius: 16px;
    position: relative; transform: translateY(20px); transition: transform 0.3s ease;
    box-shadow: 0 25px 50px rgba(0,0,0,0.3);
    max-height: 90vh;
    overflow-y: auto;
}
/* 自訂捲軸樣式 (修正右上/右下圓角破圖問題) */
.modal-content::-webkit-scrollbar { width: 8px; }
.modal-content::-webkit-scrollbar-track { background: transparent; margin: 16px 0; }
.modal-content::-webkit-scrollbar-thumb { background: var(--tech-light-blue); border-radius: 10px; }

.modal-overlay.active .modal-content { transform: translateY(0); }
.modal-close { position: absolute; top: 15px; right: 15px; background: rgba(0,0,0,0.05); border: none; width: 36px; height: 36px; border-radius: 50%; font-size: 24px; color: var(--text-dark); cursor: pointer; transition: background 0.3s; z-index: 10; display: flex; align-items: center; justify-content: center; line-height: 1; }
.modal-close:hover { background: rgba(0,0,0,0.15); }
.modal-body { padding: 40px; min-height: 400px; display: flex; flex-direction: column; align-items: center; justify-content: center; background: var(--bg-main); text-align: center; }

/* =========================================
   7. 多步驟表單 (Inquiry Form) 專屬樣式
   ========================================= */
.form-modal-content { max-width: 600px; }
.form-header { padding: 30px 40px 20px; border-bottom: 1px solid var(--tech-light-blue); background: rgba(234, 238, 250, 0.5); }
.form-header h3 { color: var(--brand-primary); font-size: 22px; margin-bottom: 15px; }
.progress-bar-container { width: 100%; height: 6px; background: var(--white); border-radius: 10px; overflow: hidden; margin-bottom: 10px; }
.progress-bar { height: 100%; background: var(--brand-primary); width: 33%; transition: width 0.4s ease; }
.step-indicator { font-size: 13px; color: var(--text-light); font-weight: 600; }

.form-body { padding: 30px 40px; text-align: left; background: var(--white); min-height: auto; display: block; }
.form-step { display: none; animation: fadeInRight 0.4s ease; }
.form-step.active { display: block; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-weight: 600; color: var(--text-dark); margin-bottom: 8px; font-size: 14px; }
.form-group input[type="text"], .form-group select, .form-group textarea { width: 100%; padding: 12px 15px; border: 1px solid var(--tech-light-blue); border-radius: 8px; font-family: inherit; font-size: 15px; transition: border-color 0.3s; background: #F8F9FE; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: var(--brand-primary); background: var(--white); box-shadow: 0 0 0 3px rgba(95,106,203,0.1); }

.radio-group { display: flex; gap: 15px; flex-wrap: wrap; }
.radio-group label { font-weight: 500; font-size: 14px; display: flex; align-items: center; gap: 5px; padding: 8px 12px; border: 1px solid var(--tech-light-blue); border-radius: 20px; cursor: pointer; transition: all 0.2s; margin-bottom: 0; background: var(--white); }
.radio-group label:has(input:checked) { border-color: var(--brand-primary); background: rgba(95,106,203,0.05); color: var(--brand-primary); }
.radio-group input[type="radio"] { accent-color: var(--brand-primary); }

.form-actions { margin-top: 30px; text-align: right; }
.form-actions.row-between { display: flex; justify-content: space-between; align-items: center; }
.dynamic-section-title { font-size: 16px; color: var(--brand-primary); margin: 25px 0 15px; padding-bottom: 5px; border-bottom: 2px dashed var(--tech-light-blue); }
.help-text { font-size: 12px; color: #888; margin-top: 4px; display: block; }
@keyframes fadeInRight { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

footer { background-color: var(--white); padding: 40px 20px; text-align: center; color: var(--text-light); border-top: 1px solid var(--tech-light-blue); }

/* =========================================
   8. Scroll Reveal 進場動效
   ========================================= */
.reveal { opacity: 0; transform: translateY(40px); transition: all 0.8s cubic-bezier(0.5, 0, 0, 1); }
.reveal.active { opacity: 1; transform: translateY(0); }
.delay-1 { transition-delay: 0.1s; }
.delay-2 { transition-delay: 0.2s; }
.delay-3 { transition-delay: 0.3s; }

/* =========================================
   9. RWD & 效能安全設定
   ========================================= */
@media (max-width: 1024px) {
    .team-grid { grid-template-columns: repeat(2, 1fr); }
    .hero-content h1 { font-size: 38px; }
}

@media (max-width: 768px) {
    .hero-cta-group { display: flex; flex-direction: column; gap: 15px; margin-top: 20px; }
    .hero-cta-group .btn { width: 100%; text-align: center; }
    .mobile-menu-btn { display: block; }

    /* 調整手機版導覽選單樣式，確保觸控範圍足夠 */
    .nav-links { position: absolute; top: 70px; left: 0; width: 100%; background-color: var(--white); flex-direction: column; padding: 20px 0; box-shadow: 0 10px 20px rgba(0,0,0,0.1); clip-path: polygon(0 0, 100% 0, 100% 0, 0 0); transition: clip-path 0.4s ease-in-out; }
    .nav-links.active { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%); }
    .nav-links .nav-item { padding: 12px 0; width: 100%; text-align: center; }
    .nav-links .nav-item.active::after { bottom: 5px; } /* 微調手機版的 active 底線 */

    #hero { flex-direction: column; text-align: center; padding-top: 120px; }
    .hero-content { padding-right: 0; margin-bottom: 40px; }
    .hero-image { width: 100%; }

    .team-grid, .strengths-grid, .plans-grid, .features-grid, .demo-grid { grid-template-columns: 1fr; gap: 20px; }
    .demo-tabs { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; padding-bottom: 10px; }
    .tab-btn { white-space: nowrap; }
    .delay-1, .delay-2, .delay-3 { transition-delay: 0s; }

    .form-header, .form-body { padding: 20px; }
    .radio-group { flex-direction: column; gap: 10px; }
}

@media (prefers-reduced-motion: reduce) {
    * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
    .reveal { opacity: 1; transform: none; }
    .light-beam-bg::before { display: none; }
}