/* ========================================================================
   搜索頁面 - 局部樣式表 (Search Page - Local Styles)
   ========================================================================

   專案: 星宇航空物流平台
   頁面: /search
   版本: 1.0.0
   最後更新: 2025-10-05

   設計原則:
   - 僅處理頁面內容區域的局部樣式
   - 不涉及全局佈局 (header, footer, navigation由主模板負責)
   - 採用BEM命名規範 (search-前綴)
   - 響應式設計優先 (Mobile-First)
   - 與首頁/集運頁面保持一致的架構風格

   頁面結構:
   1. 麵包屑導航 (Breadcrumb)
   2. 分類圖標網格 (Category Icons Grid)
   3. 搜索輸入區 (Search Input)
   4. 統計與篩選 (Stats & Filter)
   5. 結果顯示區 (Results Display)

   ======================================================================== */

/* ============================================================
   1. 頁面容器與佈局 (Page Container & Layout)
   ============================================================ */

.search-page {
  width: 100%;
  min-height: calc(100vh - 200px);
}

.search-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ============================================================
   2. 麵包屑導航 (Breadcrumb Navigation)
   ============================================================ */

.search-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 1rem;
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.search-breadcrumb-item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: #f3f4f6;
  border: none;
  border-radius: 6px;
  color: #6b7280;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.search-breadcrumb-item:not(:last-child)::after {
  content: '›';
  position: absolute;
  right: -0.75rem;
  color: #9ca3af;
  font-size: 1.25rem;
  font-weight: 400;
}

.search-breadcrumb-item:hover {
  background: #e5e7eb;
  color: #374151;
}

.search-breadcrumb-home {
  background: #4f46e5;
  color: #ffffff;
}

.search-breadcrumb-home:hover {
  background: #4338ca;
}

.search-breadcrumb-item i {
  font-size: 0.875rem;
}

/* ============================================================
   3. 分類圖標區域 (Category Icons Section)
   ============================================================ */

.search-categories {
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  padding: 1.5rem;
}

.search-categories-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #e5e7eb;
}

.search-categories-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.25rem;
  font-weight: 600;
  color: #111827;
  margin: 0;
}

.search-categories-title i {
  color: #4f46e5;
  font-size: 1.5rem;
}

.search-categories-level-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.search-level-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.375rem 0.875rem;
  background: #e0e7ff;
  color: #4338ca;
  border-radius: 6px;
  font-size: 0.8125rem;
  font-weight: 600;
}

/* ============================================================
   3.1 分類圖標網格 (Category Icons Grid)
   ============================================================ */

.search-categories-grid {  display: grid;  gap: 0.5rem;  /* 手機版: 4列,自動行數 */  grid-template-columns: repeat(4, 1fr);  grid-auto-rows: 1fr;}

/* 🔥 修改卡片為正方形 (128x128圖標) */.search-category-card {  display: flex;  flex-direction: column;  align-items: center;  justify-content: center;  padding: 0.5rem;  background: #f9fafb;  border: 2px solid #e5e7eb;  border-radius: 12px;  cursor: pointer;  transition: all 0.3s;  position: relative;  overflow: hidden;  aspect-ratio: 1 / 1; /* 強制正方形 */  width: 100%;}
.search-category-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 16px rgba(79, 70, 229, 0.15);
  border-color: #c7d2fe;
  background: #ffffff;
}

.search-category-card-icon {  width: 100%;  height: 100%;  max-width: 128px;  max-height: 128px;  border-radius: 10px;  object-fit: contain;  background: #ffffff;}
}

.search-category-card-no-icon {
  width: 80px;
  height: 80px;
  margin-bottom: 0.75rem;
  border-radius: 10px;
  font-weight: 700;
  color: #4f46e5;
  margin-bottom: 0.25rem;
}

.search-category-card-name {
  font-size: 0.75rem;
  color: #6b7280;
  text-align: center;
  line-height: 1.4;
  max-height: 2.8em;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* ============================================================
   4. 搜索輸入區域 (Search Input Section)
   ============================================================ */

.search-input-section {
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  padding: 1.5rem;
}

.search-form {
  position: relative;
}

.search-input-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: #f9fafb;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  transition: all 0.2s;
  position: relative;
}

.search-input-group:focus-within {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
  background: #ffffff;
}

.search-input-icon {
  color: #9ca3af;
  font-size: 1.125rem;
}

.search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 1rem;
  color: #111827;
  outline: none;
  padding: 0;
}

.search-input::placeholder {
  color: #9ca3af;
}

.search-input-clear {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  background: #d1d5db;
  color: #ffffff;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s;
}

.search-input-clear:hover {
  background: #9ca3af;
}

.search-input-submit {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: #ffffff;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.9375rem;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.search-input-submit:hover {
  background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
  transform: translateY(-1px);
}

/* Auto-complete Suggestions */
.search-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 0.5rem;
  background: #ffffff;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  max-height: 300px;
  overflow-y: auto;
  z-index: 100;
}

.search-suggestion-item {
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: background 0.2s;
  border-bottom: 1px solid #f3f4f6;
}

.search-suggestion-item:last-child {
  border-bottom: none;
}

.search-suggestion-item:hover {
  background: #f9fafb;
}

.search-suggestion-code {
  font-weight: 600;
  color: #4f46e5;
  margin-bottom: 0.25rem;
}

.search-suggestion-name {
  font-size: 0.875rem;
  color: #6b7280;
}

/* ============================================================
   5. 統計與篩選區域 (Stats & Filter Section)
   ============================================================ */

.search-filter-section {
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  padding: 1.5rem;
}

.search-stats {
  display: flex;
  flex-direction: row;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  flex-wrap: nowrap;
}

.search-stats-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border-radius: 8px;
  flex: 1;
  min-width: 0;
}

.search-stats-item i {
  font-size: 1.5rem;
  color: #0284c7;
  flex-shrink: 0;
}

.search-stats-content {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.search-stats-label {
  font-size: 0.75rem;
  color: #64748b;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-stats-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: #0369a1;
}

.search-stats-item.stat-no-regulation {
  background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
}

.search-stats-item.stat-no-regulation i {
  color: #ea580c;
}

.search-stats-item.stat-no-regulation .search-stats-value {
  color: #9a3412;
}

.search-stats-item.stat-zero-tax {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
}

.search-stats-item.stat-zero-tax i {
  color: #16a34a;
}

.search-stats-item.stat-zero-tax .search-stats-value {
  color: #166534;
}

@media (max-width: 768px) {
  .search-stats {
    gap: 0.5rem;
  }
  
  .search-stats-item {
    padding: 0.5rem 0.75rem;
    gap: 0.4rem;
  }
  
  .search-stats-item i {
    font-size: 1.25rem;
  }
  
  .search-stats-label {
    font-size: 0.65rem;
  }
  
  .search-stats-value {
    font-size: 1rem;
  }
}

/* Chapter Filter */
.search-chapter-filter {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 2px solid #e5e7eb;
}

.search-filter-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1rem;
  font-weight: 600;
  color: #111827;
  margin-bottom: 1rem;
}

.search-filter-title i {
  color: #4f46e5;
}

.search-chapter-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 400px;
  overflow-y: auto;
}

.search-chapter-item {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.search-chapter-item:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
}

.search-chapter-item.active {
  background: #ede9fe;
  border-color: #a78bfa;
  font-weight: 600;
}

