/* page-contact.css */

/* === 頁面容器 === */
.contact {
  width: 100%;
  position: relative;
  overflow: hidden;
  background-color: #fff;
  padding-bottom: 201px;
}

.contact__topbar {
  width: 100%;
  height: 43px;
  background-color: #0b2f53;
}

.contact__bg {
  position: absolute;
  top: 43px;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: none;
  height: auto;
  pointer-events: none;
  z-index: 0;
}

/* === 主標題區（CONTACT US / 聯絡我們） === */
.contact__heading {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1224px;
  margin: 68px auto 0;
  box-sizing: border-box;
}

.contact__heading-img {
  max-width: 356px;
}

/* === 聯絡資訊區 === */
.contact__info {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1197px;
  margin: 75px auto 0;
  box-sizing: border-box;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 29px 56px;
  color: #000;
  text-align: center;
}

.contact__info-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  min-width: 162px;
}

.contact__info-item--link {
  color: inherit;
  text-decoration: none;
  transition: opacity 0.15s ease;
}

.contact__info-item--link:hover {
  opacity: 0.7;
}

.contact__info-icon {
  width: 63px;
  height: auto;
  max-height: 63px;
  object-fit: contain;
}

.contact__info-text {
  margin: 0;
}

.contact__info-text--strong {
  font-weight: 500;
}

/* === 表單面板 === */
.contact__panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1197px;
  margin: 55px auto 0;
  padding: 43px clamp(22px, 3.6vw, 54px);
  box-sizing: border-box;
  background-color: #d9d9d9;
  color: #0b2f53;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 43px;
}

.contact__form {
  width: 100%;
  max-width: 927px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 43px;
}

.contact__form-grid {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 25px;
}

.contact__row {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 25px 53px;
}

.contact__row--double .contact__field {
  flex: 1 1 252px;
}

