/* ===================================================
   1. 全域變數與基礎重設 (CSS Variables & Reset)
   =================================================== */
:root {
  /* 品牌核心色彩 (主綠色調，藍色為輔助點綴) */
  --primary: #1b4332;         /* 深林綠 (主色) */
  --primary-light: #2d6a4f;   /* 次深綠 */
  --accent: #40916c;          /* 沉穩草綠 (強調) */
  --accent-light: #d8f3dc;    /* 淺綠徽章底色 */
  --accent-hover: #2d6a4f;
  
  /* 藍色系輔助色 */
  --support-blue: #2a9d8f;    
  
  /* 中性色調 */
  --dark: #1e293b;            /* 深鐵灰文字 */
  --body-text: #475569;       /* 內文灰 */
  --bg-white: #ffffff;
  --bg-light: #f4f8f6;        
  --border-color: #cbd5e1;

  /* 陰影與圓角 */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 6px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 28px rgba(27, 67, 50, 0.12);
  --transition: all 0.3s ease;
}

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

html {
  scroll-behavior: smooth;
  font-family: 'Noto Sans TC', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--body-text);
  background-color: var(--bg-white);
  line-height: 1.65;
}

a {
  text-decoration: none;
  color: inherit;
  transition: var(--transition);
}

ul {
  list-style: none;
}

.container {
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
}

/* ===================================================
   2. 頁首與導覽列 (Header & Navbar)
   =================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 74px;
}

.logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  height: 100%;
  padding: 8px 0;
}

.logo-img,
.logo img {
  height: 48px;
  max-height: 100%;
  width: auto;
  object-fit: contain;
  display: block;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 30px;
}

.nav-menu ul.nav-list {
  display: flex;
  gap: 24px;
  align-items: center;
}

.nav-menu a {
  font-size: 0.98rem;
  font-weight: 500;
  color: var(--dark);
  padding: 6px 0;
  position: relative;
}

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

.nav-menu a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--primary);
  transition: var(--transition);
}

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

/* 下拉選單樣式 (關於我們) */
.nav-item.dropdown {
  position: relative;
}

.nav-item.dropdown .dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  background-color: #fff;
  min-width: 160px;
  box-shadow: var(--shadow-md);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  padding: 8px 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: var(--transition);
  z-index: 1010;
}

.nav-item.dropdown .dropdown-menu li a {
  display: block;
  padding: 8px 16px;
  font-size: 0.9rem;
  color: var(--dark);
  white-space: nowrap;
}

.nav-item.dropdown .dropdown-menu li a:hover {
  background-color: var(--bg-light);
  color: var(--primary);
}

.nav-item.dropdown .dropdown-menu li a::after {
  display: none;
}

/* 導覽列按鈕化樣式 */
.nav-item-btn {
  display: flex;
  align-items: center;
}

.nav-item-btn .btn {
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
}

.nav-item-btn .btn::after {
  display: none !important;
}

.mobile-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  flex-direction: column;
  gap: 5px;
  padding: 6px;
}

.mobile-toggle span {
  display: block;
  width: 26px;
  height: 3px;
  background-color: var(--primary);
  border-radius: 2px;
  transition: var(--transition);
}

/* ===================================================
   3. 全站通用按鈕組件 (Buttons) - 白底黑字、有色白字
   =================================================== */
.btn {
  display: inline-block;
  font-weight: 600;
  padding: 12px 28px;
  border-radius: var(--radius-sm);
  text-align: center;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition);
}

/* 實心有色按鈕：預設有色 -> 白字 */
.btn-primary {
  background-color: var(--primary);
  color: #ffffff !important;
}
.btn-primary:hover {
  background-color: var(--primary-light);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(27, 67, 50, 0.3);
}

.btn-accent {
  background-color: var(--support-blue);
  color: #ffffff;
}
.btn-accent:hover {
  background-color: #238578;
  color: #ffffff;
  transform: translateY(-2px);
}

.btn-primary-sm {
  background-color: var(--primary);
  color: #ffffff ;
  padding: 8px 18px;
  font-size: 0.9rem;
  border-radius: var(--radius-sm);
}
.btn-primary-sm:hover {
  background-color: var(--primary-light);
  color: #ffffff ;
}

/* 外框/透明底按鈕：預設白底/透明 -> 黑字（--dark）；滑鼠移上去有色 -> 變白字 */
.btn-outline {
  background-color: transparent;
  color: var(--dark);
  border-color: var(--primary);
}
.btn-outline:hover {
  background-color: var(--primary);
  color: #ffffff !important; /* 移上去有色底時自動變白字 */
  border-color: var(--primary);
  transform: translateY(-2px);
}

.btn-block {
  display: block;
  width: 100%;
}

/* ===================================================
   4. 表單通用輸入元件 (2 欄並排網格)
   =================================================== */
.contact-form {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.form-group {
  margin-bottom: 0;
}

.form-group:nth-child(5),
.form-group:nth-child(6) {
  grid-column: span 2;
}

.contact-form .btn-block {
  grid-column: span 2;
  margin-top: 4px;
}

.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 3px;
  color: var(--dark);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-family: inherit;
  outline: none;
  background-color: #fff;
  color: var(--dark);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(27, 67, 50, 0.15);
}