.search-chapter-item-code {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: #4f46e5;
  color: #ffffff;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.875rem;
  margin-right: 0.75rem;
}

.search-chapter-item-text {
  flex: 1;
  font-size: 0.875rem;
  color: #374151;
}

.search-chapter-item-count {
  font-size: 0.75rem;
  color: #6b7280;
  background: #e5e7eb;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-weight: 600;
}

/* ============================================================
   6. 結果顯示區域 (Results Display Section)
   ============================================================ */

.search-results-section {
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  padding: 1.5rem;
}

.search-results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #e5e7eb;
}

.search-results-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.25rem;
  font-weight: 600;
  color: #111827;
  margin: 0;
}

.search-results-title i {
  color: #4f46e5;
  font-size: 1.5rem;
}





/* Results Grid */
.search-results-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  min-height: 300px;
}

.search-result-card {
  display: flex;
  flex-direction: column;
  padding: 1.25rem;
  background: #f9fafb;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s;
}

.search-result-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
  border-color: #c7d2fe;
  background: #ffffff;
}

.search-result-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.search-result-card-code {
  font-size: 1.125rem;
  font-weight: 700;
  color: #4f46e5;
}

.search-result-card-chapter {
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  background: #dbeafe;
  color: #1e40af;
  border-radius: 4px;
  font-weight: 600;
}

.search-result-card-name {
  font-size: 0.9375rem;
  color: #111827;
  line-height: 1.5;
  margin-bottom: 0.5rem;
  min-height: 3em;
}
.search-result-card-name-en {
  font-size: 0.8125rem;
  color: #6b7280;
  line-height: 1.4;
  margin-bottom: 0.75rem;
  font-style: italic;
}

.search-result-card-meta {
  display: flex;
  gap: 0.75rem;
  font-size: 0.8125rem;
  color: #6b7280;
  padding-top: 0.75rem;
  border-top: 1px solid #e5e7eb;
}

.search-result-card-meta-item {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.search-result-card-meta-item i {
  font-size: 0.75rem;
  color: #9ca3af;
}

/* Empty State */
.search-results-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  text-align: center;
}

.search-empty-icon {
  width: 80px;
  height: 80px;
  background: #f3f4f6;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.search-empty-icon i {
  font-size: 2.5rem;
  color: #9ca3af;
}

.search-empty-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: #6b7280;
  margin-bottom: 0.5rem;
}

.search-empty-text {
  font-size: 0.9375rem;
  color: #9ca3af;
}

/* ============================================================
   7. 分頁控制 (Pagination)
   ============================================================ */

.search-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 2px solid #e5e7eb;
}

.search-pagination-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  background: #ffffff;
  border: 2px solid #d1d5db;
  border-radius: 6px;
  color: #374151;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
}

.search-pagination-btn:hover:not(:disabled) {
  background: #f9fafb;
  border-color: #6366f1;
  color: #4f46e5;
}

.search-pagination-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.search-pagination-info {
  font-size: 0.875rem;
  color: #6b7280;
  font-weight: 500;
}

/* ============================================================
   8. 載入與動畫 (Loading & Animations)
   ============================================================ */

.search-loading {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  gap: 1.5rem;
}

.search-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #e5e7eb;
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: search-spin 0.8s linear infinite;
}

@keyframes search-spin {
  to { transform: rotate(360deg); }
}

.search-loading p {
  font-size: 0.9375rem;
  color: #6b7280;
  font-weight: 500;
}

/* ============================================================
   ============================================================ */

/* Tablet (768px+) */
@media (min-width: 768px) {
  .search-container {
    padding: 2rem 1.5rem;
    gap: 2rem;
  }

/* 平板: 6列3行 = 最多18個項目 */  .search-categories-grid {    grid-template-columns: repeat(6, 1fr);    grid-template-rows: repeat(3, 1fr);  }

  .search-category-card-icon,
  .search-category-card-no-icon {
    width: 100%;
    height: 100%;
    max-width: 128px;
    max-height: 128px;
  }

  .search-category-card-code {
    font-size: 1rem;
  }

  .search-category-card-name {
    font-size: 0.875rem;
  }

  .search-results-grid {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  }
}

/* Desktop (1024px+) */
@media (min-width: 1024px) {
  .search-container {
    padding: 2.5rem 2rem;
  }

  /* 8 items per row, max 3 rows = 24 items/page */
/* 電腦: 8列3行 = 最多24個項目 */  .search-categories-grid {    grid-template-columns: repeat(8, 1fr);    grid-template-rows: repeat(3, 1fr);  }

  .search-category-card-icon,
  .search-category-card-no-icon {
    width: 100%;
    height: 100%;
    max-width: 128px;
    max-height: 128px;
  }

  .search-input-group {
    padding: 1rem 1.5rem;
  }

  .search-input {
    font-size: 1.0625rem;
  }
}

/* Large Desktop (1440px+) */
@media (min-width: 1440px) {
  .search-container {
    max-width: 1600px;
  }

  .search-category-card-icon,
  .search-category-card-no-icon {
    width: 100%;
    height: 100%;
    max-width: 128px;
    max-height: 128px;
  }
}

/* ============================================================
   11. 工具類別 (Utility Classes)
   ============================================================ */

.search-hidden {
  display: none !important;
}

.search-visible {
  display: block !important;
}

.search-text-center {
  text-align: center;
}

/* END OF SEARCH PAGE LOCAL STYLES */

/* ============================================================
   結果卡片 - 更新樣式 (顯示更多欄位)
   ============================================================ */

.search-result-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.search-result-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.search-result-field label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.search-result-field > div {
  font-size: 0.875rem;
  color: #111827;
  line-height: 1.5;
}

.search-result-rate {
  font-weight: 700;
  color: #059669;
}

.search-result-import-code {
  font-family: 'Courier New', monospace;
  font-size: 0.8125rem;
  color: #4f46e5;
  background: #f3f4f6;
  padding: 0.375rem 0.5rem;
  border-radius: 4px;
  display: inline-block;
}

/* END OF ADDITIONAL STYLES */

/* ==========================================
   圖標占位符樣式優化
   新增於 2025-10-07
   ========================================== */

/* 圖標占位符容器 */
.search-category-card-placeholder {    display: flex;    flex-direction: column;    align-items: center;    justify-content: center;    width: 100%;    height: 100%;    max-width: 128px;    max-height: 128px;    background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf1 100%);    border-radius: 8px;    border: 2px dashed #cbd5e0;    transition: all 0.3s ease;}

.search-category-card-placeholder i {
    font-size: 36px;
    color: #a0aec0;
    margin-bottom: 8px;
    transition: color 0.3s ease;
}

.search-category-card-placeholder .placeholder-text {
    font-size: 12px;
    color: #718096;
/* 無圖標佔位符 - 128x128 正方形 */.search-category-card-placeholder {    display: flex;    flex-direction: column;    align-items: center;    justify-content: center;    width: 128px;    height: 128px;    background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf1 100%);    border-radius: 10px;    border: 2px dashed #cbd5e0;    transition: all 0.3s ease;}.search-category-card-placeholder i {    font-size: 36px;    color: #a0aec0;    margin-bottom: 8px;    transition: color 0.3s ease;}.search-category-card-placeholder .placeholder-text {    font-size: 12px;    color: #718096;    font-weight: 500;}
    height: 120px;
    object-fit: contain;
    border-radius: 8px;
    transition: transform 0.3s ease;
}

