:root {
    --primary-color: #2c3e50;
    --secondary-color: #2c3e50;
    --background-color: #ecf0f1;
    --text-color: #34495e;
    --icon-color-light: #6ba7cf;
    --icon-color-dark: #f5f5f5;
    --header-text-color: white;
    --footer-text-color: white;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: 'Noto Sans TC', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

header {
    background-color: var(--primary-color);
    color: var(--header-text-color);
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

h1 {
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
}

main {
    flex-grow: 1;
    padding: 0.5rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 90%;
    display: flex;
    flex-direction: column;
}

#map {
    flex-grow: 1;
    width: 100%;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

footer {
    background-color: var(--secondary-color);
    color: var(--footer-text-color);
    text-align: center;
    padding: 0 0;
    font-size: 0.8rem;
}

.custom-plane-icon img {
    transition: transform 0.5s ease-out;
}

.custom-tooltip {
    background-color: rgba(230, 29, 106, 0.8);
    border: none;
    border-radius: 5px;
    padding: 10px;
    font-family: 'Noto Sans TC', sans-serif;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    color: var(--text-color);
}

.leaflet-tooltip-top:before {
    border-top-color: rgba(26, 35, 126, 0.8);
}

body.dark-mode {
    --background-color: #2c3e50;
    --text-color: #ecf0f1;
}

body.dark-mode .custom-tooltip {
    background-color: rgba(44, 62, 80, 0.9);
    color: #ecf0f1;
}

body.dark-mode .leaflet-tooltip-top:before {
    border-top-color: rgba(44, 62, 80, 0.9);
}

.toggle-mode-btn {
    background-color: var(--secondary-color);
    color: var(--icon-color-dark);
    transition: all 0.3s ease;
    width: 30px;
    height: 30px;
    padding: 0;
    border-radius: 50%; 
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.65);
}
body:not(.dark-mode) .toggle-mode-btn img {
    width: 18px; /* 調整圖示的大小 */
    height: 18px;
    opacity:0.7
}
.toggle-mode-btn img {
    width: 20px; /* 調整圖示的大小 */
    height: 20px;
    opacity:0.7
}
body:not(.dark-mode) .toggle-mode-btn {
    background-color: white;
    color: var(--icon-color-light);
}

.toggle-mode-btn:hover {
    background-color: var(--primary-color);
    color: white;
}

table {
    width: 100%;
    border-collapse: collapse;
    line-height: 1.2;
}

td {
    padding: 5px;
    border-bottom: 1px solid #dddddd;
    text-align: left; 
}

tbody.no-bold td:first-child {
    font-weight: normal;
}

tbody td:first-child {
    font-weight: bold;
    width: 60px;
    text-align: left; 
}

.sidebar {
  position: fixed;
  left: 0;
  bottom: 40px; /* 原本是 calc(40px)，這裡簡化寫法也 ok */
  width: 100%;
  background-color: rgba(234, 243, 245, 0.95); /* 不用 'rgb(..., 0.9)'，改為 rgba */
  font-family: 'Noto Sans TC', sans-serif;
  font-size: 14px;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  max-height: 85vh;           /* 調整最大高度 */
  height: 45vh;               /* 預設初始高度 */
  overflow: hidden;          /* ⭐ 避免整體滑動，讓內部控制 */
  transition: height 0.3s ease;
  display: none;
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
  padding-top: 24px; /* 預留 drag-handle 的空間 */
}

body.dark-mode .sidebar {
    background-color: rgba(44, 62, 80, 0.95);
    color: #ecf0f1;
}
/* 針對電腦版 */
@media (min-width: 768px) {
    .sidebar {
      width: 400px; /* 固定 sidebar 寬度 */
      height: 100%;
      max-height: 100%;
      top: 0;
      bottom: 0;
      left: auto;
      right: 0;
      border-top-left-radius: 0;
      border-top-right-radius: 0;
      border-bottom-left-radius: 15px;
      border-bottom-right-radius: 0;
      background: rgba(255, 255, 255, 0.9);
      padding-top: 0; /* 桌機不需要 drag handle 空間 */
    }
  }
@media (max-width: 768px) {
    .sidebar {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .sidebar {
        font-size: 10px;
    }
}

.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr; /* 兩列佈局，適合桌面 */
    grid-template-rows: auto;
    gap: 10px; /* 調整間距，讓內容看起來不那麼擁擠 */
    font-size: 12px;
}

@media (max-width: 768px) {
    .info-grid {
        grid-template-columns: 1fr; /* 手機改為單列佈局，內容垂直排列 */
        font-size: 10px;
        gap: 8px;
    }
}

@media (max-width: 480px) {
    .info-grid {
        font-size: 9px;
        grid-template-columns: 1fr;
    }
}

.info-cell {
    padding: 8px; /* 調整內邊距，使內容更易讀 */
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    overflow: hidden;
}
.info-cell .basic_inf {
    margin-right: 0;
    display: grid;
    /* text-align: left; */
    grid-template-columns: 1fr 1fr 2fr;
    font-size: 130%;
    background-color: rgba(131, 152, 168, 0.1);
    justify-content: center;
    align-items: baseline;
    justify-items: center;
}
.info-cell .from-to{
    display: grid;
    grid-template-columns: 40% 20% 40%;
    grid-template-rows: 1fr;
}
.info-cell .fly-iconp {
    display: flex;
    flex-direction: column; /* 垂直排列圖標和文字 */
    justify-content: center; /* 水平居中 */
    align-items: center; /* 垂直居中 */
}

.info-cell .fly-icon {
    font-size: 280%;
    transform: rotate(43deg); /* 如果你想旋轉圖標 */
}

.info-cell .flight-time {
    font-size: 175%;
    font-family: 'Orbitron', sans-serif;
    letter-spacing: 1px;
    color: #2c3e50;
    display: inline-block;
    background-color: rgba(131, 152, 168, 0.1);
    border-radius: 5px;
    margin-top: 10px; /* 圖標和文字之間的間距 */
    text-align: left; 
}
.flight-time.mid {
    text-align: center;  
}
.info-cell .airport{
    margin-right: 0;
    display: grid;
    text-align: center;
    font-size: 130%;
    background-color: rgba(131, 152, 168, 0.1);
}
.airport_l{
    font-size: 180%;
}
.airport_s{
    font-size: 80%;
}
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@500&display=swap');

.time-display {
    font-family: 'Orbitron', sans-serif;
    font-size: 100%;
    letter-spacing:1px;
    color: #2c3e50;
    display: inline-block;
    background-color: rgba(131, 152, 168, 0.2);
    border-radius: 5px;
    text-align: center;
    position: relative;
    top: 25%;
}

@media (max-width: 480px) {
    .time-display {
        font-size: 100%;
    }
}

.image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 10px;
}