/* ===================================================
   5. 右下角懸浮按鈕與諮詢對話框
   =================================================== */
.contact-toggle {
  display: none;
}

.floating-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #1b4332, #2a9d8f);
  color: #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(42, 157, 143, 0.4);
  z-index: 9999;
  border: 2px solid #ffffff;
  transition: bottom 0.15s ease-out, transform 0.25s ease, box-shadow 0.25s ease;
}

.floating-btn::before {
  display: none;
}

/* 顯示開啟時的圖片圖示 */
.floating-btn .btn-open-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.floating-btn .btn-open-icon img {
  width: 26px;
  height: 26px;
  object-fit: contain;
}

.floating-btn .btn-close-icon {
  display: none;
  font-size: 1.2rem;
  font-weight: 700;
}

.contact-modal {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 480px;
  max-width: calc(100vw - 32px);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px) scale(0.96);
  transform-origin: bottom right;
  transition: bottom 0.15s ease-out, opacity 0.25s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.25s;
  pointer-events: none;
}

.contact-modal .contact-form-box {
  background: #ffffff;
  padding: 20px 22px;
  border-radius: var(--radius-md);
  color: var(--dark);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  overflow-y: auto;
}

.contact-header {
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--bg-light);
}

.contact-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
  color: var(--primary);
}

/* 點擊展開時的切換狀態：隱藏信件圖示、顯示關閉叉叉 */
.contact-toggle:checked ~ .contact-modal {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.contact-toggle:checked ~ .floating-btn .btn-open-icon {
  display: none;
}

.contact-toggle:checked ~ .floating-btn .btn-close-icon {
  display: block;
}

/* ===================================================
   6. 頁尾樣式 (Footer)
   =================================================== */
.site-footer {
  background-color: #0d2218;
  color: #94a3b8;
  padding: 24px 0 16px;
  font-size: 0.84rem;
  line-height: 1.5;
  position: relative;
  z-index: 10;
}

.footer-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.footer-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}

.footer-contact {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.contact-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.contact-label {
  color: var(--support-blue);
  font-weight: 700;
  font-size: 0.88rem;
  padding-right: 8px;
  border-right: 1px solid rgba(255, 255, 255, 0.2);
}

.contact-item {
  color: #cbd5e1;
}

.contact-item strong {
  color: #e2e8f0;
}

.contact-item a:hover {
  color: var(--support-blue);
  text-decoration: underline;
}

.divider {
  color: rgba(255, 255, 255, 0.2);
  font-size: 0.75rem;
}

.footer-nav {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-shrink: 0;
}

.footer-nav a {
  color: #cbd5e1;
  font-weight: 500;
}

.footer-nav a:hover {
  color: #ffffff;
}

.footer-copyright {
  text-align: center;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.78rem;
  color: #64748b;
}

/* ===================================================
   7. 響應式與大螢幕優化 (Responsive & Large Displays)
   =================================================== */
@media (min-width: 1400px) {
  .container {
    max-width: 1320px;
  }
  
  .site-header {
    height: 84px;
  }
  
  .nav-container {
    height: 84px;
  }

  .nav-menu ul.nav-list {
    gap: 32px;
  }

  .nav-menu a {
    font-size: 1.05rem;
  }
}

@media (min-width: 769px) {
  .nav-item.dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }
}

@media (max-width: 768px) {
  .nav-container {
    height: 64px;
  }

  .logo-img,
  .logo img {
    height: 40px;
  }

  .mobile-toggle {
    display: flex;
  }

  .nav-menu {
    position: absolute;
    top: 64px;
    left: 0;
    width: 100%;
    background-color: #fff;
    flex-direction: column;
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    display: none;
  }

  .nav-menu.active {
    display: flex;
  }

  .nav-menu ul.nav-list {
    flex-direction: column;
    width: 100%;
    text-align: center;
    gap: 16px;
  }

  .nav-item.dropdown .dropdown-menu {
    position: static;
    box-shadow: none;
    border: none;
    background-color: var(--bg-light);
    max-height: 0;
    overflow: hidden;
    padding: 0;
    transform: none;
    opacity: 1;
    visibility: visible;
    transition: max-height 0.3s ease, padding 0.3s ease;
  }

  .nav-item.dropdown.open .dropdown-menu {
    max-height: 200px;
    padding: 8px 0;
    margin-top: 8px;
    border-radius: var(--radius-sm);
  }

  .nav-item.dropdown .dropdown-menu li a {
    text-align: center;
    padding: 6px 16px;
  }

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

  .form-group:nth-child(5),
  .form-group:nth-child(6),
  .contact-form .btn-block {
    grid-column: span 1;
  }

  .contact-modal {
    width: calc(100vw - 24px);
    right: 12px;
  }

  .nav-item-btn {
    width: 100%;
    justify-content: center;
  }
  
  .nav-item-btn a {
    width: 80%;
    text-align: center;
  }

  .footer-main {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }

  .contact-label {
    display: block;
    border-right: none;
    padding-right: 0;
    width: 100%;
  }

  .contact-row-sub {
    gap: 6px 12px;
  }

  .divider {
    display: none;
  }

  .footer-nav {
    gap: 14px;
    padding-top: 4px;
  }

  .footer-copyright {
    text-align: center;
  }
}