.search-category-card:hover .search-category-card-icon {
    transform: scale(1.05);
}

/* 結果卡片優化 */
.search-result-field {
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e2e8f0;
}

.search-result-field:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.search-result-field label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.search-result-field .field-value {
    font-size: 14px;
    color: #2d3748;
    line-height: 1.5;
}

.search-result-field .duty-rate {
    color: #38a169;
    font-weight: 600;
}

.search-result-field .regulations {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: #4a5568;
}

/* 詳情按鈕 */
.search-result-detail-btn {
    width: 100%;
    padding: 10px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.search-result-detail-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.search-result-detail-btn:active {
    transform: translateY(0);
}

/* 載入中動畫 */
.search-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
}

.search-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e2e8f0;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 錯誤狀態 */
.search-error {
    text-align: center;
    padding: 40px 20px;
    color: #e53e3e;
}

.search-error i {
    font-size: 48px;
    margin-bottom: 16px;
}

/* 響應式優化 */
@media (max-width: 768px) {
        font-size: 28px;
    }
    
    .search-category-card-placeholder .placeholder-text {
        font-size: 11px;
    }
}

/* 分類卡片圖片容器 */
.search-category-card-image {
    width: 100%;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf1 100%);
    border-radius: 12px 12px 0 0;
}

.search-category-card-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 10px;
}

/* 分類卡片內容容器 */
.search-category-card-content {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.search-category-card-content .search-category-card-code {
    font-size: 14px;
    font-weight: 600;
    color: #667eea;
}

.search-category-card-content .search-category-card-name {
    font-size: 13px;
    color: #4a5568;
    line-height: 1.4;
}

/* 麵包屑導航樣式 */
.breadcrumb-link {
    color: #667eea;
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.breadcrumb-link:hover {
    background-color: #edf2f7;
    color: #5a67d8;
}

.breadcrumb-home {
    color: #4a5568;
    font-weight: 500;
}

#searchBreadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 0;
    font-size: 14px;
    color: #718096;
}

#searchBreadcrumb i.fa-chevron-right {
    font-size: 10px;
    color: #cbd5e0;
}

/* Toast 動畫 */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* ==================== 結果卡片更新樣式 ==================== */

/* 卡片頭部 - 添加收藏按鈕 */
.search-result-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.search-result-favorite-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #cbd5e1;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0.5rem;
    border-radius: 50%;
}

.search-result-favorite-btn:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    transform: scale(1.1);
}

.search-result-favorite-btn.favorited i {
    color: #ef4444;
}

.search-result-favorite-btn i {
    transition: transform 0.3s ease;
}

.search-result-favorite-btn:active i {
    transform: scale(0.9);
}

/* 卡片底部 - 預報輸入框 */
.search-result-card-footer {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
}

.search-result-prebooking {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.search-result-prebooking label {
    font-weight: 600;
    color: #475569;
    font-size: 0.875rem;
    min-width: 3rem;
}

.search-result-prebooking-input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 1px solid #cbd5e1;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.search-result-prebooking-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-result-prebooking-input.success-flash {
    border-color: #10b981;
    background-color: #d1fae5;
}

.search-result-prebooking-btn {
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.search-result-prebooking-btn:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(37, 99, 235, 0.2);
}

.search-result-prebooking-btn:active {
    transform: translateY(0);
}

.search-result-prebooking-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 響應式設計 */
@media (max-width: 640px) {
    .search-result-prebooking {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-result-prebooking label {
        min-width: auto;
    }
    
    .search-result-prebooking-btn {
        width: 100%;
        justify-content: center;
    }
}

/* ==================== 規定代碼 Tooltip 樣式 ==================== */

/* 規定代碼樣式 */
.regulation-code {
    display: inline-block;
    padding: 2px 6px;
    margin: 0 2px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: 600;
    cursor: help;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.regulation-code:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.regulation-code:active {
    transform: translateY(0) scale(1);
}

.no-regulations {
    color: #9ca3af;
    font-style: italic;
    font-size: 0.9em;
}

/* Tooltip 容器 */
.regulation-tooltip {
    position: absolute;
    z-index: 10000;
    max-width: 400px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3), 
                0 0 0 1px rgba(0, 0, 0, 0.05);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-5px);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.regulation-tooltip.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

/* Tooltip 內容 */
.tooltip-content {
    padding: 16px;
    font-size: 14px;
    line-height: 1.6;
}

/* Tooltip 標題 */
.tooltip-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f3f4f6;
}

.tooltip-header strong {
    font-size: 16px;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Tooltip 主體內容 */
.tooltip-body {
    color: #374151;
    text-align: justify;
    max-height: 300px;
    overflow-y: auto;
    padding-right: 8px;
}

.tooltip-body::-webkit-scrollbar {
    width: 6px;
}

.tooltip-body::-webkit-scrollbar-track {
    background: #f3f4f6;
    border-radius: 3px;
}

.tooltip-body::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.tooltip-body::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* 無資料狀態 */
.tooltip-no-data {
    color: #9ca3af;
    font-style: italic;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: #f9fafb;
    border-radius: 6px;
}

.tooltip-no-data i {
    font-size: 18px;
}

/* 載入中狀態 */
.tooltip-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px;
    color: #6b7280;
}

.tooltip-loading i {
    font-size: 16px;
}

/* Tooltip 頁尾 */
.tooltip-footer {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #f3f4f6;
    font-size: 12px;
    color: #6b7280;
}

/* Tooltip 箭頭 */
.tooltip-arrow {
    position: absolute;
    width: 12px;
    height: 12px;
    background: white;
    transform: rotate(45deg);
    box-shadow: -2px -2px 4px rgba(0, 0, 0, 0.05);
}

/* 箭頭位置 - 上方顯示時 */
.regulation-tooltip.top .tooltip-arrow {
    bottom: -6px;
    left: 50%;
    margin-left: -6px;
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

/* 箭頭位置 - 下方顯示時 */
.regulation-tooltip.bottom .tooltip-arrow {
    top: -6px;
    left: 50%;
    margin-left: -6px;
}

/* 響應式設計 - 移動裝置 */
@media (max-width: 768px) {
    .regulation-tooltip {
        max-width: calc(100vw - 40px);
        left: 20px !important;
        right: 20px !important;
    }
    
    .tooltip-content {
        padding: 12px;
        font-size: 13px;
    }
    
    .tooltip-header strong {
        font-size: 14px;
    }
    
    .tooltip-body {
        max-height: 200px;
    }
    
    .regulation-code {
        padding: 3px 8px;
        font-size: 0.8em;
    }
}

/* 深色模式支援 */
@media (prefers-color-scheme: dark) {
    .regulation-tooltip {
        background: #1f2937;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 
                    0 0 0 1px rgba(255, 255, 255, 0.1);
    }
    
    .tooltip-header {
        border-bottom-color: #374151;
    }
    
    .tooltip-body {
        color: #d1d5db;
    }
    
    .tooltip-body::-webkit-scrollbar-track {
        background: #374151;
    }
    
    .tooltip-body::-webkit-scrollbar-thumb {
        background: #4b5563;
    }
    
    .tooltip-body::-webkit-scrollbar-thumb:hover {
        background: #6b7280;
    }
    
    .tooltip-no-data {
        background: #111827;
        color: #9ca3af;
    }
    
    .tooltip-footer {
        border-top-color: #374151;
        color: #9ca3af;
    }
    
    .tooltip-arrow {
        background: #1f2937;
    }
}

/* 動畫效果 */
@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes tooltipFadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

/* ========================================
   稅則編號按鈕樣式
   ======================================== */

/* 稅則編號按鈕 */
.tariff-code-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    font-family: "Monaco", "Consolas", monospace;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.tariff-code-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.5);
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.tariff-code-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.4);
}

