/* ========================================
   統一主題樣式 - 活潑且響應式設計
   ======================================== */

/* ========== 顏色變數 ========== */
:root {
  /* 主色調 - 活潑的漸變色系 */
  --primary-color: #4A90E2;
  --primary-dark: #2E5C8A;
  --primary-light: #7CB3F5;
  --secondary-color: #E8C9A6;
  --secondary-dark: #D4A574;
  --accent-color: #FF6B6B;
  --accent-light: #FFB88C;
  
  /* 中性色 */
  --text-primary: #2C3E50;
  --text-secondary: #6C757D;
  --bg-light: #F8F9FA;
  --bg-white: #FFFFFF;
  --border-color: #E0E0E0;
  
  /* 陰影 */
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.12);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.16);
  
  /* 過渡效果 */
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s ease;
}

/* ========== 基礎樣式 ========== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: "Noto Serif TC", "Source Han Serif TC", "PMingLiU", serif, Microsoft JhengHei;
  color: var(--text-primary);
  line-height: 1.7;
  letter-spacing: 0.5px;
  overflow-x: hidden;
}

/* ========== 導航欄 ========== */
.navbar {
  background: linear-gradient(135deg, rgba(255,255,255,0.95) 0%, rgba(248,249,250,0.95) 100%) !important;
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-md);
  padding: 0.5rem 1rem !important;
  transition: var(--transition-normal);
}

.navbar-brand img {
  height: auto;
  max-height: 90px;
  width: auto;
  transition: var(--transition-fast);
}

.navbar-brand img:hover {
  transform: scale(1.05);
}

.nav-link {
  color: #2c2c2c !important;
  font-weight: 600;
  font-size: 16px;
  padding: 0.5rem 1rem !important;
  position: relative;
  transition: var(--transition-fast);
  font-family: "Noto Serif TC", serif;
  letter-spacing: 1px;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: #5a4a42;
  transform: translateX(-50%);
  transition: var(--transition-normal);
  border-radius: 2px;
}

.nav-link:hover::after,
.nav-link.active::after {
  width: 80%;
}

.nav-link:hover {
  color: #5a4a42 !important;
}

/* AI專區樣式 - 與其他選單一致，僅修改字體顏色 */
.nav-link-ai {
  background: none !important;
  border: none !important;
  border-radius: 0 !important;
  padding: 0.5rem 1rem !important;
  margin: 0 !important;
  box-shadow: none !important;
  color: #4A90E2 !important;
}

.nav-link-ai:hover {
  transform: none !important;
  box-shadow: none !important;
  background: none !important;
  color: #2E5C8A !important;
}

.nav-link-ai::after {
  display: block !important;
}

/* ========== 下拉選單 ========== */
.dropdown-menu {
  border: none;
  box-shadow: var(--shadow-lg);
  border-radius: 12px;
  padding: 0.5rem 0;
  margin-top: 0.5rem;
  animation: dropdownSlide 0.3s ease;
}

@keyframes dropdownSlide {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dropdown-item {
  padding: 0.75rem 1.5rem;
  transition: var(--transition-fast);
  font-family: "Noto Serif TC", serif;
  font-size: 15px;
  color: #2c2c2c;
}

.dropdown-item:hover {
  background: #f0e5de;
  color: #3a2a22;
}

/* ========== 標題樣式 ========== */
.title, .title2, .title3 {
  font-weight: 600;
  margin-bottom: 1.5rem;
  position: relative;
  display: block;
  width: 100%;
  font-family: "Noto Serif TC", serif;
  letter-spacing: 2px;
}

.title {
  font-size: 2.5rem;
  color: #2a1a12;
}

.title2 {
  font-size: 2rem;
  color: #2a1a12;
}

.title3 {
  font-size: 1.5rem;
  color: #2a1a12;
}

/* 確保 text-center 類別可以覆蓋預設對齊 */
.text-center.title,
.text-center.title2,
.text-center.title3,
.title.text-center,
.title2.text-center,
.title3.text-center {
  text-align: center !important;
}

.title_line {
  height: 4px;
  background: linear-gradient(90deg, var(--primary-color), var(--accent-light));
  border: none;
  border-radius: 2px;
  margin: 1rem auto 2rem;
  max-width: 100px;
  animation: expandLine 0.6s ease;
}

@keyframes expandLine {
  from {
    width: 0;
    opacity: 0;
  }
  to {
    width: 100px;
    opacity: 1;
  }
}

/* ========== 卡片樣式 ========== */
.card {
  border: none;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-normal);
  background: white;
  height: 100%;
}

