/* 門診時段表樣式 - 完全按照設計稿製作 */
.clinic-schedule-table {
  display: flex;
  width: 100%;
  margin: 0 auto;
  border: none; /* 移除外層邊框 */
  border-radius: 0; /* 移除圓角 */
  overflow: visible; /* 改為visible */
  box-shadow: none; /* 移除陰影 */
  background: #fff;
}

.schedule-day {
  flex: 1;
  width: calc(100% / 7); /* 確保每天寬度一致，7天平均分配 */
  display: flex;
  flex-direction: column;
  padding: 0 20px 0 20px;
  border-left: 1px solid #8989897e; /* 左邊框 */
  border-right: 1px solid #8989897e; /* 右邊框 */
  min-height: 160px;
  background: #fff;
}

.schedule-day:last-child {
  /* 最後一天保持右邊框，因為我們要每天的左右邊框 */
}

.day-header {
  background: #fff;
  padding: 12px 20px; /* 恢復原來的padding */
  text-align: center;
  border-bottom: none; /* 移除底部邊框 */
  min-height: 40px; /* 恢復原來的高度 */
  display: flex;
  flex-direction: column;
  justify-content: center;
  font-family: "Noto Serif TC", serif; /* 使用 Noto Serif TC 字體 */
  font-size: 20px; /* 統一字級 */
  color: #333; /* 統一顏色 */
}

.day-en {
  /* font-size: 14px; */
  font-weight: 600;
  color: #333;
  line-height: 1.2;
}

.day-schedule {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between; /* 修改：讓內容分散對齊 */
  align-items: center; /* 水平置中 */
  padding: 24px 16px; /* 加大padding */
  min-height: 80px;
  position: relative;
  background: #fff;
  width: 100%; /* 確保內容區域佔滿寬度 */
  min-width: 100%; /* 強制最小寬度 */
}

/* 時段容器 - 水平排列，兩個時段並排顯示 */
.time-slots-container {
  display: flex;
  flex-direction: row; /* 改為水平排列 */
  justify-content: center;
  align-items: center;
  width: 100%;
  gap: 16px; /* 水平間距 */
}

/* 單個時段 - 垂直排列，單個時段時不佔滿寬度 */
.time-slot {
  display: flex;
  flex-direction: column; /* 垂直排列：開始時間在上，結束時間在下 */
  align-items: center;
  justify-content: center;
  text-align: center;
  min-width: 60px;
  padding: 4px 0; /* 添加上下內邊距 */
}

/* 單個時段時的特殊樣式 - 不佔滿寬度，自然置中 */
.time-slot:only-child {
  flex: none; /* 不佔滿寬度 */
  width: auto; /* 自然寬度 */
}

.time-start {
  font-size: 14px;
  font-weight: 500;
  color: #333;
  margin-bottom: 4px;
  line-height: 1.2;
}

.time-separator {
  font-size: 12px;
  font-weight: 500;
  color: #333;
  margin: 2px 0;
  line-height: 1.2;
}

.time-end {
  font-size: 14px;
  font-weight: 500;
  color: #333;
  margin-top: 4px;
  line-height: 1.2;
}

.closed-status {
  font-size: 14px;
  font-weight: 500;
  color: #333; /* 修改：顏色改為#333 */
  text-align: center;
  line-height: 1.2;
  width: 100%;
  margin: 0 auto; /* 修改：水平置中 */
  font-family: "Noto Sans TC", "Noto Sans CJK TC", "Noto Sans", "Arial", "sans-serif"; /* 修改：使用Noto Sans TC字體 */
}

/* 底部區域 - 中文標籤 */
.day-footer {
  background: #fff;
  padding: 8px 0;
  text-align: center;
  border-top: none; /* 移除頂部邊框 */
  margin-top: auto;
  min-height: 30px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  font-family: "Noto Serif TC", serif; /* 使用 Noto Serif TC 字體 */
  font-size: 20px; /* 統一字級 */
  color: #333; /* 統一顏色 */
}

.day-zh {
  font-family: "Noto Serif TC", serif; /* 修改：使用Noto Serif TC字體 */
  font-size: 20px; /* 修改：中文字級為20px */
  font-weight: bold; /* 修改：改為粗體 */
  color: #333;
  margin-top: 30px; /* 修改：與時段距離30px */
  line-height: 1.2;
  text-align: center;
  background: #fff;
  width: 100%;
}