.tariff-code-btn i {
    font-size: 14px;
    opacity: 0.9;
}

.tariff-code-text {
    letter-spacing: 0.5px;
}

/* 空白稅則編號 */
.tariff-code-empty {
    color: #9ca3af;
    font-style: italic;
    font-size: 14px;
}

/* 響應式設計 - 手機版 */
@media (max-width: 768px) {
    .tariff-code-btn {
        padding: 6px 12px;
        font-size: 14px;
        gap: 6px;
    }
    
    .tariff-code-btn i {
        font-size: 12px;
    }
}

/* 確保按鈕在卡片標題中正確顯示 */
.search-result-card-header .search-result-card-code {
    display: flex;
    align-items: center;
}

/* 非按鈕的稅則編號文字 (分類代碼等) */
.tariff-code-text-plain {
    font-family: "Monaco", "Consolas", monospace;
    font-size: 16px;
    font-weight: 600;
    color: #4b5563;
    letter-spacing: 0.5px;
}
/* ============================================================
   3.2 分類項目樣式 (Category Item Styles)
   動態JavaScript生成的分類項目
   ============================================================ */

/* 分類項目容器 - 只顯示圖標，隱藏文字 */
.category-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #f9fafb;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
  aspect-ratio: 1 / 1; /* 強制正方形 */
  width: 100%;
  padding: 0.5rem;
}

.category-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 16px rgba(79, 70, 229, 0.15);
  border-color: #c7d2fe;
  background: #ffffff;
}

/* 圖標容器 - 填滿整個項目 */
.category-icon {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.category-icon img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

/* 隱藏代碼和描述文字 */
.category-code,
.category-description {
  display: none !important;
  visibility: hidden !important;
}

/* 自定義圖標樣式 */
.category-item.custom-icon .category-custom-icon {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.category-item.custom-icon .category-custom-icon img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

/* 響應式佈局 */

/* 手機版: 4列 */
@media (max-width: 767px) {
  .search-categories-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
  }
  
  .category-item {
    padding: 0.375rem;
  }
}

/* 平板版: 6列 */
@media (min-width: 768px) and (max-width: 1023px) {
  .search-categories-grid {
    grid-template-columns: repeat(6, 1fr);
    gap: 0.75rem;
  }
  
  .category-item {
    padding: 0.5rem;
  }
}

/* 電腦版: 8列 */
@media (min-width: 1024px) {
  .search-categories-grid {
    grid-template-columns: repeat(8, 1fr);
    gap: 1rem;
  }
  
  .category-item {
    padding: 0.75rem;
  }
}

/* 當只有一行內容時，減少上方間距 */
.search-categories-grid:has(> :nth-child(-n+8):last-child) {
  margin-top: -0.5rem;
}

@media (max-width: 767px) {
  .search-categories-grid:has(> :nth-child(-n+4):last-child) {
    margin-top: -0.5rem;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .search-categories-grid:has(> :nth-child(-n+6):last-child) {
    margin-top: -0.5rem;
  }
}
/* 修復圖標填充問題 - 讓圖標完全填滿正方形外框 */

/* 移除內邊距，讓圖標容器佔滿整個項目 */
.category-item {
  padding: 0 !important;
}

/* 圖標容器填滿整個正方形 */
.category-icon {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 0;
  margin: 0;
}

/* 圖片完全填滿容器 */
.category-icon img {
  width: 100% !important;
  height: 100% !important;
  max-width: 100%;
  max-height: 100%;
  object-fit: cover !important; /* 改為cover讓圖片填滿 */
  border-radius: 12px; /* 保持圓角與外框一致 */
}

/* 自定義圖標也要填滿 */
.category-item.custom-icon .category-custom-icon {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
}

.category-item.custom-icon .category-custom-icon img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  border-radius: 12px;
}

/* 響應式調整 - 移除所有內邊距 */
@media (max-width: 767px) {
  .category-item {
    padding: 0 !important;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .category-item {
    padding: 0 !important;
  }
}

@media (min-width: 1024px) {
  .category-item {
    padding: 0 !important;
  }
}
/* 動態調整分類區域高度 - 根據內容自動縮放，最多三行 */

.search-categories {
  /* 移除固定高度，讓高度自動適應內容 */
  min-height: auto;
  max-height: none;
}

.search-categories-grid {
  /* 自動行數，但限制最多3行 */
  grid-auto-rows: 1fr;
  max-height: none;
}

/* 電腦版: 8列，最多3行 = 24項 */
@media (min-width: 1024px) {
  .search-categories-grid {
    /* 如果內容少於8個，高度自動縮小 */
    /* 如果內容在9-16個，顯示2行 */
    /* 如果內容在17-24個，顯示3行 */
    grid-template-rows: repeat(auto-fill, 1fr);
  }
  
  /* 限制最大高度為3行 */
  .search-categories-grid {
    max-height: calc((122px + 1rem) * 3 - 1rem);
  }
}

/* 平板版: 6列，最多3行 = 18項 */
@media (min-width: 768px) and (max-width: 1023px) {
  .search-categories-grid {
    grid-template-rows: repeat(auto-fill, 1fr);
  }
  
  /* 限制最大高度為3行 */
  .search-categories-grid {
    max-height: calc((122px + 0.75rem) * 3 - 0.75rem);
  }
}

/* 手機版: 4列，最多6行（因為手機屏幕較長）= 24項 */
@media (max-width: 767px) {
  .search-categories-grid {
    grid-template-rows: repeat(auto-fill, 1fr);
  }
  
  /* 手機版允許更多行 */
  .search-categories-grid {
    max-height: calc((122px + 0.5rem) * 6 - 0.5rem);
  }
}

/* 當內容少於一整行時，減少上下邊距 */
.search-categories:has(.search-categories-grid > :nth-child(-n+8):last-child) {
  padding-bottom: 1rem;
}

.search-categories:has(.search-categories-grid > :nth-child(-n+4):last-child) {
  padding-bottom: 0.75rem;
}

/* 確保整個區域能夠根據內容調整 */
.search-categories {
  transition: all 0.3s ease;
}

.search-categories-grid {
  transition: max-height 0.3s ease;
}
/* 修復網格行數 - 使用auto-rows讓網格根據內容自動調整 */

.search-categories-grid {
  /* 移除固定的grid-template-rows，改用grid-auto-rows */
  grid-template-rows: none !important;
  grid-auto-rows: 122px !important; /* 每行固定122px高度 */
}

/* 電腦版: 確保最多3行 */
@media (min-width: 1024px) {
  .search-categories-grid {
    grid-template-rows: none !important;
    grid-auto-rows: 122px !important;
    max-height: calc(122px * 3 + 1rem * 2) !important;
  }
}

/* 平板版: 確保最多3行 */
@media (min-width: 768px) and (max-width: 1023px) {
  .search-categories-grid {
    grid-template-rows: none !important;
    grid-auto-rows: 122px !important;
    max-height: calc(122px * 3 + 0.75rem * 2) !important;
  }
}

/* 手機版: 允許更多行 */
@media (max-width: 767px) {
  .search-categories-grid {
    grid-template-rows: none !important;
    grid-auto-rows: 122px !important;
    max-height: calc(122px * 6 + 0.5rem * 5) !important;
  }
}
/* ============================================================
   Mobile Grid Spacing Verification
   確保手機版本的左右間距與上下間距完全相同
   ============================================================ */

/* 手機版: 4列 × 最多6行 */
@media (max-width: 767px) {
  .search-categories-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem; /* 統一間距: 上下左右都是 0.5rem (8px) */
  }
  
  .category-item {
    padding: 0 !important;
    aspect-ratio: 1 / 1; /* 保持正方形 */
  }
  
  /* 移除可能影響間距的負邊距 */
  .search-categories-grid {
    margin: 0 !important;
  }
  
  /* 確保容器沒有額外padding影響間距視覺效果 */
  .search-categories {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}
/* ============================================================
   手機版正方形修復 - 確保圖標外框是完美正方形
   ============================================================ */

@media (max-width: 767px) {
  /* 修復: 強制每個項目保持正方形 */
  .category-item {
    aspect-ratio: 1 / 1 !important;
    width: 100% !important;
    height: auto !important;
    padding: 0 !important;
  }
  
  /* 確保網格項目高度自動根據寬度調整 */
  .search-categories-grid {
    grid-template-columns: repeat(4, 1fr) !important;
    grid-auto-rows: auto !important; /* 改為auto讓高度跟隨寬度 */
    gap: 0.5rem !important;
  }
  
  /* 圖標容器保持正方形 */
  .category-icon {
    width: 100% !important;
    height: 100% !important;
    aspect-ratio: 1 / 1 !important;
  }
  
  /* 圖片填滿正方形容器 */
  .category-icon img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
  }
}

/* ============================================================
   RESULT CARDS - 第五欄位稅則編號卡片 (Responsive Design)
   Created: 2025-10-09
   Description: 響應式稅則編號搜尋結果卡片設計
   ============================================================ */

/* 結果網格容器 */
.search-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  padding: 1rem 0;
  width: 100%;
}

