/*
 * 列表頁（車輛展示頁 ID 274）卡片與版面樣式
 *
 * 由 enqueue.php 於 is_page( 274 ) 條件載入。
 * 涵蓋：分享／複製圖示鈕、段落區塊、Query Loop 格線、車輛卡片（available／
 *       reserved／sold／delivering 各狀態）、規格列、車種篩選 tabs、整備中橫列、
 *       新車速報、各狀態手機間距修正。
 *
 * 依賴：全站 Z-index 變數 --z-card-base / --z-card-link / --z-badge /
 *       --z-card-hover / --z-action-btn，定義在「全域 WP 原生附加 CSS」的 :root
 *       （全站載入）。本檔不自帶這些變數；若刪除全域 :root，卡片層級會失效。
 *
 * ⚠ 脆弱規則：檔內 .gb-element-b81c2da2 綁定 GenerateBlocks 自動產生的 element ID
 *            （手機間距修正）。該 GB 區塊若被重建，ID 會改變、此規則靜默失效，
 *            需到後台對照該區塊後同步更新 selector。
 *
 * 不含：週年慶 .ann-* / .car-card__price-ann（限時活動，見 CLAUDE.md §3.2 / §6.3），
 *       續留 Simple CSS 單頁 metabox，活動結束整批刪。
 *
 * 對應原始：車輛展示頁 Simple CSS 單頁 metabox（原註記「車輛展示頁_display.css」）。
 * 相關文件：_list-page.md / _overview.md
 */

/* 清除分隔線 */
.no-divider {
  border: none !important;
}

/* 字型設定 */
.font-mono-data {
  font-family:
    "Inter",
    "Roboto Mono",
    "SFMono-Regular",
    Consolas,
    monospace;
  letter-spacing: 0.02em;
}

/* ================================================
   分享 / 複製連結按鈕（工具列圖示）
   ================================================ */
.copy-link-btn,
.share-btn {
  border: none !important;
  background: none !important;
  padding: 8px !important;
  cursor: pointer !important;
  transition: all 0.2s ease;
  opacity: 0.8;
  position: relative !important;
  z-index: var(--z-action-btn) !important;
  display: inline-flex;
  align-items: center;
  font-size: 20px;
  border-radius: 50%;
}

.copy-link-btn:hover,
.share-btn:hover {
  opacity: 1;
  transform: scale(1.1);
  color: #e8734a !important;
  background: rgba(0, 0, 0, 0.06) !important;
}

/* ================================================
   列表頁段落區塊
   ================================================ */
.page-id-274 .car-section {
  margin-bottom: 10px;
  border: none !important;
}

.section-title {
  font-size: 13px;
  font-weight: 500;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 0.5px solid #e5e3dc;
}

/* ================================================
   Query Loop 格線（手機優先）
   ================================================ */
