/* ============================================================
   course_rwd.css
   課程詳細頁 RWD 自適應修正版
   適用：news_oc_info.asp
   ============================================================ */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  background: #f7fbff;
}

img,
iframe,
video {
  max-width: 100%;
}

img {
  height: auto;
}

/* ============================================================
   Header RWD
   ============================================================ */

.course-mobile-header,
.site-header.course-mobile-header {
  position: sticky;
  top: 0;
  z-index: 9999;
  width: 100%;
  min-height: 76px;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: rgba(246, 243, 236, 0.96);
  border-bottom: 1px solid rgba(0,0,0,.08);
  box-shadow: 0 8px 24px rgba(0,0,0,.05);
}

.course-mobile-header .brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: #1d1d1f;
  text-decoration: none;
}

.course-mobile-header .brand-mark {
  width: 50px;
  height: 50px;
  flex: 0 0 50px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.course-mobile-header .brand-mark img {
  width: 100%;
  height: auto;
  display: block;
}

.course-mobile-header .brand-name {
  font-size: 20px;
  font-weight: 900;
  line-height: 1.2;
  color: #1d1d1f;
  white-space: nowrap;
}

.course-mobile-header .main-nav {
  display: flex;
  align-items: center;
  gap: 18px;
}

.course-mobile-header .main-nav a {
  color: #1d1d1f;
  text-decoration: none;
  font-size: 15px;
  font-weight: 800;
}

.course-mobile-header .menu-button {
  display: none;
}

/* ============================================================
   主內容容器
   ============================================================ */

.page-main {
  padding-top: 0 !important;
}

.course-rwd-page {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 72px;
}

.course-detail-form {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto !important;
}

/* 移除 Elementor 固定與舊樣式影響 */
.course-detail-form .elementor-section {
  width: 100%;
}

.course-detail-form .elementor-container {
  max-width: 100% !important;
  width: 100% !important;
  display: flex;
  flex-wrap: wrap;
}

.course-detail-form .elementor-column {
  min-width: 0;
}

.course-detail-form .elementor-col-100 {
  width: 100% !important;
}

.course-detail-form .elementor-col-33 {
  width: 33.3333% !important;
}

/* 清掉負 margin */
.course-detail-form .elementor-container[style*="margin-top:-50px"] {
  margin-top: 0 !important;
}

.course-detail-form .elementor-widget-wrap,
.course-detail-form .elementor-widget-container {
  width: 100%;
  max-width: 100%;
}

/* ============================================================
   頂部按鈕區：分類 / EDM / 合作單位 / 報名
   ============================================================ */

.course-detail-form h2.elementor-heading-title {
  display: flex !important;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  line-height: 1.5;
  margin: 0 0 22px !important;
}

.course-detail-form h2.elementor-heading-title > span,
.course-detail-form h2.elementor-heading-title > a,
.course-detail-form h2.elementor-heading-title > font {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 18px !important;
  border-radius: 999px;
  color: #fff !important;
  background: linear-gradient(135deg, #3e8ef1, #3ca7ff) !important;
  font-size: 15px !important;
  font-weight: 900 !important;
  line-height: 1.25 !important;
  text-decoration: none !important;
  white-space: nowrap;
}

.course-detail-form h2.elementor-heading-title > span {
  background: linear-gradient(135deg, #1f6feb, #2fa7ff) !important;
}

.course-detail-form h2.elementor-heading-title > a:nth-of-type(2),
.course-detail-form h2.elementor-heading-title font {
  background: linear-gradient(135deg, #1557c0, #1f6feb) !important;
}

/* 所有 submit 按鈕 */
.course-detail-form input[type="submit"].Button,
.course-detail-form input[type="submit"],
.course-detail-form .Button {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 14px 34px !important;
  border: none !important;
  border-radius: 999px !important;
  background: linear-gradient(135deg, #2367e9, #2ea8ff) !important;
  color: #fff !important;
  font-size: 18px !important;
  font-weight: 900 !important;
  line-height: 1.2 !important;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 14px 30px rgba(35,103,233,.25);
}

.course-detail-form input[type="submit"]:hover {
  filter: brightness(1.04);
}

/* ============================================================
   內容文字與區塊
   ============================================================ */

.course-detail-form div,
.course-detail-form p,
.course-detail-form span,
.course-detail-form font,
.course-detail-form td,
.course-detail-form a {
  max-width: 100%;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.course-detail-form [style*="font-size:22px"] {
  font-size: 24px !important;
  line-height: 1.55 !important;
}

.course-detail-form [style*="font-size:20px"] {
  font-size: 18px !important;
  line-height: 1.85 !important;
}

.course-detail-form [style*="font-size:18px"] {
  font-size: 17px !important;
  line-height: 1.75 !important;
}

.course-detail-form [style*="font-size:16px"] {
  font-size: 16px !important;
  line-height: 1.7 !important;
}

/* 課程標題與主要內容視覺 */
.course-detail-form .elementor-inner-section > div {
  width: 100%;
  max-width: 100%;
  background: #ffffff;
  border: 1px solid #e7edf6;
  border-radius: 24px;
  padding: 28px;
  box-shadow: 0 12px 32px rgba(23,32,51,.08);
}

/* 地址 */
.course-detail-form [style*="text-decoration:underline"] {
  text-decoration: none !important;
  color: #1f6feb !important;
}

/* ============================================================
   表格 RWD
   ============================================================ */

.course-detail-form table {
  width: 100% !important;
  max-width: 100%;
  border-collapse: collapse;
}

.course-detail-form table td {
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* ============================================================
   iframe / 圖片
   ============================================================ */

.course-detail-form img {
  max-width: 100% !important;
  height: auto !important;
}

.course-detail-form iframe {
  max-width: 100% !important;
  border: 0;
}

.course-detail-form iframe[src*="youtube"],
.course-detail-form iframe[src*="youtu"] {
  width: 100% !important;
  aspect-ratio: 16 / 9;
  height: auto !important;
  min-height: 260px;
  display: block;
}

.course-detail-form iframe[name="iframe001"],
.course-detail-form iframe[src*="DateRec.asp"] {
  width: 100% !important;
  height: 36px !important;
  min-height: 36px !important;
}

.course-detail-form iframe[src*="google"],
.course-detail-form iframe[src*="maps"] {
  width: 100% !important;
  min-height: 320px;
}

/* ============================================================
   相關課程
   ============================================================ */

.elementor-container .elementor-col-33 img {
  max-width: 100%;
  height: auto;
  object-fit: cover;
}

.elementor-col-33 .elementor-widget-wrap {
  padding: 12px;
}

.related-course-img {
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  object-fit: cover;
  border-radius: 16px;
}

/* ============================================================
   平板
   ============================================================ */

@media (max-width: 1024px) {
  .course-mobile-header {
    padding: 12px 18px;
  }

  .course-mobile-header .main-nav {
    display: none;
  }

  .course-mobile-header .menu-button {
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
    border: 1px solid #777;
    border-radius: 8px;
    background: #fff;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    margin: 0 !important;
    padding: 0 !important;
    cursor: pointer;
  }

  .course-mobile-header .menu-button span {
    display: block;
    width: 22px;
    height: 2px;
    background: #333;
    border-radius: 999px;
    margin: 0;
  }

  .course-mobile-header .main-nav.is-open {
    display: flex !important;
    flex-direction: column;
    position: absolute;
    left: 12px;
    right: 12px;
    top: calc(100% + 8px);
    background: #fff;
    border: 1px solid #e7edf6;
    border-radius: 16px;
    box-shadow: 0 18px 42px rgba(0,0,0,.14);
    padding: 8px 0;
    z-index: 10000;
  }

  .course-mobile-header .main-nav.is-open a {
    display: block;
    padding: 13px 18px;
    color: #1d1d1f;
    border-bottom: 1px solid #edf2f7;
  }

  .course-mobile-header .main-nav.is-open a:last-child {
    border-bottom: none;
  }

  .course-rwd-page {
    width: min(100% - 24px, 820px);
    padding: 26px 0 60px;
  }

  .course-detail-form .elementor-container {
    display: block !important;
  }

  .course-detail-form .elementor-column,
  .course-detail-form .elementor-col-100,
  .course-detail-form .elementor-col-33 {
    width: 100% !important;
    max-width: 100% !important;
  }

  .course-detail-form .elementor-inner-section > div {
    padding: 22px;
  }
}

/* ============================================================
   手機
   ============================================================ */

@media (max-width: 768px) {
  .course-mobile-header,
  .site-header.course-mobile-header {
    min-height: 72px !important;
    padding: 10px 14px !important;
    gap: 10px;
  }

  .course-mobile-header .brand {
    flex: 1;
    min-width: 0;
    gap: 10px;
  }

  .course-mobile-header .brand-mark {
    width: 42px;
    height: 42px;
    flex-basis: 42px;
  }

  .course-mobile-header .brand-name {
    font-size: 17px !important;
    line-height: 1.25;
    white-space: normal;
  }

  .course-mobile-header .menu-button {
    width: 46px;
    height: 46px;
    min-width: 46px;
    min-height: 46px;
  }

  .page-main {
    padding-top: 0 !important;
  }

  .course-rwd-page {
    width: calc(100% - 20px) !important;
    padding: 14px 0 44px !important;
  }

  .course-detail-form {
    margin: 0 auto !important;
    width: 100% !important;
  }

  .course-detail-form h2.elementor-heading-title {
    display: flex !important;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin: 0 0 18px !important;
  }

  .course-detail-form h2.elementor-heading-title > span,
  .course-detail-form h2.elementor-heading-title > a,
  .course-detail-form h2.elementor-heading-title > input,
  .course-detail-form h2.elementor-heading-title > font {
    display: flex !important;
    width: 100% !important;
    max-width: 100%;
    min-height: 50px;
    justify-content: center;
    text-align: center !important;
    margin: 0 !important;
    border-radius: 16px !important;
    box-sizing: border-box;
    white-space: normal;
  }

  .course-detail-form h2.elementor-heading-title > a {
    font-size: 16px !important;
    padding: 14px 16px !important;
  }

  .course-detail-form input[type="submit"].Button,
  .course-detail-form input[type="submit"],
  .course-detail-form .Button {
    width: 100% !important;
    min-height: 56px !important;
    margin: 0 !important;
    padding: 15px 18px !important;
    font-size: 18px !important;
  }

  .course-detail-form .elementor-inner-section > div {
    padding: 18px;
    border-radius: 20px;
  }

  .course-detail-form [style*="font-size:22px"] {
    font-size: 20px !important;
    line-height: 1.55 !important;
  }

  .course-detail-form [style*="font-size:20px"] {
    font-size: 17px !important;
    line-height: 1.8 !important;
  }

  .course-detail-form [style*="font-size:18px"] {
    font-size: 16px !important;
    line-height: 1.72 !important;
  }

  .course-detail-form [style*="font-size:16px"] {
    font-size: 15px !important;
    line-height: 1.72 !important;
  }

  .course-detail-form table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  .course-detail-form table tbody,
  .course-detail-form table tr {
    min-width: 760px;
  }

  .course-detail-form iframe[src*="youtube"],
  .course-detail-form iframe[src*="youtu"] {
    min-height: 210px;
  }

  .course-detail-form iframe[name="iframe001"],
  .course-detail-form iframe[src*="DateRec.asp"] {
    height: 36px !important;
    min-height: 36px !important;
  }

  .elementor-col-33 {
    width: 100% !important;
    margin-bottom: 20px;
  }

  .elementor-col-33 .elementor-widget-wrap {
    padding: 12px;
    border: 1px solid #eee;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 10px 22px rgba(0,0,0,.06);
  }

  .elementor-col-33 img {
    width: 100% !important;
    height: auto !important;
    border-radius: 14px;
    display: block;
  }
}

/* ============================================================
   小手機
   ============================================================ */

@media (max-width: 480px) {
  .course-mobile-header .brand-name {
    font-size: 16px !important;
  }

  .course-mobile-header .brand-mark {
    width: 40px;
    height: 40px;
    flex-basis: 40px;
  }

  .course-mobile-header .menu-button {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
  }

  .course-detail-form h2.elementor-heading-title > span,
  .course-detail-form h2.elementor-heading-title > a,
  .course-detail-form h2.elementor-heading-title > font {
    font-size: 15px !important;
    min-height: 48px;
  }

  .course-detail-form input[type="submit"].Button,
  .course-detail-form input[type="submit"],
  .course-detail-form .Button {
    min-height: 56px !important;
    font-size: 17px !important;
  }

  .course-detail-form iframe[src*="youtube"],
  .course-detail-form iframe[src*="youtu"] {
    min-height: 190px;
  }
}