/* 單張結果卡片 */
.result-card {
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  padding: 1.25rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  min-height: 200px;
}

.result-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(79, 70, 229, 0.15);
  border-color: #818cf8;
  background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
}

.result-card:active {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(79, 70, 229, 0.1);
}

/* 卡片標題區 */
.result-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid #f3f4f6;
  gap: 0.75rem;
}

/* 稅則編號 */
/* 稅則編號和中文貨名同行容器 */
.result-card-code-name {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  flex: 1;
  overflow: hidden;
}

.result-card-code-name .code {
  font-size: 1.25rem;
  font-weight: 700;
  color: #4f46e5;
  letter-spacing: 0.025em;
  line-height: 1.2;
  flex-shrink: 0;
  white-space: nowrap;
}

.result-card-code-name .name-zh {
  font-size: 1rem;
  font-weight: 600;
  color: #111827;
  line-height: 1.5;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.result-card-code {
  font-size: 1.25rem;
  font-weight: 700;
  color: #4f46e5;
  letter-spacing: 0.025em;
  line-height: 1.2;
  flex-shrink: 0;
}

/* 章節標籤 */
.result-card-chapter {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.375rem 0.625rem;
  background: linear-gradient(135deg, #dbeafe 0%, #e0e7ff 100%);
  color: #1e40af;
  border-radius: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60%;
  line-height: 1.2;
}

/* 卡片內容區 */
.result-card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  margin-bottom: 1rem;
}

/* 中文名稱 */
.result-card-name-zh {
  font-size: 1rem;
  font-weight: 600;
  color: #111827;
  line-height: 1.5;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* 中文貨名解釋 */
.result-card-explain {
  font-size: 0.8rem;
  color: #9ca3af;
  line-height: 1.4;
  margin-top: 4px;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* 英文名稱 */
.result-card-name-en {
  font-size: 0.875rem;
  color: #6b7280;
  line-height: 1.5;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* 卡片底部區 */
.result-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 0.75rem;
  border-top: 1px solid #e5e7eb;
  margin-top: auto;
}

/* 稅率顯示 */
.result-card-rate {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #059669;
  background: #d1fae5;
  padding: 0.375rem 0.75rem;
  border-radius: 6px;
}

.result-card-rate i {
  font-size: 0.875rem;
  color: #047857;
}

/* ============================================================
   平板版 (Tablet) - 768px ~ 1023px
   ============================================================ */

@media (min-width: 768px) and (max-width: 1023px) {
  .search-results-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
  }
  
  .result-card {
    padding: 1rem;
    min-height: 180px;
  }
  
  .result-card-code {
    font-size: 1.125rem;
  }
  
  .result-card-chapter {
    font-size: 0.6875rem;
    padding: 0.3125rem 0.5rem;
    max-width: 55%;
  }
  
  .result-card-name-zh {
    font-size: 0.9375rem;
  }
  
  .result-card-name-en {
    font-size: 0.8125rem;
  }
  
  .result-card-rate {
    font-size: 0.8125rem;
    padding: 0.3125rem 0.625rem;
  }

  /* 平板版: 稅則編號和中文貨名同行容器 */
  .result-card-code-name .code {
    font-size: 1.125rem;
  }

  .result-card-code-name .name-zh {
    font-size: 0.9375rem;
  }
}

/* ============================================================
   手機版 (Mobile) - 最大 767px
   ============================================================ */

@media (max-width: 767px) {
  .search-results-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
    padding: 0.75rem 0;
  }
  
  .result-card {
    padding: 1rem;
    border-radius: 10px;
    min-height: 160px;
  }
  
  .result-card-header {
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.625rem;
  }
  
  .result-card-code {
    font-size: 1.125rem;
  }
  
  .result-card-chapter {
    font-size: 0.6875rem;
    padding: 0.3125rem 0.5rem;
    max-width: 100%;
    align-self: flex-start;
  }
  
  .result-card-body {
    gap: 0.5rem;
    margin-bottom: 0.75rem;
  }
  
  .result-card-name-zh {
    font-size: 0.9375rem;
  }
  
  .result-card-name-en {
    font-size: 0.8125rem;
  }
  
  .result-card-footer {
    padding-top: 0.625rem;

  /* 手機版: 稅則編號和中文貨名同行容器 */
  .result-card-code-name {
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
  }

  .result-card-code-name .code {
    font-size: 1rem;
  }

  .result-card-code-name .name-zh {
    font-size: 0.9375rem;
    white-space: normal;
  }
  }
  
  .result-card-rate {
    font-size: 0.8125rem;
    padding: 0.3125rem 0.625rem;
  }
  
  .result-card-rate i {
    font-size: 0.8125rem;
  }
}

/* ============================================================
   大螢幕優化 (Desktop) - 1440px 以上
   ============================================================ */

@media (min-width: 1440px) {
  .search-results-grid {
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
  }
  
  .result-card {
    padding: 1.5rem;
    min-height: 220px;
  }
  
  .result-card-code {
    font-size: 1.375rem;
  }
  
  .result-card-chapter {
    font-size: 0.8125rem;
    padding: 0.4375rem 0.75rem;
  }
  
  .result-card-name-zh {
    font-size: 1.0625rem;
  }
  
  .result-card-name-en {
    font-size: 0.9375rem;
  }
  
  .result-card-rate {
    font-size: 0.9375rem;
    padding: 0.4375rem 0.875rem;
  }
}

/* ============================================================
   載入動畫 (Loading Animation)
   ============================================================ */

@keyframes cardFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.result-card {
  animation: cardFadeIn 0.4s ease-out;
}

/* 漸進式載入動畫 (依序淡入) */
.result-card:nth-child(1) { animation-delay: 0.05s; }
.result-card:nth-child(2) { animation-delay: 0.1s; }
.result-card:nth-child(3) { animation-delay: 0.15s; }
.result-card:nth-child(4) { animation-delay: 0.2s; }
.result-card:nth-child(5) { animation-delay: 0.25s; }
.result-card:nth-child(6) { animation-delay: 0.3s; }

/* ============================================================
   空狀態優化 (Empty State Enhanced)
   ============================================================ */

.search-results-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  text-align: center;
  min-height: 300px;
}