#image-display {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2);
}

.nav-btn {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.nav-btn:hover {
    background-color: #0056b3;
}

.image-link-container {
    text-align: center;
    margin-top: 10px;
    bottom: 10px;
    position: relative;
}

.image-link-btn {
    display: inline-block;
    padding: 1% 1%;
    background-color: rgb(234 243 245 / 90%);
    color: rgb(57, 95, 179);
    text-decoration: none;
    border-radius: 5px;
    font-size: 120%;
    transition: background-color 0.3s ease;
}

.image-link-btn:hover {
    background-color: rgba(234, 238, 245, 0.9);
}


@media (max-width: 768px) {
    .image-placeholder img {
        width: 90%;
    }
}

@media (max-width: 480px) {
    .image-placeholder img {
        width: 90%;
    }
}





.info-cell span {
    display: inline-block;
}

#prev-btn, #next-btn {
    position: relative;
    background-color: rgba(0, 0, 0, 0.1);
    border: none;
    color: white;
    font-size: 20px;
    padding: 10px;
    cursor: pointer;
    padding-top: 30%;
    padding-bottom: 30%;
}


/* 調整地圖容器，為底部的資訊窗留出空間 */
#map {
    height: calc(100% - 40px); /* 為頁腳留出空間 */
}

/* 確保頁腳在資訊窗之上 */
footer {
    position: relative;
    z-index: 1001;
}