.card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-lg);
}

.card img {
  width: 100%;
  height: 250px;
  object-fit: cover;
  transition: var(--transition-slow);
}

.card:hover img {
  transform: scale(1.05);
}

.card-body {
  padding: 1.5rem;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

/* ========== 按鈕樣式 ========== */
.btn {
  border-radius: 25px;
  padding: 0.75rem 2rem;
  font-weight: 600;
  transition: var(--transition-normal);
  border: none;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
  width: 300px;
  height: 300px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
  color: white;
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary-color));
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.link {
  color: var(--primary-color);
  font-weight: 600;
  text-decoration: none;
  position: relative;
  display: inline-block;
  transition: var(--transition-fast);
}

.link::after {
  content: '→';
  margin-left: 5px;
  transition: var(--transition-fast);
}

.link:hover {
  color: var(--primary-dark);
  transform: translateX(5px);
}

.link:hover::after {
  margin-left: 10px;
}

/* ========== 區塊樣式 ========== */
.section {
  padding: 4rem 0;
  position: relative;
}

.section:nth-child(even) {
  background: var(--bg-light);
}

/* ========== 響應式網格 ========== */
.row {
  margin-left: -15px;
  margin-right: -15px;
}

[class*="col-"] {
  padding: 15px;
}

/* ========== 手機響應式設計 ========== */
@media (max-width: 768px) {
  /* 導航欄 */
  .navbar-brand img {
    height: auto;
    max-height: 65px;
    width: auto;
  }
  
  .nav-link {
    padding: 0.75rem 1rem !important;
  }
  
  .nav-link-ai {
    margin: 0 !important;
    text-align: left !important;
  }
  
  /* 標題 */
  .title {
    font-size: 1.75rem;
  }
  
  .title2 {
    font-size: 1.5rem;
  }
  
  .title3 {
    font-size: 1.25rem;
  }
  
  /* 卡片 */
  .card {
    margin-bottom: 1.5rem;
  }
  
  .card img {
    height: 200px;
  }
  
  /* 區塊間距 */
  .section {
    padding: 2rem 0;
  }
  
  /* 容器 */
  .container {
    padding-left: 15px;
    padding-right: 15px;
  }
}

@media (max-width: 576px) {
  html {
    font-size: 14px;
  }
  
  .title {
    font-size: 1.5rem;
  }
  
  .title2 {
    font-size: 1.25rem;
  }
  
  .card img {
    height: 180px;
  }
  
  .btn {
    padding: 0.5rem 1.5rem;
  }
}

/* ========== 表格響應式 ========== */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table {
  width: 100%;
  margin-bottom: 1rem;
  background-color: transparent;
}

@media (max-width: 768px) {
  .table {
    font-size: 0.875rem;
  }
  
  .table td, .table th {
    padding: 0.5rem;
  }
}

/* ========== 頁腳 ========== */
footer {
  background: linear-gradient(135deg, #2C3E50 0%, #34495E 100%);
  color: white;
  padding: 2rem 0;
  margin-top: 4rem;
}

footer p {
  margin: 0.25rem 0;
  opacity: 0.9;
}

/* ========== 動畫效果 ========== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in-up {
  animation: fadeInUp 0.6s ease;
}

/* ========== 載入動畫 ========== */
.loading {
  display: inline-block;
  width: 50px;
  height: 50px;
  border: 4px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ========== 圖片畫廊 ========== */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.5rem;
  padding: 1rem 0;
}

@media (max-width: 768px) {
  .gallery {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
  }
}

/* ========== 實用工具類 ========== */
.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.text-left {
  text-align: left;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mt-5 { margin-top: 3rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.mb-5 { margin-bottom: 3rem; }

.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }
.p-5 { padding: 3rem; }