.search-empty-icon {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.search-empty-icon i {
  font-size: 2rem;
  color: #9ca3af;
}

.search-empty-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.5rem;
}

.search-empty-text {
  font-size: 0.9375rem;
  color: #6b7280;
  max-width: 400px;
}

/* 手機版空狀態 */
@media (max-width: 767px) {
  .search-results-empty {
    padding: 3rem 1.5rem;
    min-height: 250px;
  }
  
  .search-empty-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 1rem;
  }
  
  .search-empty-icon i {
    font-size: 1.5rem;
  }
  
  .search-empty-title {
    font-size: 1.125rem;
  }
  
  .search-empty-text {
    font-size: 0.875rem;
  }
}

/* ============================================================
   Print Styles (列印樣式)
   ============================================================ */

@media print {
  .result-card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #d1d5db;
    margin-bottom: 1rem;
  }
  
  .result-card:hover {
    transform: none;
    box-shadow: none;
  }
}
/* ============================================================
   Category Grid Pagination (Unique Class Names)
   ============================================================ */

.category-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 1.5rem;
  padding: 1rem 0;
  border-top: 1px solid #e5e7eb;
}

.category-pagination-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  border-radius: 8px;
  color: #ffffff;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(102, 126, 234, 0.2);
}

.category-pagination-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.category-pagination-btn:active:not(:disabled) {
  transform: translateY(0);
}

.category-pagination-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: #9ca3af;
  box-shadow: none;
}

.category-pagination-btn i {
  font-size: 0.75rem;
}

.category-pagination-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.category-pagination-info {
  font-size: 0.875rem;
  color: #6b7280;
  font-weight: 500;
}

.category-pagination-pages {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.category-pagination-pages button {
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.5rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #ffffff;
  color: #374151;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.category-pagination-pages button:hover {
  border-color: #667eea;
  color: #667eea;
  background: #f3f4f6;
}

.category-pagination-pages button.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #ffffff;
  border-color: #667eea;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .category-pagination {
    flex-direction: column;
    gap: 1rem;
  }
  
  .category-pagination-btn .btn-text {
    display: none;
  }
  
  .category-pagination-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    justify-content: center;
  }
  
  .category-pagination-center {
    width: 100%;
  }
  
  .category-pagination-pages {
    flex-wrap: wrap;
    justify-content: center;
  }
}

/* 預報輸入區域 */
.search-result-card-forecast {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #e5e7eb;
}

.search-result-card-forecast-input {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.search-result-card-forecast-input input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.875rem;
  transition: all 0.2s;
}