.wrapper {
    --text-color: #ffffff;
    position: relative; /* 讓子元素可以相對於 .wrapper 定位 */
    width: 100%;
    height: 100%; /* 確保 wrapper 覆蓋所需範圍 */
  }
  
  .wrapper a {
    position: absolute; /* 讓 <a> 充滿 .wrapper */
    top: 0;
    left: 0;
    width: 100%; /* 使 <a> 區域與 .wrapper 一致 */
    height: 100%;
    z-index: 2; /* 確保 <a> 具有足夠的 z-index */
    display: block;
    pointer-events: auto;
}
  
  .wrapper a {
    -webkit-clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
    pointer-events: auto;
  }
  
  .wrapper a:hover {
    -webkit-clip-path: none;
    clip-path: none;
    z-index: 2;
  }
  
  /* 針對手機禁用 hover 效果 */
  @media (max-width: 768px) {
    .wrapper a {
      pointer-events: none; /* 禁用 hover 行為 */
    }
  }
  
  .wrapper a:hover ~ .fill-text:before {
    --fill-from: circle(0% at 0% 50%);
    --fill-to: circle(150% at 100% 50%);
    animation: fill-text 2s forwards;
  }
  
  .wrapper a.active {
    -webkit-clip-path: none;
    clip-path: none;
    z-index: 2;
  }
  
  @keyframes fill-text {
    0% {
      clip-path: var(--fill-from);
    }
    100% {
      clip-path: var(--fill-to);
      color: var(--text-color);
    }
  }
  
  .fill-text {
    color: transparent;
    -webkit-text-stroke: 0.1px var(--text-color);
    font-family: 'Noto Sans TC', sans-serif;
    font-size: 3vw;
    
  }
  
  .fill-text:before {
    content: attr(data-text);
    -webkit-text-stroke: 0.1px var(--text-color);
    position: absolute;
  }
  
  .card-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 10px;
  }
  
  .card {
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: 10px;
    padding: 12px 16px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    font-size: 14px;
    color: #2c3e50;
  }
  
  body.dark-mode .card {
    background-color: rgba(44, 62, 80, 0.9);
    color: #ecf0f1;
  }
  .card .section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
    color: #007bff;
  }
  
  .card .section-title::after {
    content: '▼';
    font-size: 0.9em;
    transform: rotate(0deg);
    transition: transform 0.3s;
    margin-left: auto;
  }
  
  .card .section-title.open::after {
    transform: rotate(180deg); /* 展開時箭頭朝上 */
  }
  
  .section-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    opacity: 0;
  }
  
  .section-content.open {
    max-height: 800px; /* 足夠高度即可 */
    opacity: 1;
  }
  
  body.dark-mode .section-title {
    color: #4fc3f7;
  }
  
  
  .card p {
    margin: 4px 0;
    font-size: 13px;
  }
  
  .scroll-content {
    max-height: 6px;
    overflow-y: auto;
    padding-right: 4px;
    -webkit-overflow-scrolling: touch;
  }
  @media (max-width: 600px) {
    .card-grid {
      grid-template-columns: 1fr; /* 一列只顯示一個卡片 */
      gap: 12px;
      padding: 12px;
    }
  
    .card {
      font-size: 16px;     /* 增加文字大小 */
      padding: 16px 20px;  /* 增加內距，方便點擊 */
    }
  
    .section-title {
      font-size: 18px;
      font-weight: bold;
      margin-bottom: 10px;
    }
  
    .title {
      font-size: 20px;
      font-weight: bold;
    }
  
    .subtitle {
      font-size: 16px;
      color: #555;
    }
  
    .scroll-content {
      max-height: 6px;  /* 放大航班列表區域 */
      -webkit-overflow-scrolling: touch;
    }
  
    .arrival-item {
      padding: 10px;
      font-size: 15px;
    }
  }
  
  .scroll-content::-webkit-scrollbar {
    width: 6px;
  }
  .scroll-content::-webkit-scrollbar-thumb {
    background-color: #ccc;
    border-radius: 6px;
  }
  .arrival-item {
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    margin-bottom: 6px;
    transition: background-color 0.3s;
  }
  .arrival-item .flight-meta {
    color: #333; /* 或白色：#fff 若在深色背景 */
  }
  body.dark-mode .arrival-item .flight-meta {
    color: #ccc;
  }
  
  .arrival-item:hover {
    background-color: #f0f8ff; /* 淡藍色 */
    border: 1px solid #c2dfff;
  }
  
  .arrival-item.active {
    animation: flash 0.5s;
  }
  .flight-meta {
    font-size: 12px;
    color: #666;
    line-height: 1.4;
    margin-top: 4px;
  }
  
  @keyframes flash {
    0% { background-color: #ffe066; }
    50% { background-color: #fff5cc; }
    100% { background-color: transparent; }
  }
  .leaflet-marker-icon img {
    transition: transform 0.2s ease;
  }
  
  .leaflet-marker-icon:hover img {
    transform: scale(1.2);
  }
  @media (max-width: 768px) {
   /* 手機版 Sidebar 動畫樣式 */
    .sidebar {
      position: fixed;
      left: 0;
      bottom: 0;
      width: 100%;
      background-color: rgba(234, 243, 245, 0.95);
      font-family: 'Noto Sans TC', sans-serif;
      font-size: 14px;
      z-index: 1000;
      height: 25vh;           /* 預設高度：佔 1/4 */
      max-height: 100vh;
      overflow: hidden;
      transition: height 0.3s ease;
      border-top-left-radius: 16px;
      border-top-right-radius: 16px;
      box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.3);
      display: none;          /* 初始隱藏 */
      padding-top: 24px;
    }

    /* 滑到全螢幕狀態 */
    .sidebar.fullscreen {
      height: 100vh;
    }

    /* 滑回收合狀態（可自訂） */
    .sidebar.minimized {
      height: 25vh;
    }

    .drag-handle {
      width: 100%;
      height: 16px;
      background: #ccc;
      border-top-left-radius: 12px;
      border-top-right-radius: 12px;
      cursor: grab;
      display: flex;
      justify-content: center;
      align-items: center;
    }
    .drag-handle::before {
      content: '';
      width: 40px;
      height: 4px;
      background: #888;
      border-radius: 2px;
    }
    
    
  }
  
  .return-home-btn {
    position: fixed;
    bottom: 1vw;
    left: 1vw;
    z-index: 999;
    background: linear-gradient(to right, #ffcc70, #ffa500);
    color: #2c3e50;
    font-weight: bold;
    font-size: 1.1rem;
    padding: 12px 24px;
    border-radius: 50px;
    text-decoration: none;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
  }

/* 手機寬度縮小樣式 */
  @media (max-width: 600px) {
    .return-home-btn {
      font-size: 0.9rem;
      padding: 8px 16px;
    }
  }
  .return-home-btn::before {
    content: '✈️';
    position: absolute;
    left: 3px;
    top: 50%;
    transform: translateY(-50%);
    animation: wag 1.5s infinite ease-in-out;
  }

  @keyframes wag {
    0%, 100% { transform: translateY(-50%) rotate(-10deg); }
    50% { transform: translateY(-50%) rotate(10deg); }
  }

  .return-home-btn:hover {
    transform: translateY(-3px);
    background: linear-gradient(to right, #ffe08a, #ffb84d);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.25);
  }

  