.gb-query-loop {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 768px) {
  .gb-query-loop {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 1200px) {
  .gb-query-loop {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

@media (min-width: 1600px) {
  .gb-query-loop {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ================================================
   已成交 Query Loop：單欄
   ================================================ */
.car-section--sold .gb-query-loop {
  grid-template-columns: 1fr !important;
  gap: 8px;
}

/* ================================================
   車輛卡片（.car-card）外層
   ================================================ */
.car-card {
  position: relative;
  overflow: hidden;
  background: #fdf6f0;
  border-radius: 16px;
  border: 0.5px solid #ede3d8;
  transition: all 0.3s ease;
  z-index: var(--z-card-base);
}

.car-card .gb-button-wrapper,
.car-card .copy-link-btn,
.car-card .share-btn {
  position: relative;
  z-index: var(--z-action-btn);
}

/* 桌機：滑鼠滑過效果（已收訂不觸發） */
@media (min-width: 1025px) {
  .car-card:not(:has(.car-card__stamp)):hover {
    transform: translateY(-6px);
    box-shadow: 0 10px 28px rgba(180, 120, 80, 0.14);
    z-index: var(--z-card-hover);
  }
}

/* 手機：手指點擊回饋（已收訂不觸發） */
@media (max-width: 1024px) {
  .car-card {
    box-shadow: 0 2px 10px rgba(180, 120, 80, 0.08);
  }

  .car-card:not(:has(.car-card__stamp)):active {
    transform: scale(0.97);
    background-color: #f7ede4;
    transition: all 0.1s ease;
  }
}

/* ================================================
   整張卡片可點的隱形連結
   ================================================ */
.car-card__link {
  position: absolute;
  inset: 0;
  z-index: var(--z-card-link);
  border-radius: 16px;
}

/* ================================================
   車輛主圖區
   ================================================ */
.car-card__image-wrap {
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  position: relative;
}

.car-card__image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

/* 已收訂：圖片灰階處理 */
.car-card__image-wrap--reserved img {
  filter: grayscale(45%) brightness(0.86);
  transition: filter 0.3s ease;
}

/* ================================================
   已收訂：印章疊圖
   ================================================ */
.car-card__stamp {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: var(--z-badge);
}

.car-card__stamp-circle {
  width: 76px;
  height: 76px;
  border: 4px solid rgba(195, 28, 28, 0.90);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(195, 28, 28, 0.10);
}

/* 手機：印章稍小 */
@media (max-width: 400px) {
  .car-card__stamp-circle {
    width: 64px;
    height: 64px;
    border-width: 3.5px;
  }

  .car-card__stamp-text {
    font-size: 36px !important;
  }
}

.car-card__stamp-text {
  font-size: 44px;
  font-weight: 700;
  color: rgba(195, 28, 28, 0.90);
  line-height: 1;
  letter-spacing: -2px;
  font-family: serif;
  user-select: none;
}

/* ================================================
   左上：特色標籤群
   ================================================ */
.car-card__features {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  max-width: calc(100% - 90px);
  pointer-events: none;
  z-index: var(--z-badge);
}

.car-card__feature-tag {
  background: #5A2D82;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(90, 45, 130, 0.4);
  letter-spacing: 0.02em;
}

/* ================================================
   右上：車輛狀態 taxonomy badge
   ================================================ */
.car-card__status {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: var(--z-badge);
  pointer-events: none;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 11px;
  border-radius: 999px;
  white-space: nowrap;
  color: #fff;
  letter-spacing: 0.02em;
}

.car-status-available {
  background-color: #e8734a;
  box-shadow: 0 2px 6px rgba(232, 115, 74, 0.35);
}

.car-status-reserved {
  background-color: #555555;
  box-shadow: none;
}

.car-status-sold {
  background-color: #1a1a1a;
  box-shadow: none;
}

/* ================================================
   卡片文字區
   ================================================ */
.car-card__body {
  padding: 12px 14px 14px;
}

.car-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 6px;
}

.car-card__name {
  font-size: 14px;
  font-weight: 600;
  color: #1a1a1a;
  line-height: 1.3;
  margin: 0;
}

.car-card__year {
  font-size: 12px;
  color: #888;
  background: #f0e9e1;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
  margin-left: 8px;
  flex-shrink: 0;
}

.car-card__price {
  font-size: 20px;
  font-weight: 600;
  color: #c05a2e;
  margin: 0 0 10px 0;
  line-height: 1.2;
}

.car-card__price--tbd {
  font-size: 14px;
  font-weight: 400;
  color: #aaa;
}

/* ================================================
   規格列（三欄）
   ================================================ */
.car-card__specs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 0.5px solid #ede3d8;
  padding-top: 10px;
  gap: 8px;  /* 0 → 8px */
}

.car-card__specs .spec-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 10px 12px;
  background: #f8f7f4;
  border: 1px solid #f0ede6;
  border-radius: 10px;
  box-shadow: none;
}

.car-card__specs .spec-item + .spec-item {
  border-left: none;  /* 拿掉 border，改用 gap 分隔 */
}

.car-card__specs .spec-item__label {
  font-size: 11px;
  color: #aaa;
}

.car-card__specs .spec-item__value {
  font-size: 13px;
  font-weight: 500;
  color: #1a1a1a;
}

/* ================================================
   已成交：精簡橫列（.sold-card__*）
   ================================================ */
.car-section--sold .car-card {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 12px 14px !important;
  opacity: 0.55;
  border-radius: 12px;
}

.car-section--sold .car-card__image-wrap,
.car-section--sold .car-card__specs {
  display: none !important;
}

.sold-card__info {
  flex: 1;
  min-width: 0;
}

.sold-card__name {
  font-size: 14px;
  font-weight: 500;
  color: #1a1a1a;
  margin: 0 0 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sold-card__meta {
  font-size: 12px;
  color: #aaa;
  margin: 0;
}

.sold-card__badge {
  background: #1a1a1a;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: 12px;
}

/* ================================================
   整備中：精簡橫列
   ================================================ */
.car-section--preparing .gb-query-loop {
  grid-template-columns: 1fr !important;
  gap: 0;
}

.car-section--preparing .car-card {
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  padding: 0 !important;
  box-shadow: none !important;
  transform: none !important;
}

.car-section--preparing .car-card:hover {
  transform: none !important;
  box-shadow: none !important;
}

/* ================================================
   右下角分享 / 複製連結按鈕
   ================================================ */
.car-card-wrap {
  position: relative !important;
}

.card-action-wrapper {
  position: absolute !important;
  bottom: 12px !important;
  right: 12px !important;
  z-index: var(--z-action-btn) !important;
  display: flex;
  gap: 8px;
  pointer-events: auto !important;
}

.card-action-wrapper .gb-button {
  pointer-events: auto !important;
  cursor: pointer !important;
}

.share-btn,
.copy-link-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 44px !important;
  height: 44px !important;
  padding: 0 !important;
  background: transparent !important;
  border: none !important;
  cursor: pointer !important;
  border-radius: 50% !important;
}

.share-btn .gb-shape,
.copy-link-btn .gb-shape {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: auto !important;
  height: auto !important;
  line-height: 1 !important;
}

.share-btn .gb-shape svg,
.copy-link-btn .gb-shape svg {
  width: 24px !important;
  height: 24px !important;
  min-width: 24px !important;
  min-height: 24px !important;
  stroke: #e8734a !important;
  stroke-width: 2.5 !important;
  display: block !important;
  shape-rendering: geometricPrecision !important;
  overflow: visible !important;
}

.share-btn:hover .gb-shape svg,
.copy-link-btn:hover .gb-shape svg {
  stroke: #222222 !important;
}

/* ================================================
   手機版：區塊間距修正
   ================================================ */
@media (max-width: 1024px) {

  .car-section--reserved,
  .car-section--sold {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
  }

  .car-section--reserved .gb-inside-container,
  .car-section--sold .gb-inside-container {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
  }

  .car-section--preparing {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
  }

  .car-section--preparing .gb-inside-container {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
  }

  .entry-content > h2.gb-text:not(.car-status-badge),
  .inside-article > h2.gb-text:not(.car-status-badge) {
    margin-top: 12px !important;
    margin-bottom: 8px !important;
  }

  .car-section {
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
  }

  .car-section > div {
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
  }
}

@media (max-width: 1024px) {
  .gb-element-b81c2da2 {
    padding-bottom: 0 !important;
    padding-top: 20px !important;
  }
}
/* 車輛展示頁_display.css */
.car-filter-tabs {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    overflow-x: auto;          /* 手機橫向捲動 */
    scrollbar-width: none;     /* 隱藏捲軸 */
    -webkit-overflow-scrolling: touch;
}

.car-filter-tab {
    flex-shrink: 0;            /* 防止按鈕被壓縮 */
    padding: 6px 16px;
    border-radius: 999px;
    border: 1px solid #ccc;
    background: #fff;
    color: #333;
    text-decoration: none;
    font-size: 14px;
    white-space: nowrap;
}

.car-filter-tab.is-active {
    background: #222;
    color: #fff;
    border-color: #222;
}

/* ==================
   整備中
   ================== */
.car-preparing-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: 0;
    border-radius: 10px;   /* 加這行 */
    overflow: hidden;      /* 加這行，讓圓角截到子元素 */
}

.car-preparing-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid #f0f0f0;
    background: #fdf6f0;  /* 改這裡，跟 .car-card 同色 */
}