/* 統一表單欄位 */
.contact__field {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.contact__field--full {
  width: 100%;
}

.contact__label {
  font-weight: 500;
}

.contact__required {
  color: #e31717;
  margin-left: 4px;
}

.contact__input {
  width: 100%;
  min-height: 47px;
  padding: 7px 14px;
  background-color: #fff;
  border: none;
  box-sizing: border-box;
  color: #000;
  font: inherit;
}

.contact__input--select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 52px;
  background-image:
    linear-gradient(45deg, transparent 50%, #0b2f53 50%),
    linear-gradient(135deg, #0b2f53 50%, transparent 50%);
  background-position:
    right 22px center,
    right 16px center;
  background-size:
    6px 6px,
    6px 6px;
  background-repeat: no-repeat;
  color: #0b2f53;
  font-weight: 500;
  cursor: pointer;
}

.contact__input--select:focus {
  background-image:
    linear-gradient(135deg, transparent 50%, #1969b9 50%),
    linear-gradient(45deg, #1969b9 50%, transparent 50%);
  background-position:
    right 22px center,
    right 16px center;
}

.contact__input--select option {
  padding: 12px 16px;
  color: #0b2f53;
  background-color: #fff;
}

.contact__input--select option:disabled {
  color: #999;
}

.contact__input--select option:checked {
  background-color: #e6f0fa;
  font-weight: 500;
}

.contact__input--textarea {
  min-height: 139px;
  resize: vertical;
}

.contact__input:focus {
  outline: 2px solid #1969b9;
  outline-offset: 1px;
}

/* === 按鈕群 === */
.contact__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 47px;
}

.contact__button {
  min-height: 40px;
  width: 180px;
  padding: 9px 22px;
  border: none;
  box-sizing: border-box;
  color: #fff;
  font-size: var(--font-size-xl);
  font-weight: 500;
  cursor: pointer;
}

.contact__button--primary {
  background-color: #0b2f53;
}

.contact__button--reset {
  background-color: #686868;
}

.contact__button:hover {
  opacity: 0.9;
}

/* === 錯誤提示 === */
.contact__error {
  display: none;
  min-height: 1.2em;
  margin-top: 4px;
  color: #e31717;
  font-size: 14px;
  line-height: 1.4;
}

.contact__notice {
  width: 100%;
  padding: 12px 20px;
  border-radius: 6px;
  margin-bottom: 16px;
  font-weight: 500;
  text-align: center;
}
.contact__notice--success {
  background: #e6f7ec;
  color: #0b6b2a;
  border: 1px solid #0b6b2a;
}
.contact__notice--error {
  background: #ffe9e9;
  color: #b00020;
  border: 1px solid #b00020;
}

.contact__input.is-error {
  border: 2px solid #e31717;
  outline: none;
}

/* ==================== 桌面基礎樣式 ==================== */

/* ==================== 大螢幕 (max-width: 1440px) ==================== */
@media (max-width: 1440px) {
  .contact {
    padding-bottom: 150px;
  }

  .contact__heading,
  .contact__info,
  .contact__panel {
    padding-left: 2rem;
    padding-right: 2rem;
  }
}

/* ==================== 平板 (max-width: 1024px) ==================== */
@media (max-width: 1024px) {
  .contact {
    padding-bottom: 120px;
  }

  .contact__heading {
    margin-top: 48px;
  }

  .contact__info {
    margin-top: 48px;
    gap: 32px 40px;
    flex-wrap: wrap;
  }

  .contact__info-item {
    flex: 0 1 calc(50% - 20px);
    min-width: 140px;
  }

  .contact__panel {
    margin-top: 40px;
    padding: 32px 24px;
    gap: 32px;
  }
}

/* ==================== 768px 以下 ==================== */
@media (max-width: 768px) {
  .contact {
    padding-bottom: 80px;
    background-image: url(../../images/contact-bg-mobile.webp);
  }

  .contact__bg {
    display: none;
  }
  .contact__topbar {
    height: 32px;
  }

  .contact__heading {
    margin-top: 36px;
  }

  .contact__heading-img {
    max-width: 240px;
    justify-self: center;
  }

  .contact__info {
    margin-top: 36px;
    gap: 24px;
    grid-template-columns: 1fr 1fr;
    display: grid;
  }

  .contact__info-item {
    min-width: 0;
    width: 100%;
    gap: 10px;
  }

  .contact__info-icon {
    width: 48px;
    max-height: 48px;
  }

  .contact__panel {
    margin-top: 32px;
    padding: 24px 16px;
    gap: 24px;
  }

  .contact__form {
    gap: 20px;
  }

  .contact__row {
    flex-direction: column;
    gap: 20px;
  }

  .contact__row--double .contact__field {
    flex: 1 1 100%;
  }

  .contact__actions {
    gap: 16px;
    flex-direction: column;
    width: 100%;
  }

  .contact__button {
    width: 100%;
    min-height: 48px;
    font-size: 1rem;
  }
}

/* ==================== 手機 (max-width: 480px) ==================== */
@media (max-width: 480px) {
  .contact {
    padding-bottom: 60px;
  }

  .contact__topbar {
    height: 8px;
  }

  .contact__heading {
    margin-top: 28px;
    padding-left: 16px;
    padding-right: 16px;
  }

  .contact__heading-img {
    max-width: 206px;
  }

  /* 聯絡資訊：2 欄並排（手機版排序：電話 / LINE → 時間 / 地址） */
  .contact__info {
    margin-top: 28px;
    gap: 12px 16px;
    grid-template-columns: 1fr 1fr;
    display: grid;
    max-width: 286px;
    padding-left: 0;
    padding-right: 0;
  }

  .contact__info-item {
    min-width: 0;
    width: 135px;
    gap: 8px;
    margin: 0 auto;
  }

  /* 手機版排序：電話 → LINE → 時間 → 地址 */
  .contact__info-item--link[href^="tel"] {
    order: 1;
  }
  .contact__info-item--link[href*="line.me"] {
    order: 2;
  }
  .contact__info-item:not(.contact__info-item--link) {
    order: 3;
  }
  .contact__info-item--link[href*="google.com/maps"] {
    order: 4;
  }

  .contact__info-icon {
    width: 24px;
    max-height: 24px;
  }

  .contact__info-text {
    font-size: 12px;
    line-height: normal;
  }

  /* 表單面板 */
  .contact__panel {
    margin-top: 30px;
    padding: 36px 15px;
    gap: 24px;
    max-width: 310px;
  }

  .contact__form {
    max-width: 280px;
    gap: 20px;
  }

  .contact__form-grid {
    gap: 24px;
  }

  .contact__row {
    flex-direction: column;
    gap: 24px;
  }

  .contact__row--double .contact__field {
    flex: 1 1 100%;
  }

  .contact__field {
    gap: 12px;
    width: 100%;
  }

  .contact__label {
    font-size: 13px;
    font-weight: 600;
    line-height: 22px;
  }

  .contact__input {
    width: 280px;
    min-height: 36px;
    padding: 6px 12px;
    font-size: 13px;
  }

  .contact__input--select {
    color: #0b2f53;
    font-weight: 500;
  }

  .contact__input--textarea {
    min-height: 154px;
  }

  /* 送出/重填按鈕 */
  .contact__submit-area,
  .contact__submit-area--with-verify {
    width: 100%;
    gap: 12px;
  }

  .contact__actions {
    flex-direction: column;
    width: 100%;
    gap: 12px;
  }

  .contact__submit-area--with-verify .contact__actions {
    flex-direction: column;
    gap: 12px;
  }

  .contact__submit-area--with-verify .contact__actions .contact__button {
    width: 280px;
    min-width: 0;
  }

  .contact__button {
    width: 280px;
    min-height: 44px;
    padding: 10px 80px;
    font-size: 13px;
    font-weight: 600;
    line-height: 22px;
  }
}

/* ====================================================
 * 送出區塊（Turnstile + actions）
 *
 * 桌面：未啟用驗證 → actions 居中
 *       啟用驗證    → 左 turnstile / 右 actions（兩端對齊）
 * 手機：垂直堆疊（turnstile 在上、actions 在下）
 * ==================================================== */
.contact__submit-area {
  min-height: 70px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.contact__submit-area--with-verify {
  width: 100%;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 24px 32px;
}

.contact__turnstile {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 65px;
  flex-shrink: 0;
}

.contact__turnstile .cf-turnstile {
  min-height: 65px;
}

/* 啟用驗證時 actions 不再居中、靠右排列 */
.contact__submit-area--with-verify .contact__actions {
  justify-content: flex-end;
  gap: 16px;
}

/* ==================== 送出區塊 RWD ==================== */
@media (max-width: 992px) {
  .contact__submit-area--with-verify {
    flex-direction: column;
    align-items: stretch;
    gap: 20px;
  }

  .contact__submit-area--with-verify .contact__turnstile {
  }

  .contact__submit-area--with-verify .contact__actions {
    justify-content: center;
    gap: 24px;
  }
}

@media (max-width: 480px) {
  .contact__submit-area {
    gap: 18px;
  }

  .contact__submit-area--with-verify .contact__actions {
    gap: 12px;
  }

  .contact__submit-area--with-verify .contact__actions .contact__button {
    min-width: 0;
  }

  /* Turnstile 手機版：等比縮放 normal widget 至 280px 寬，高度自然跟隨 */
  .contact__turnstile {
    width: 280px;
    max-width: 100%;
    min-height: 0;
    align-self: center;
    overflow: hidden;
  }

  .contact__turnstile .cf-turnstile {
    width: 300px;
    min-height: 0;
    transform: scale(0.9333);
    transform-origin: top left;
    margin-bottom: calc(65px * (1 - 0.9333) * -1);
  }
}

/* Cloudflare Turnstile 區塊 */
.contact__turnstile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.contact__turnstile .cf-turnstile {
  min-height: 65px;
}
