/* 重置與基礎樣式 */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent; /* 移除移動設備點擊時的高亮 */
}

:root {
  /* Apple 風格的顏色變數 */
  --apple-blue: #0071e3;
  --apple-gray: #f5f5f7;
  --apple-dark: #1d1d1f;
  --apple-light: #fbfbfd;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --red-500: #ef4444;
  --blue-500: #3b82f6;
  --green-500: #10b981;
  
  /* 行動裝置變數 */
  --safe-area-inset-top: env(safe-area-inset-top, 0px);
  --safe-area-inset-bottom: env(safe-area-inset-bottom, 0px);
  --safe-area-inset-left: env(safe-area-inset-left, 0px);
  --safe-area-inset-right: env(safe-area-inset-right, 0px);
}

/* 基礎樣式 */
html {
  font-family: 'Noto Sans TC', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang TC', 'Hiragino Sans TC', 'Microsoft JhengHei', Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--apple-dark);
  scroll-behavior: smooth; /* 平滑滾動效果 */
  -webkit-text-size-adjust: 100%; /* 防止在旋轉設備時字體自動調整大小 */
}

body {
  background-color: var(--apple-light);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: var(--safe-area-inset-bottom); /* 為底部的安全區域添加填充 */
  font-family: 'Source Han Sans TC', 'Noto Sans TC', sans-serif;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

/* 排版 */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  font-family: 'Noto Sans TC', sans-serif;
}

h1 {
  font-size: 2.5rem;
  margin-bottom: 1.5rem;
}

h2 {
  font-size: 2rem;
  margin-bottom: 1rem;
}

h3 {
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
}

p {
  margin-bottom: 1rem;
}