.car-preparing-row:last-child {
    border-bottom: none;
}

.car-preparing-name {
    flex: 1;
    font-size: 14px;
    color: #333;
}

.car-preparing-spec {
    font-size: 13px;
    color: #888;
    white-space: nowrap;
}

.car-preparing-badge {
    font-size: 12px;
    font-weight: 500;
    color: #0f6e56;
    background: #e1f5ee;
    border-radius: 4px;
    padding: 2px 8px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ==================
   新車速報
   ================== */
.car-spotlight {
    border: 1.5px solid #f0c060;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.car-spotlight-heading {
    font-size: 15px;
    font-weight: 500;
    background: #f5a623;
    color: #4a2800;
    padding: 8px 14px;
    margin: 0;
}

.car-spotlight-card {
    display: flex;
    align-items: stretch;
    max-height: 220px;  /* 加這行 */
}

.car-spotlight-photo {
    width: 42%;
    flex-shrink: 0;
}

.car-spotlight-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.car-spotlight-info {
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
}

.car-spotlight-name {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    line-height: 1.4;
    margin: 0;
}

.car-spotlight-spec {
    font-size: 13px;
    color: #888;
    margin: 0;
}

/* 速報 電腦版 修正*/
/* ── 新車速報 ── */
.car-spotlight {
  border: 1px solid #e8c84a;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.car-spotlight-heading {
  background: #e8c84a;
  color: #1a1a1a;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0.45rem 1rem;
  margin: 0;
}

/* 桌機：左圖右文橫排 */
.car-spotlight-card {
  display: flex;
  align-items: stretch;
}

.car-spotlight-photo {
  flex: 0 0 320px;
  overflow: hidden;
}

.car-spotlight-photo .car-spotlight-img {
  width: 100%;
  height: 100%;
  max-height: 220px;
  object-fit: cover;
  object-position: center;
  display: block;
}

/* 手機：上圖下文堆疊 */
@media (max-width: 768px) {
  .car-spotlight-card {
    flex-direction: column;
  }

  .car-spotlight-photo {
    flex: unset;
    width: 100%;
    aspect-ratio: 2/1;   /* 從 16/9 改成 2/1，圖片變更扁 */
  }

  .car-spotlight-photo .car-spotlight-img {
    width: 100%;
    height: 100%;          /* ← 配合容器 aspect-ratio 撐滿 */
    max-height: none;       /* ← 取消 max-height 限制 */
    object-fit: cover;
  }
}
/* ================================================
   已過戶待交：印章疊圖（藏青色 + 直排兩字）
   ================================================ */

/* 圖片灰階：沿用 reserved 同強度 */
.car-card__image-wrap--delivering img {
    filter: grayscale(45%) brightness(0.86);
    transition: filter 0.3s ease;
}

/* 藏青色印章：覆蓋圓圈邊框 / 背景 / 文字色 */
.car-card__stamp--delivering .car-card__stamp-circle {
    border-color: rgba(43, 89, 168, 0.90);
    background: rgba(43, 89, 168, 0.1);
}

.car-card__stamp--delivering .car-card__stamp-text {
    color: rgba(28, 56, 105, 0.90);
}

/* 直排兩字：縮字 + 取消負字距 */
.car-card__stamp-text--vertical {
    font-size: 28px;
    line-height: 1.05;
    letter-spacing: 0;
}

@media (max-width: 400px) {
    .car-card__stamp-text--vertical {
        font-size: 22px !important;
    }
}

/* 狀態 badge（右上角膠囊）*/
.car-status-delivering {
    background-color: #355a94;
    box-shadow: none;
}

/* 手機版：區塊間距修正（沿用 reserved/sold 同邏輯）*/
@media (max-width: 1024px) {
    .car-section--delivering {
        padding-top: 0 !important;
        padding-bottom: 0 !important;
        margin-top: 0 !important;
        margin-bottom: 0 !important;
    }

    .car-section--delivering .gb-inside-container {
        padding-top: 0 !important;
        padding-bottom: 0 !important;
    }
}
