﻿/* ============================================
   閒置視窗 Idle Popup
   主題色:#29a9e0
   ============================================ */
.popup-window {
  background: #ffffff;
  width: 760px;
  max-width: 100%;
  border-radius: 18px;
  padding: 24px 32px 20px;
  box-shadow: 0 24px 64px rgba(15, 35, 50, .28);
  position: relative;
}

/* ---------- 頂部:回首頁 / 標題 / 關閉 ---------- */

.popup-header { display: flex; align-items: flex-start; gap: 14px; }

.icon-button {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: var(--background-soft);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.icon-button:hover { background: var(--brand-tint); color: var(--brand-dark); }

.header-text { flex: 1; min-width: 0; padding-top: 1px; }
.header-text h2 { font-size: 17px; font-weight: 700; color: var(--text-primary); letter-spacing: .3px; }
.header-text p { font-size: 12.5px; color: var(--text-muted); margin-top: 4px; line-height: 1.6; }

/* ---------- 分頁 ---------- */

.tab-list {
  display: flex;
  gap: 26px;
  margin-top: 18px;
  border-bottom: 1px solid var(--border-color);
}
.tab {
  padding: 0 2px 11px;
  font-size: 15px;
  cursor: pointer;
  color: var(--text-muted);
  position: relative;
  font-weight: 500;
  background: none;
  border: none;
  font-family: inherit;
}
.tab.active { color: var(--text-primary); font-weight: 700; }
.tab.active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--brand);
}

/* ---------- 搜尋列 ---------- */

.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  background: var(--background-soft);
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 0 8px 0 16px;
  height: 44px;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.search-bar:focus-within {
  background: #ffffff;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(41, 169, 224, .12);
}
.search-bar input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 14px;
  color: var(--text-primary);
  font-family: inherit;
}
.search-bar input::placeholder { color: var(--text-muted); }
.search-button {
  flex: none;
  border: none;
  cursor: pointer;
  background: var(--brand);
  color: #ffffff;
  font-size: 13.5px;
  font-weight: 600;
  padding: 7px 18px;
  border-radius: 9px;
  transition: background .15s;
  font-family: inherit;
}
.search-button:hover { background: var(--brand-dark); }

/* ---------- 共用四欄格線(卡片與底部按鈕切齊的關鍵) ---------- */

.four-column-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--grid-gap);
}

.tab-content { margin-top: 22px; }
.column-header-row { margin-bottom: 12px; }

.column-header {
  grid-column: span 2;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 10px;
  min-width: 0;
}

/* 欄標題本身就是連結:同色 + 底線 */
.column-title-link {
  color: var(--text-primary);
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 1.5px;
  transition: color .15s;
}
.column-title-link:hover { color: var(--brand-dark); }
.column-title-link h3 { font-size: 15px; font-weight: 700; display: inline; }

.column-statistics { font-size: 12px; color: var(--text-muted); white-space: nowrap; }

/* ---------- 卡片 ---------- */

.card {
  min-width: 0;
  cursor: pointer;
  border-radius: var(--border-radius);
  display: flex;
  flex-direction: column;
  transition: transform .18s, box-shadow .18s;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(15, 35, 50, .10); }
.card:hover .card-title { color: var(--brand-dark); }

/* 圖卡圖片 */
.thumbnail {
  width: 100%;
  aspect-ratio: 16 / 10;
  flex: none;
  display: block;
  object-fit: cover;
  border-radius: var(--border-radius) var(--border-radius) 0 0;
  background: var(--background-soft);
}
.thumbnail-square { aspect-ratio: 1 / 1; }

.card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-color);
  border-top: none;
  border-radius: 0 0 var(--border-radius) var(--border-radius);
  padding: 11px 12px 12px;
}
.card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.6;
  transition: color .15s;
}

/* 資訊列:日期 + 瀏覽數同排;寬度不足時自動斷行 */
.card-details {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin-top: auto;
  padding-top: 10px;
  font-size: 12px;
  color: var(--text-muted);
}
.card-details-item { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.card-details-item svg { flex: none; }

/* ---------- 商品卡 ---------- */

.price-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 10px;
}
.price-original {
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: line-through;
  white-space: nowrap;
}
.price-discounted {
  font-size: 16px;
  font-weight: 700;
  color: var(--price-color);
  white-space: nowrap;
  letter-spacing: .2px;
}
.price-discounted small { font-size: 12px; font-weight: 600; margin-right: 1px; }

.product-actions { display: flex; gap: 8px; margin-top: 10px; }
.cart-button {
  flex: none;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border-color);
  background: #ffffff;
  color: var(--text-secondary);
  border-radius: 9px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color .15s, color .15s, background .15s;
}
.cart-button:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-tint); }
.product-detail-button {
  flex: 1;
  height: 34px;
  border: 1px solid var(--brand);
  background: #ffffff;
  color: var(--brand);
  border-radius: 9px;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  font-family: inherit;
  transition: background .15s, color .15s;
}
.product-detail-button:hover { background: var(--brand); color: #ffffff; }

/* ---------- 底部按鈕:靜止淺藍底粗體 / hover 主題色底白字 ---------- */

.popup-footer {
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid var(--border-color);
}
.footer-button {
  position: relative;
  grid-column: span 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: none;
  cursor: pointer;
  background: var(--brand-tint);
  color: var(--brand-dark);
  font-size: 13.5px;
  font-weight: 700;
  padding: 10px 0;
  border-radius: 10px;
  transition: background .15s, color .15s;
  min-width: 0;
  font-family: inherit;
}
/* 按鈕之間的細分隔線 */
.footer-button + .footer-button::before {
  content: "";
  position: absolute;
  left: calc(var(--grid-gap) / -2);
  top: 50%;
  transform: translateY(-50%);
  width: 1px;
  height: 16px;
  background: var(--border-color);
}
.footer-button svg { color: var(--brand-dark); transition: color .15s; flex: none; }
.footer-button:hover { background: var(--brand); color: #ffffff; }
.footer-button:hover svg { color: #ffffff; }

/* ---------- 分頁面板 ---------- */

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---------- 手機版:講座/消息各 1 篇、商品 2 個 ---------- */

@media (max-width: 640px) {
  .popup-window { padding: 18px 16px 16px; border-radius: 16px; }
  .four-column-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .column-header { grid-column: span 1; }
  /* 統計數字換行到標題下方,不隱藏 */
  .column-statistics { flex-basis: 100%; }
  .column-header-full { grid-column: span 2 !important; }
  .mobile-hidden { display: none; }
  .footer-button { grid-column: span 1; }
  .footer-button + .footer-button::before { left: -6px; }
  .header-text h2 { font-size: 15.5px; }
  .tab-list { gap: 20px; }
}
