/* ============================================================
   以圖搜尋 — 桌機版彈窗樣式
   ============================================================ */

/* ---------- 背景遮罩 + 容器 ---------- */
.image-search-popup {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  align-items: center;
  justify-content: center;
}
.image-search-popup.is-show {
  display: flex;
}
.image-search-popup__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

/* ---------- Modal 主體 ---------- */
.image-search-popup__modal {
  position: relative;
  width: 324px;
  background: #fff;
  border-radius: 15px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  z-index: 1;
}

/* ---------- Header ---------- */
.image-search-popup__header {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.image-search-popup__close {
  align-self: flex-end;
  font-size: 14px;
  color: #aaa;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s;
}
.image-search-popup__close:hover {
  color: #333;
}
.image-search-popup__title {
  font-size: 14px;
  font-weight: normal;
  color: #333;
  text-align: center;
  padding-bottom: 10px;
  border-bottom: 1px solid #e1e1df;
}

/* ---------- 上傳區 ---------- */
.image-search-popup__upload {
  width: 292px;
  height: 244px;
  margin: 0 auto;
  border: 2px dashed #ddd;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.image-search-popup__upload:hover,
.image-search-popup__upload.is-dragover {
  border-color: #FF7800;
  background: #FFF8F0;
}
.image-search-popup__upload-icon {
  font-size: 36px;
  color: #ccc;
  margin-bottom: 12px;
}
.image-search-popup__upload-text {
  font-size: 14px;
  color: #666;
  margin-bottom: 4px;
}
.image-search-popup__upload-hint {
  font-size: 12px;
  color: #aaa;
}

/* ---------- 圖片預覽 ---------- */
.image-search-popup__preview {
  display: none;
  width: 292px;
  height: 244px;
  margin: 0 auto;
  overflow: hidden;
}
.image-search-popup__preview.has-images {
  display: block;
}
.image-search-popup__preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ---------- Footer (搜尋按鈕) ---------- */
.image-search-popup__footer {
  text-align: center;
}
.image-search-popup__search-btn {
  width: 292px;
  height: 40px;
  background: #FF7800;
  color: #fff;
  border: none;
  border-radius: 5px;
  font-size: 14px;
  cursor: pointer;
  transition: opacity 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}
.image-search-popup__search-btn:hover {
  opacity: 0.9;
}
.image-search-popup__search-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---------- 關鍵字選擇 ---------- */
.image-search-popup__keywords {
  flex: 1;
  overflow-y: auto;
  max-height: 300px;
}
.image-search-popup__keywords-title {
  font-size: 14px;
  color: #333;
  text-align: center;
  padding-bottom: 10px;
  border-bottom: 0.5px solid #e1e1df;
  margin-bottom: 20px;
}
.image-search-popup__keywords-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
  padding-left: 15px;
}
.image-search-popup__keywords-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.15s;
}
.image-search-popup__keywords-ja {
  font-size: 12px;
  color: #333;
}
.image-search-popup__keywords-trans {
  font-size: 12px;
  color: #888;
}

/* ---------- 搜尋失敗重試 ---------- */
.image-search-popup__error-retry {
  display: inline-flex;
  align-items: center;
  padding: 10px 20px;
  background: #FF7800;
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: opacity 0.2s;
}
.image-search-popup__error-retry:hover {
  opacity: 0.85;
}

/* ---------- Loading ---------- */
.image-search-popup__loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.image-search-popup__loading-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #eee;
  border-top-color: #FF7800;
  border-radius: 50%;
  animation: imageSearchSpin 0.8s linear infinite;
}
@keyframes imageSearchSpin {
  to { transform: rotate(360deg); }
}
.image-search-popup__loading-text {
  font-size: 13px;
  color: #888;
}
