/*
 * Haswell 響應式修補 — 行動裝置與平板適配
 * 載入順序：在 haswell-fixes.css 之後
 */

/* ===== 全域：v-html 富文本溢出保護 ===== */
.post-prev-text img,
.course-description-content img,
.page-content-area img,
.article-content img {
  max-width: 100% !important;
  height: auto !important;
}

.post-prev-text table,
.course-description-content table,
.page-content-area table,
.article-content table {
  max-width: 100%;
  overflow-x: auto;
  display: block;
}

.post-prev-text iframe,
.course-description-content iframe,
.page-content-area iframe,
.article-content iframe,
.post-prev-text video,
.course-description-content video,
.page-content-area video,
.article-content video {
  max-width: 100%;
  height: auto;
}

/* ===== 平板（≤ 991px） ===== */
@media (max-width: 991px) {
  /* Footer padding 縮減 */
  #footer6.pt-95 {
    padding-top: 50px !important;
  }
  #footer6.pb-50 {
    padding-bottom: 30px !important;
  }
}

/* ===== 手機（≤ 767px） ===== */
@media (max-width: 767px) {
  /* Footer padding 再縮減 */
  #footer6.pt-95 {
    padding-top: 35px !important;
  }
  #footer6.pb-50 {
    padding-bottom: 20px !important;
  }

  /* Footer 各欄間距 */
  #footer6 .widget {
    margin-bottom: 25px;
  }

  /* 卡片 padding 縮減 */
  .member-card,
  .page-form-panel,
  .checkout-summary-card {
    padding: 20px 15px !important;
  }

  /* Flex 容器強制換行 */
  .lesson-item {
    flex-wrap: wrap !important;
  }
  .lesson-item .lesson-actions {
    width: 100%;
    margin-top: 8px;
  }

  .attachment-item {
    flex-wrap: wrap !important;
  }
  .attachment-download {
    width: 100%;
    text-align: center;
    margin-top: 8px;
  }

  /* 課程卡片 */
  .course-card-main {
    flex-direction: column !important;
  }
  .course-card-actions {
    flex-wrap: wrap !important;
  }

  /* Bootstrap offset 重置 */
  .col-md-offset-1,
  .col-md-offset-2,
  .col-md-offset-3 {
    margin-left: 0 !important;
  }

  /* ===== 側邊面板手機版 → 底部固定列 ===== */

  /* 整個 wrapper 改為底部固定 */
  .floating-panel-wrapper {
    position: fixed !important;
    top: auto !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: auto !important;
    flex-direction: column-reverse !important;
    transform: none !important;
    pointer-events: auto !important;
    z-index: 9998 !important;
    overflow: visible !important;
  }

  /* sidebar 改為水平底部列 */
  .floating-sidebar {
    flex-direction: row !important;
    width: 100% !important;
    height: 56px !important;
    background: #fff !important;
    border-top: 1px solid #e0e0e0 !important;
    box-shadow: 0 -2px 16px rgba(0,0,0,0.1) !important;
    padding: 0 !important;
    gap: 0 !important;
    justify-content: stretch !important;
    align-self: stretch !important;
    align-items: stretch !important;
    position: relative !important;
    z-index: 2 !important;
  }

  /* tab 按鈕改水平底部列按鈕 */
  .floating-tab {
    border-radius: 0 !important;
    border: none !important;
    border-right: 1px solid #f0f0f0 !important;
    box-shadow: none !important;
    clip-path: none !important;
    width: auto !important;
    flex: 1 !important;
    padding: 6px 0 !important;
    background: #fff !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 2px !important;
  }

  .floating-tab:last-child {
    border-right: none !important;
  }

  .floating-tab:active {
    background: #f5f5f5 !important;
  }

  .floating-tab-active {
    border-left: none !important;
    margin-right: 0 !important;
  }

  .floating-tab-icon {
    width: 28px !important;
    height: 28px !important;
    margin-bottom: 0 !important;
    border-radius: 6px !important;
    background: transparent !important;
    border: none !important;
  }

  .floating-tab-label {
    font-size: 11px !important;
    font-weight: 700 !important;
    letter-spacing: 0.5px !important;
    color: #555 !important;
  }

  .floating-tab-active .floating-tab-label {
    color: #d97706 !important;
  }

  /* panel-body 從底部全螢幕彈出 — 覆蓋整頁 */
  .floating-panel-body {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100vh !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    transform: translateY(100%) !important;
    transition: transform 0.35s cubic-bezier(0.25, 0.8, 0.25, 1) !important;
    pointer-events: none !important;
    z-index: 9999 !important;
  }

  .floating-panel-wrapper.panel-open .floating-panel-body {
    transform: translateY(0) !important;
    pointer-events: auto !important;
  }

  /* 面板展開時隱藏底部列 */
  .floating-panel-wrapper.panel-open .floating-sidebar {
    z-index: 1 !important;
  }

  /* 頁面底部留空讓內容不被底部列擋住 */
  body {
    padding-bottom: 56px !important;
  }

  /* 考試 Widget padding 縮減 */
  .exam-card {
    padding: 20px 15px !important;
  }
}

/* ===== 極小螢幕（≤ 480px） ===== */
@media (max-width: 480px) {
  /* Hero 標題響應 */
  .hs-line-1 {
    font-size: 28px !important;
    letter-spacing: 0 !important;
  }
  .hs-line-2 {
    font-size: 14px !important;
    letter-spacing: 1px !important;
  }
}