/* 佈局工具類 */
.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1rem;
  padding-left: calc(1rem + var(--safe-area-inset-left));
  padding-right: calc(1rem + var(--safe-area-inset-right));
}

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.flex-grow {
  flex-grow: 1;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.justify-center {
  justify-content: center;
}

.space-x-8 > * + * {
  margin-left: 2rem;
}

.space-y-2 > * + * {
  margin-top: 0.5rem;
}

.space-y-12 > * + * {
  margin-top: 3rem;
}

.hidden {
  display: none;
}

.absolute {
  position: absolute;
}

.relative {
  position: relative;
}

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

.text-left {
  text-align: left;
}

/* 網格系統 */
.grid {
  display: grid;
}

.grid-cols-1 {
  grid-template-columns: repeat(1, minmax(0, 1fr));
}

.gap-4 {
  gap: 1rem;
}

.gap-6 {
  gap: 1.5rem;
}

.gap-8 {
  gap: 2rem;
}

.col-span-2 {
  grid-column: span 2 / span 2;
}

/* 間距 */
.p-2 {
  padding: 0.5rem;
}

.p-4 {
  padding: 1rem;
}

.p-6 {
  padding: 1.5rem;
}

.p-8 {
  padding: 2rem;
}

.px-2 {
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

.px-4 {
  padding-left: 1rem;
  padding-right: 1rem;
}

.py-1 {
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
}

.py-2 {
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

.py-6 {
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
}

.py-10 {
  padding-top: 2.5rem;
  padding-bottom: 2.5rem;
}

.py-12 {
  padding-top: 3rem;
  padding-bottom: 3rem;
}

.pt-8 {
  padding-top: 2rem;
}

.pl-3 {
  padding-left: 0.75rem;
}

.pl-10 {
  padding-left: 2.5rem;
}

.mb-1 {
  margin-bottom: 0.25rem;
}

.mb-2 {
  margin-bottom: 0.5rem;
}

.mb-3 {
  margin-bottom: 0.75rem;
}

.mb-4 {
  margin-bottom: 1rem;
}

.mb-6 {
  margin-bottom: 1.5rem;
}

.mb-8 {
  margin-bottom: 2rem;
}

.mt-2 {
  margin-top: 0.5rem;
}

.mt-4 {
  margin-top: 1rem;
}

.mt-8 {
  margin-top: 2rem;
}

.mx-1 {
  margin-left: 0.25rem;
  margin-right: 0.25rem;
}

.mx-auto {
  margin-left: auto;
  margin-right: auto;
}

.ml-2 {
  margin-left: 0.5rem;
}

.mr-1 {
  margin-right: 0.25rem;
}

.mr-4 {
  margin-right: 1rem;
}

/* 顏色 */
.text-white {
  color: #fff;
}

.text-apple-dark {
  color: var(--apple-dark);
}

.text-apple-blue {
  color: var(--apple-blue);
}

.text-gray-400 {
  color: var(--gray-400);
}

.text-gray-500 {
  color: var(--gray-500);
}

.text-gray-600 {
  color: var(--gray-600);
}

.text-gray-700 {
  color: var(--gray-700);
}

.text-red-500 {
  color: var(--red-500);
}

.text-blue-500 {
  color: var(--blue-500);
}

.bg-white {
  background-color: #fff;
}

.bg-apple-light {
  background-color: var(--apple-light);
}

.bg-apple-dark {
  background-color: var(--apple-dark);
}

.bg-apple-gray {
  background-color: var(--apple-gray);
}

.bg-apple-blue {
  background-color: var(--apple-blue);
}

.bg-gray-50 {
  background-color: #f9fafb;
}

.bg-gray-100 {
  background-color: var(--gray-100);
}

.border-gray-200 {
  border-color: var(--gray-200);
}

.border-gray-300 {
  border-color: var(--gray-300);
}

.border-gray-800 {
  border-color: var(--gray-800);
}

/* 邊框 */
.border {
  border-width: 1px;
  border-style: solid;
}

.border-b {
  border-bottom-width: 1px;
  border-bottom-style: solid;
}

.border-t {
  border-top-width: 1px;
  border-top-style: solid;
}

.rounded-lg {
  border-radius: 0.5rem;
}

.rounded-xl {
  border-radius: 0.75rem;
}

.rounded-2xl {
  border-radius: 1rem;
}

.rounded-3xl {
  border-radius: 1.5rem;
}

.rounded-full {
  border-radius: 9999px;
}

/* 文字大小 */
.text-xs {
  font-size: 0.75rem;
}

.text-sm {
  font-size: 0.875rem;
}

.text-lg {
  font-size: 1.125rem;
}

.text-xl {
  font-size: 1.25rem;
}

.text-2xl {
  font-size: 1.5rem;
}

.text-3xl {
  font-size: 1.875rem;
}

.text-4xl {
  font-size: 2.25rem;
}

.text-5xl {
  font-size: 3rem;
}

/* 字體粗細 */
.font-medium {
  font-weight: 500;
}

.font-semibold {
  font-weight: 600;
}

.font-bold {
  font-weight: 700;
}

/* 陰影 */
.shadow-sm {
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.shadow-lg {
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.shadow-apple {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* 過渡效果 */
.transition-colors {
  transition-property: color, background-color, border-color;
  transition-duration: 200ms;
}

.transition-shadow {
  transition-property: box-shadow;
  transition-duration: 200ms;
}

/* 元件樣式 */
.apple-card {
  background-color: #fff;
  border-radius: 1rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  padding: 1.5rem;
  transition: box-shadow 200ms;
}

.apple-input {
  border: 1px solid var(--gray-300);
  border-radius: 0.5rem;
  padding: 0.5rem 1rem;
  width: 100%;
  transition: all 200ms;
}

.apple-input:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(0, 113, 227, 0.3);
  border-color: var(--apple-blue);
}

.apple-button {
  background-color: var(--apple-blue);
  color: white;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  transition: background-color 200ms;
}

.apple-button:hover {
  background-color: rgba(0, 113, 227, 0.9);
}

/* 狀態變化 */
.hover\:bg-gray-50:hover {
  background-color: #f9fafb;
}

.hover\:bg-gray-100:hover {
  background-color: var(--gray-100);
}

.hover\:bg-gray-200:hover {
  background-color: var(--gray-200);
}

.hover\:bg-opacity-90:hover {
  opacity: 0.9;
}

.hover\:text-white:hover {
  color: #fff;
}

.hover\:text-apple-blue:hover {
  color: var(--apple-blue);
}

.hover\:shadow-lg:hover {
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.hover\:underline:hover {
  text-decoration: underline;
}

.group:hover .group-hover\:underline {
  text-decoration: underline;
}

.focus\:outline-none:focus {
  outline: none;
}

/* 響應式設計 */
@media (min-width: 640px) {
  .sm\:px-6 {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
  
  .sm\:text-sm {
    font-size: 0.875rem;
  }
  
  .sm\:grid-cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 768px) {
  .md\:flex {
    display: flex;
  }
  
  .md\:hidden {
    display: none;
  }
  
  .md\:grid-cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  
  .md\:grid-cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  
  .md\:grid-cols-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  
  .md\:text-2xl {
    font-size: 1.5rem;
  }
  
  .md\:text-6xl {
    font-size: 3.75rem;
  }
}

@media (min-width: 1024px) {
  .lg\:px-8 {
    padding-left: 2rem;
    padding-right: 2rem;
  }
  
  .lg\:grid-cols-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  
  .lg\:grid-cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* 輔助功能 */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* 行動內容截斷 */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 自訂捲動條風格 */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* 行動裝置優化類 */
.touch-action-none {
  touch-action: none;
}

.touch-action-manipulation {
  touch-action: manipulation;
}

/* 增強的容器類 */
.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1rem;
  padding-left: calc(1rem + var(--safe-area-inset-left));
  padding-right: calc(1rem + var(--safe-area-inset-right));
}

/* 優化行動裝置導航按鈕 */
.mobile-nav-button {
  min-width: 44px; /* 符合 Apple HIG 指南的最小觸控目標尺寸 */
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 優化觸控目標大小 */
a, button, .clickable, input[type="button"], input[type="submit"] {
  min-height: 44px;
  padding: 0.5rem;
}

.touch-target {
  position: relative;
}

.touch-target::after {
  content: '';
  position: absolute;
  top: -10px;
  left: -10px;
  right: -10px;
  bottom: -10px;
  z-index: -1;
}

/* 行動裝置優化動畫 */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* 增強媒體查詢 */
@media (max-width: 639px) {
  .xs\:text-center {
    text-align: center;
  }
  
  .xs\:block {
    display: block;
  }
  
  .xs\:hidden {
    display: none;
  }
  
  .xs\:w-full {
    width: 100%;
  }
  
  .xs\:px-2 {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
  
  .xs\:py-4 {
    padding-top: 1rem;
    padding-bottom: 1rem;
  }
  
  .xs\:text-sm {
    font-size: 0.875rem;
  }
  
  .xs\:space-y-2 > * + * {
    margin-top: 0.5rem;
  }
  
  .xs\:flex-col {
    flex-direction: column;
  }
  
  /* 增強卡片在行動裝置上的可點擊性 */
  .xs\:card-clickable {
    position: relative;
    cursor: pointer;
  }
  
  .xs\:card-clickable::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
  }
}

@media (min-width: 768px) {
  .md\:flex {
    display: flex;
  }
  
  .md\:hidden {
    display: none;
  }
  
  .md\:grid-cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  
  .md\:grid-cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  
  .md\:grid-cols-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  
  .md\:text-2xl {
    font-size: 1.5rem;
  }
  
  .md\:text-6xl {
    font-size: 3.75rem;
  }
  
  /* 修正文字與按鈕大小以獲得更好的移動端點擊體驗 */
  .md\:min-h-touch {
    min-height: 44px;
  }
  
  .md\:p-touch {
    padding: 1rem;
  }
}

/* 行動裝置加載最佳化 */
.loading-skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* 為具有延遲加載的圖像添加佔位符 */
.img-lazy {
  transition: opacity 0.3s ease;
}

.img-lazy:not([loaded]) {
  opacity: 0;
}

.img-placeholder {
  background-color: var(--gray-200);
}

/* 行動裝置手勢支援 */
.swipe-container {
  overflow-x: auto;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
  -webkit-overflow-scrolling: touch; /* 流暢的iOS滾動 */
  scroll-snap-type: x mandatory;
  display: flex;
}

.swipe-container::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

.swipe-item {
  flex: 0 0 auto;
  scroll-snap-align: start;
}

/* 底部導航 (移動版) */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 0.5rem 0;
  padding-bottom: calc(0.5rem + var(--safe-area-inset-bottom));
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
  z-index: 100;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem;
  min-width: 64px;
  font-size: 0.75rem;
}

.bottom-nav-icon {
  font-size: 1.25rem;
  margin-bottom: 0.25rem;
}

@media (min-width: 768px) {
  .bottom-nav {
    display: none;
  }
}

/* 滾動視圖 */
.overflow-x-auto {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  scrollbar-width: none;  /* Firefox */
  -ms-overflow-style: none;  /* IE and Edge */
}

.overflow-x-auto::-webkit-scrollbar {
  display: none;  /* Chrome, Safari and Opera */
}

/* 預報卡片固定寬度 */
@media (max-width: 640px) {
  .forecast-grid {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 160px;
    grid-gap: 1rem;
    width: max-content;
    min-width: 100%;
  }
  
  .forecast-day-card {
    width: 160px;
    min-width: 160px;
  }
}

/* 滾動指示器優化 */
.scroll-indicator-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #ccc;
  transition: all 0.3s ease;
}

.scroll-indicator-dot.active {
  background-color: #666;
  transform: scale(1.2);
}

@media (min-width: 1024px) {
  .week-forecast-container {
    overflow: visible;
  }
}

/* 溫度顯示樣式 */
.temperature-display {
  font-family: 'Noto Sans TC', sans-serif;
  font-size: 4rem;
  font-weight: 700;
  line-height: 1;
  color: var(--apple-dark);
  text-align: center;
  margin: 1rem 0;
}

.temperature-unit {
  font-size: 2rem;
  vertical-align: super;
  margin-left: 0.25rem;
}

/* 響應式網格系統 */
.responsive-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  padding: 2rem;
}

/* 響應式斷點 */
@media screen and (min-width: 1200px) {
  .responsive-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .temperature-display {
    font-size: 6rem;
  }
}

@media screen and (min-width: 768px) and (max-width: 1199px) {
  .responsive-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .temperature-display {
    font-size: 5rem;
  }
}

@media screen and (max-width: 767px) {
  .responsive-grid {
    grid-template-columns: 1fr;
  }
  
  .temperature-display {
    font-size: 4rem;
  }
}

/* 卡片樣式 */
.weather-card {
  background: var(--apple-light);
  border-radius: 1rem;
  padding: 1.5rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
}

.weather-card:hover {
  transform: translateY(-5px);
}

/* 字體引入 */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@400;500;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Source+Han+Sans+TC:wght@400;500;700&display=swap');

/* 基礎字體設置 */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Noto Sans TC', sans-serif;
}

/* 首頁返回按鈕（固定在移動裝置螢幕底部） */
.home-button {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background-color: #0071e3;
  color: white;
  padding: 12px 20px;
  border-radius: 30px;
  box-shadow: 0 4px 12px rgba(0, 113, 227, 0.3);
  z-index: 100;
  display: flex;
  align-items: center;
  font-weight: 500;
  transition: all 0.2s ease;
}

.home-button:hover {
  background-color: #0066cc;
  box-shadow: 0 6px 16px rgba(0, 113, 227, 0.4);
  transform: translateY(-2px);
}

.home-button svg {
  margin-right: 8px;
}

@media (min-width: 768px) {
  .home-button {
    display: none;
  }
}

/* 急症室等候時間頁面樣式 */
.hospital-list-container {
  max-width: 1200px;
  margin: 0 auto;
}

.hospital-card {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  transition: all 0.2s ease;
}

.hospital-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.hospital-name {
  font-size: 1.2rem;
  font-weight: bold;
  display: flex;
  align-items: center;
  margin-bottom: 0.75rem;
}

.status-indicator {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 8px;
}

.waiting-time {
  font-size: 1.5rem;
  font-weight: bold;
  margin: 10px 0;
} 