/* 響應式設計 */
@media (max-width: 768px) {
  .clinic-schedule-table {
    flex-direction: column;
    width: 100%;
  }

  .schedule-day {
    border-right: none;
    border-bottom: 1px solid #e0e0e0;
    min-height: auto;
    background: #fff;
    width: 100%; /* 手機版時每天佔滿寬度 */
  }

  .schedule-day:last-child {
    border-bottom: none;
  }

  .day-header {
    padding: 8px;
    min-height: 35px;
    background: #fff;
  }

  .day-schedule {
    padding: 20px 12px; /* 手機版也加大padding */
    min-height: 60px;
    background: #fff;
  }

  .time-slots-container {
    flex-direction: column; /* 手機版時兩個時段垂直排列 */
    gap: 4px;
  }

  .day-zh {
    padding: 6px 0;
    background: #fff;
    width: 100%;
  }
}

/* 強制滿版顯示 - 覆蓋可能的容器限制 */
.clinic-schedule-table,
.clinic-schedule-table * {
  box-sizing: border-box !important;
}

/* 增強內容寬度視覺效果 */
.time-start,
.time-end {
  min-width: 60px; /* 確保時間有最小寬度 */
  text-align: center;
  padding: 2px 8px; /* 增加左右內邊距 */
}

.closed-status {
  min-width: 60px; /* 確保Closed狀態有最小寬度 */
  padding: 2px 8px;
}

.day-zh {
  min-width: 100%; /* 確保中文標籤撐滿寬度 */
}