.search-result-card-forecast-input input:focus {
  outline: none;
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.search-result-card-forecast-btn {
  padding: 0.5rem 1rem;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.search-result-card-forecast-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.search-result-card-forecast-btn:active {
  transform: translateY(0);
}

.search-result-card-forecast-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.search-result-card-forecast-success {
  color: #059669;
  font-size: 0.8125rem;
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.search-result-card-forecast-error {
  color: #dc2626;
  font-size: 0.8125rem;
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* 愛心圖示 */
.search-result-card-favorite {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s;
  z-index: 5;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.search-result-card-favorite:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.search-result-card-favorite i {
  font-size: 1.25rem;
  color: #d1d5db;
  transition: all 0.3s;
}

.search-result-card-favorite.is-favorited i {
  color: #ef4444;
  animation: heartBeat 0.3s ease;
}

.search-result-card-favorite:hover i {
  color: #ef4444;
}

@keyframes heartBeat {
  0% { transform: scale(1); }
  25% { transform: scale(1.3); }
  50% { transform: scale(1.1); }
  75% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* 確保卡片有相對定位 */
.search-result-card {
  position: relative;
}

/* 輸入規定顯示 */

/* 輸入規定顯示 - 更新版 */
.search-result-card-meta {
  display: flex;
  gap: 0.75rem;
  font-size: 0.8125rem;
  color: #6b7280;
  padding-top: 0.75rem;
  border-top: 1px solid #e5e7eb;
  justify-content: space-between;
  align-items: center;
}

.search-result-card-import-code {  font-size: 0.8125rem;  color: white;  cursor: help;  position: relative;  padding: 0.375rem 0.75rem;  background: linear-gradient(135deg, #ef4444 0%, #dc2626 50%, #b91c1c 100%);  border-radius: 6px;  transition: all 0.2s;  font-weight: 500;  box-shadow: 0 2px 4px rgba(239, 68, 68, 0.2);  margin-left: auto;  z-index: 10;}.search-result-card-import-code:hover {  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 50%, #991b1b 100%);  box-shadow: 0 4px 8px rgba(239, 68, 68, 0.3);  transform: translateY(-1px);}

.search-result-card-import-code:hover {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 50%, #991b1b 100%);
  box-shadow: 0 4px 8px rgba(239, 68, 68, 0.3);
  transform: translateY(-1px);
}

/* Tooltip 小視窗 */
.import-code-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  min-width: 280px;
  max-width: 400px;
  padding: 1.25rem;
  background: #1f2937;
  color: white;
  border-radius: 4px;
  font-size: 0.875rem;
  line-height: 1.6;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  z-index: 100;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  white-space: normal;
  word-wrap: break-word;
}

.import-code-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  right: 16px;
  border: 7px solid transparent;
  border-top-color: #1f2937;
}

.search-result-card-import-code:hover .import-code-tooltip {
  opacity: 1;
  transform: translateY(0);
}

.import-code-tooltip-item {
  margin-bottom: 0.75rem;
}

.import-code-tooltip-item:last-child {
  margin-bottom: 0;
}

.import-code-tooltip-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: #fca5a5;
  font-size: 0.9375rem;
}

.import-code-tooltip-content {
  color: #e5e7eb;
  font-size: 0.875rem;
}

/* 無規定標籤 - 綠色漸變 */
.search-result-card-no-regulation {
  font-size: 0.8125rem;
  color: white;
  padding: 0.375rem 0.75rem;
  background: linear-gradient(135deg, #10b981 0%, #059669 50%, #047857 100%);
  border-radius: 6px;
  font-weight: 500;
  box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
  margin-left: auto;
}

/* ========================================
   過濾提示橫幅 - 顯示在統計區域
   ======================================== */
.filter-stats-banner {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 20px;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
  animation: slideInDown 0.4s ease-out;
}

.filter-stats-content {
  display: flex;
  align-items: center;
  gap: 12px;
  color: white;
}

.filter-stats-content i {
  font-size: 1.25rem;
  color: #dbeafe;
}

.filter-stats-content span {
  font-size: 0.95rem;
  line-height: 1.5;
}

.filter-stats-content strong {
  color: #fef08a;
  font-weight: 600;
}

@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 響應式 */
@media (max-width: 768px) {
  .filter-stats-banner {
    padding: 12px 16px;
    margin-bottom: 16px;
  }

  .filter-stats-content {
    gap: 8px;
  }

  .filter-stats-content span {
    font-size: 0.875rem;
  }

  .filter-stats-content i {
    font-size: 1.1rem;
  }
}

/* ============================================================
   愛心收藏 Active 狀態樣式
   ============================================================ */

/* Active 狀態 - 已收藏 */
.search-result-card-favorite.active {
  background: rgba(239, 68, 68, 0.1);
}

.search-result-card-favorite.active i {
  color: #ef4444;
  animation: heartBeat 0.3s ease-in-out;
}

.search-result-card-favorite.active:hover {
  background: rgba(239, 68, 68, 0.15);
}

.search-result-card-favorite.active:hover i {
  color: #dc2626;
}

/* 愛心跳動動畫 */
@keyframes heartBeat {
  0%, 100% {
    transform: scale(1);
  }
  25% {
    transform: scale(1.3);
  }
  50% {
    transform: scale(1.1);
  }
  75% {
    transform: scale(1.2);
  }
}

/* 點擊時的反饋動畫 */
.search-result-card-favorite:active {
  transform: scale(0.95);
}


/* ============================================================
   手機版搜尋框響應式優化 (2025-10-11)
   ============================================================ */

@media (max-width: 768px) {
  /* 搜尋表單容器 */
  .search-form {
    width: 100%;
    margin: 0;
  }
  
  /* 搜尋輸入組 - Flexbox佈局優化 */
  .search-input-group {
    display: flex !important;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 0.75rem;
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    transition: all 0.3s ease;
    position: relative;
    width: 100%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  }
  
  /* 獲得焦點時的樣式強化 */
  .search-input-group:focus-within {
    border-color: #6366f1;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
    background: #ffffff;
  }
  
  /* 搜尋圖標 - 固定不壓縮 */
  .search-input-icon {
    color: #9ca3af;
    font-size: 1rem;
    flex-shrink: 0;
  }
  
  /* 輸入框 - 自動擴展填滿剩餘空間 */
  .search-input {
    flex: 1 1 auto;
    min-width: 0;
    border: none;
    background: transparent;
    font-size: 1rem;
    color: #111827;
    outline: none;
    padding: 0.375rem 0;
  }
  
  .search-input::placeholder {
    color: #9ca3af;
    font-size: 0.9375rem;
  }
  
  /* 清除按鈕優化 */
  .search-input-clear {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    background: #f3f4f6;
    border: none;
    border-radius: 50%;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
  }
  
  .search-input-clear:active {
    background: #e5e7eb;
    transform: scale(0.95);
  }
  
  /* Search提交按鈕 - 固定寬度不壓縮 */
  .search-input-submit {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.625rem 1rem;
    min-width: 90px;
    flex-shrink: 0;  /* 關鍵: 防止按鈕被壓縮 */
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9375rem;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
  }
  
  /* 按鈕觸控回饋 */
  .search-input-submit:active {
    background: linear-gradient(135deg, #4338ca 0%, #3730a3 100%);
    box-shadow: 0 1px 4px rgba(99, 102, 241, 0.3);
    transform: scale(0.98);
  }
  
  /* 按鈕文字 */
  .search-input-submit span {
    display: inline;
  }
  
  /* 自動完成建議框 */
  .search-suggestions {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    right: 0;
    width: 100%;
    margin-top: 0;
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    max-height: 280px;
    overflow-y: auto;
    z-index: 1000;
  }
  
  /* 建議項目 - 觸控友好 */
  .suggestion-item {
    padding: 0.875rem 1rem;
    font-size: 0.9375rem;
    border-bottom: 1px solid #f3f4f6;
    cursor: pointer;
    transition: background 0.15s;
  }
  
  .suggestion-item:active {
    background: #f9fafb;
  }
  
  .suggestion-item:last-child {
    border-bottom: none;
  }
}

/* 極小螢幕優化 (< 375px) - iPhone SE等小螢幕 */
@media (max-width: 374px) {
  /* 極小螢幕隱藏按鈕文字，只保留圖標 */
  .search-input-submit span {
    display: none;
  }
  
  .search-input-submit {
    min-width: 44px;  /* iOS最小觸控尺寸 */
    padding: 0.625rem;
  }
  
  .search-input-group {
    gap: 0.375rem;
    padding: 0.5rem;
  }
}

/* ============================================================
   輸入規定 Tooltip 樣式 (2025-10-11)
   ============================================================ */

/* 輸入規定容器 - 添加 cursor pointer */
.search-result-card-import-code.regulation-trigger {
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.search-result-card-import-code.regulation-trigger:hover {
    background: #fee2e2;
    transform: scale(1.02);
}

/* 資訊圖標 */
.regulation-info-icon {
    margin-left: 0.375rem;
    font-size: 0.75rem;
    color: #dc2626;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.search-result-card-import-code.regulation-trigger:hover .regulation-info-icon {
    opacity: 1;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

/* Tooltip 容器 */
.regulation-tooltip {
    position: fixed;
    z-index: 9999;
    max-width: 400px;
    min-width: 200px;
    background: #ffffff;
    border: 2px solid #dc2626;
    border-radius: 10px;
    box-shadow: 0 12px 28px rgba(220, 38, 38, 0.2), 
                0 8px 16px rgba(0, 0, 0, 0.12);
    padding: 0;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: none;
    display: none;
}

.regulation-tooltip.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* Tooltip 內容 */
.tooltip-content {
    padding: 1rem 1.25rem;
    font-size: 0.875rem;
    line-height: 1.7;
    color: #1f2937;
    max-height: 300px;
    overflow-y: auto;
    font-weight: 400;
}

.tooltip-content::-webkit-scrollbar {
    width: 6px;
}

.tooltip-content::-webkit-scrollbar-track {
    background: #f9fafb;
    border-radius: 3px;
}

.tooltip-content::-webkit-scrollbar-thumb {
    background: #dc2626;
    border-radius: 3px;
}

.tooltip-content::-webkit-scrollbar-thumb:hover {
    background: #b91c1c;
}

/* Tooltip 箭頭 */
.tooltip-arrow {
    position: absolute;
    width: 14px;
    height: 14px;
    background: #ffffff;
    border: 2px solid #dc2626;
    transform: rotate(45deg);
}

/* 箭頭位置 - 底部（tooltip在上方時） */
.tooltip-arrow.bottom {
    bottom: -8px;
    left: 50%;
    margin-left: -7px;
    border-right: none;
    border-top: none;
}

/* 箭頭位置 - 頂部（tooltip在下方時） */
.tooltip-arrow.top {
    top: -8px;
    left: 50%;
    margin-left: -7px;
    border-left: none;
    border-bottom: none;
}

/* 響應式設計 - 移動裝置 */
@media (max-width: 768px) {
    .regulation-tooltip {
        max-width: calc(100vw - 40px);
        left: 20px !important;
        right: 20px !important;
    }
    
    .tooltip-content {
        font-size: 0.8125rem;
        padding: 0.875rem 1rem;
        max-height: 200px;
    }
    
    .regulation-info-icon {
        font-size: 0.875rem;
    }
}

/* 規定項目樣式 */
.regulation-item {
    margin-bottom: 1rem;
    padding-bottom: 0.875rem;
    border-bottom: 1px solid #fee2e2;
}

.regulation-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.regulation-code {
    display: inline-block;
    padding: 0.25rem 0.625rem;
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    color: white;
    font-size: 0.8125rem;
    font-weight: 600;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(220, 38, 38, 0.2);
}

.regulation-desc {
    margin: 0;
    padding: 0;
    font-size: 0.875rem;
    line-height: 1.7;
    color: #374151;
    text-align: justify;
}

/* ========================================
   預報成功通知樣式增強
   ======================================== */

.forecast-message {
  display: none;
  margin-top: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  align-items: center;
  gap: 0.5rem;
  animation: slideInDown 0.3s ease-out;
}

@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.search-result-card-forecast-success {
  background-color: #d1fae5;
  color: #065f46;
  border-left: 4px solid #059669;
}

.search-result-card-forecast-success i {
  color: #059669;
  font-size: 1rem;
}

.search-result-card-forecast-error {
  background-color: #fee2e2;
  color: #991b1b;
  border-left: 4px solid #dc2626;
}

.search-result-card-forecast-error i {
  color: #dc2626;
  font-size: 1rem;
}

/* ========================================
   預報輸入區域樣式 (Forecast Input Styles)
   ======================================== */

.result-card-forecast {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.forecast-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.1), transparent);
    margin-bottom: 12px;
}

.forecast-input-group {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.forecast-tracking-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s ease;
    outline: none;
}

.forecast-tracking-input:focus {
    border-color: #4CAF50;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

.forecast-tracking-input::placeholder {
    color: #999;
}

.forecast-submit-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.forecast-submit-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #45a049, #3d8b40);
    box-shadow: 0 4px 8px rgba(76, 175, 80, 0.3);
    transform: translateY(-1px);
}

.forecast-submit-btn:active:not(:disabled) {
    transform: translateY(0);
}

.forecast-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.forecast-submit-btn i {
    font-size: 14px;
}

.forecast-message {
    margin-top: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.forecast-message-success {
    background: #e8f5e9;
    color: #2e7d32;
    border-left: 4px solid #4CAF50;
}

.forecast-message-error {
    background: #ffebee;
    color: #c62828;
    border-left: 4px solid #f44336;
}

.forecast-message-warning {
    background: #fff3e0;
    color: #ef6c00;
    border-left: 4px solid #ff9800;
}

/* 手機響應式調整 */
@media (max-width: 768px) {
    .forecast-input-group {
        flex-direction: column;
    }
    
    .forecast-tracking-input {
        width: 100%;
    }
    
    .forecast-submit-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Import Regulation Styles */
.result-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.result-card-import {
    position: relative;
    z-index: 100;
    cursor: help;
    padding: 4px 8px;
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    border-radius: 4px;
    font-size: 12px;
    color: #1976d2;
    font-weight: 500;
    transition: all 0.2s ease;
}

.result-card-import:hover {
    background: linear-gradient(135deg, #bbdefb, #90caf9);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.result-card-import span {
    white-space: nowrap;
}

/* Import Regulation Tooltip */
.import-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    min-width: 300px;
    max-width: 400px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 12px;
    z-index: 1000;
    display: none;
    animation: tooltipFadeIn 0.2s ease;
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-card-import:hover .import-tooltip {
    display: block;
}

.import-tooltip::before {
    content: '';
    position: absolute;
    bottom: -6px;
    right: 20px;
    width: 12px;
    height: 12px;
    background: white;
    border-right: 1px solid #e0e0e0;
    border-bottom: 1px solid #e0e0e0;
    transform: rotate(45deg);
}

.import-tooltip-item {
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f0f0f0;
}

.import-tooltip-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.import-tooltip-code {
    display: inline-block;
    padding: 2px 6px;
    background: #e3f2fd;
    color: #1976d2;
    border-radius: 3px;
    font-weight: 600;
    font-size: 11px;
    margin-bottom: 4px;
}

.import-tooltip-desc {
    font-size: 12px;
    line-height: 1.5;
    color: #424242;
}

.import-tooltip-loading {
    text-align: center;
    color: #9e9e9e;
    font-size: 12px;
    padding: 8px;
}

/* ==================== 收藏功能樣式 ==================== */

/* 愛心圖標 */
.result-card-favorite {
    position: absolute;
    top: 12px;
    right: 12px;
    cursor: pointer;
    font-size: 24px;
    color: #e0e0e0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 1;
    -webkit-tap-highlight-color: transparent;
}

/* 未收藏狀態 */
.result-card-favorite.not-favorited {
    color: #e0e0e0;
}

.result-card-favorite.not-favorited:hover {
    color: #ff4081;
    transform: scale(1.2);
}

/* 已收藏狀態 */
.result-card-favorite.favorited {
    color: #ff4081;
}

.result-card-favorite.favorited:hover {
    transform: scale(1.2);
    filter: brightness(1.2);
}

/* 載入中狀態 */
.result-card-favorite.loading {
    opacity: 0.5;
    pointer-events: none;
    animation: favoritePulse 1s infinite;
}

@keyframes favoritePulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 0.8; }
}

/* 心跳動畫 */
@keyframes heartBeat {
    0%, 100% { transform: scale(1); }
    25% { transform: scale(1.3); }
    50% { transform: scale(0.9); }
    75% { transform: scale(1.1); }
}

.result-card-favorite.favorited.animating {
    animation: heartBeat 0.6s ease;
}

/* Toast 提示訊息 */
.favorite-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
}

.favorite-toast.show {
    opacity: 1;
    transform: translateX(0);
}

/* Toast 類型顏色 */
.favorite-toast-success {
    background: #4caf50;
    color: white;
}

.favorite-toast-error {
    background: #f44336;
    color: white;
}

.favorite-toast-warning {
    background: #ff9800;
    color: white;
}

.favorite-toast-info {
    background: #2196f3;
    color: white;
}

/* 確保卡片定位正確 */
.result-card {
    position: relative;
}

/* 響應式設計 - 手機版 */
@media (max-width: 768px) {
    .result-card-favorite {
        font-size: 20px;
        top: 10px;
        right: 10px;
    }
    
    .favorite-toast {
        right: 10px;
        top: 10px;
        max-width: calc(100% - 20px);
    }
}

/* 平板版 */
@media (min-width: 769px) and (max-width: 1024px) {
    .result-card-favorite {
        font-size: 22px;
    }
}

/* 防止與其他元素重疊 */
.result-card-header {
    position: relative;
    padding-right: 48px; /* 為愛心預留空間 */
}


/* 手機版 - 搜索結果標題換行顯示篩選器 */
@media (max-width: 768px) {
    .search-results-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .search-results-sort {
        width: 100%;
    }
    
    .search-sort-select {
        width: 100%;
        max-width: none;
    }
}