/* 確保在Elementor中也能滿版顯示 */
.elementor-widget-shortcode .clinic-schedule-table,
.elementor-section .clinic-schedule-table {
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* 覆蓋可能的父容器限制 */
.clinic-schedule-table {
  position: relative !important;
  left: 0 !important;
  right: 0 !important;
}

/* 優化RWD - 使用 flex-wrap 的響應式設計 */

/* 大螢幕 (1200px以上) */
@media (min-width: 1200px) {
  .clinic-schedule-table {
    max-width: 1400px !important;
    margin: 0 auto !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
  }
  
  .schedule-day {
    width: calc(100% / 7) !important;
    padding: 0 25px !important;
  }
  
  .day-header {
    padding: 15px 25px !important;
    font-size: 22px !important;
  }
  
  .day-schedule {
    padding: 30px 20px !important;
    min-height: 100px !important;
  }
  
  .time-start,
  .time-end {
    font-size: 16px !important;
  }
  
  .time-separator {
    font-size: 14px !important;
  }
}

/* 中等螢幕 (992px-1199px) */
@media (max-width: 1199px) and (min-width: 992px) {
  .clinic-schedule-table {
    max-width: 100% !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
  }
  
  .schedule-day {
    width: calc(100% / 7) !important;
    padding: 0 18px !important;
  }
  
  .day-header {
    padding: 12px 18px !important;
    font-size: 20px !important;
  }
  
  .day-schedule {
    padding: 25px 15px !important;
    min-height: 90px !important;
  }
}

/* 小於pad尺寸設計稿樣式 (768px以下) - 2行3列網格 */
@media (max-width: 768px) {
  .clinic-schedule-table {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important; /* 3列 */
    grid-template-rows: repeat(2, 1fr) !important; /* 2行 */
    gap: 20px !important;
    padding: 24px !important;
    max-width: 100% !important;
    margin: 0 auto !important;
  }
  
  .schedule-day {
    width: 100% !important;
    height: 160px !important;
    min-height: 140px !important;
    padding: 6px 8px !important;
    border: none !important;
    border-radius: 50px !important; /* 膠囊形狀 */
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    align-items: center !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
  }
  
  /* 統一背景色 */
  .schedule-day {
    background: #C39E98CC !important; /* 統一使用指定顏色 */
  }
  
  .day-header {
    padding: 8px 20px !important;
    min-height: 35px !important;
    background: transparent !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    line-height: 1.4 !important;
    margin-bottom: 8px !important;
  }
  
  .day-en {
    color: #fff !important; /* 白色文字 */
    font-size: 14px !important;
    font-weight: 600 !important;
    line-height: 1.4 !important;
  }
  
  .day-schedule {
    padding: 8px 20px !important;
    min-height: 50px !important;
    background: transparent !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    margin-bottom: 8px !important;
  }
  
  .time-slots-container {
    flex-direction: row !important;
    gap: 8px !important;
  }
  
  .time-start,
  .time-end {
    font-size: 13px !important;
    color: #fff !important;
    font-weight: 500 !important;
    line-height: 1.4 !important;
  }
  
  .time-separator {
    font-size: 11px !important;
    color: #fff !important;
    line-height: 1.4 !important;
  }
  
  .closed-status {
    font-size: 13px !important;
    color: #fff !important;
    font-weight: 500 !important;
    line-height: 1.4 !important;
  }
  
  .day-zh {
    padding: 8px 20px !important;
    background: transparent !important;
    font-size: 14px !important;
    font-weight: bold !important;
    color: #fff !important;
    text-align: center !important;
    margin-top: 0 !important;
    line-height: 1.4 !important;
  }
}

/* 小尺寸手機 (480px以下) - 2列布局防止超出寬度 */
@media (max-width: 480px) {
  .clinic-schedule-table {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important; /* 2列布局 */
    grid-template-rows: repeat(4, 1fr) !important; /* 4行布局 */
    gap: 12px !important;
    padding: 16px !important;
    max-width: 100% !important;
    margin: 0 auto !important;
  }
  
  .schedule-day {
    width: 100% !important;
    height: 160px !important;
    min-height: 140px !important;
    padding: 6px 8px !important;
    border: none !important;
    border-radius: 50px !important; /* 膠囊形狀 */
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    align-items: center !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
  }
  
  .schedule-day {
    background: #C39E98CC !important;
  }
  
  .day-header {
    padding: 6px 16px !important;
    min-height: 30px !important;
    background: transparent !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    line-height: 1.3 !important;
    margin-bottom: 6px !important;
  }
  
  .day-en {
    color: #fff !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    line-height: 1.3 !important;
  }
  
  .day-schedule {
    padding: 6px 16px !important;
    min-height: 40px !important;
    background: transparent !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    margin-bottom: 6px !important;
  }
  
  .time-slots-container {
    flex-direction: row !important;
    gap: 6px !important;
  }
  
  .time-start,
  .time-end {
    font-size: 11px !important;
    color: #fff !important;
    font-weight: 500 !important;
    line-height: 1.3 !important;
  }
  
  .time-separator {
    font-size: 9px !important;
    color: #fff !important;
    line-height: 1.3 !important;
  }
  
  .closed-status {
    font-size: 11px !important;
    color: #fff !important;
    font-weight: 500 !important;
    line-height: 1.3 !important;
  }
  
  .day-zh {
    padding: 6px 16px !important;
    background: transparent !important;
    font-size: 12px !important;
    font-weight: bold !important;
    color: #fff !important;
    text-align: center !important;
    margin-top: 0 !important;
    line-height: 1.3 !important;
  }
}

/* 平板橫向 (768px-991px) - 保留原有樣式作為備用 */
@media (max-width: 991px) and (min-width: 769px) {
  .clinic-schedule-table {
    flex-direction: row !important;
    flex-wrap: wrap !important;
  }
  
  .schedule-day {
    width: calc(100% / 4) !important; /* 4天一排 */
    min-height: 140px !important;
    padding: 0 15px !important;
  }
  
  .schedule-day:nth-child(4n+1) {
    border-left: 1px solid #8989897e !important;
  }
  
  .schedule-day:nth-child(4n) {
    border-right: 1px solid #8989897e !important;
  }
  
  .schedule-day:nth-child(n+5) {
    border-top: 1px solid #e0e0e0 !important;
  }
  
  .day-header {
    padding: 10px 15px !important;
    font-size: 18px !important;
    min-height: 35px !important;
  }
  
  .day-schedule {
    padding: 20px 12px !important;
    min-height: 70px !important;
  }
  
  .time-start,
  .time-end {
    font-size: 13px !important;
  }
  
  .time-separator {
    font-size: 11px !important;
  }
}

/* 這些媒體查詢已被上面的統一設計取代 */

/* 這些媒體查詢已被上面的統一設計取代 */

/* 這些媒體查詢已被上面的統一設計取代 */

/* 橫向手機優化 */
@media (max-height: 500px) and (orientation: landscape) {
  .clinic-schedule-table {
    flex-direction: row !important;
    flex-wrap: wrap !important;
  }
  
  .schedule-day {
    width: calc(100% / 7) !important;
    min-height: 120px !important;
    border-bottom: none !important;
    border-right: 1px solid #8989897e !important;
  }
  
  .schedule-day:last-child {
    border-right: 1px solid #8989897e !important;
  }
  
  .day-header {
    padding: 8px 10px !important;
    min-height: 30px !important;
    font-size: 14px !important;
  }
  
  .day-schedule {
    padding: 15px 10px !important;
    min-height: 50px !important;
  }
  
  .time-start,
  .time-end {
    font-size: 12px !important;
  }
}
