/* 武器頁面專屬樣式 - 升級為玻璃擬態風格 */

:root {
  --nav-height: 70px;
}



/* 摺疊篩選區 */
.accordion {
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  margin-bottom: 30px;
  overflow: hidden;
}

.accordion-header {
  padding: 15px 20px;
  color: var(--primary-blue);
  font-weight: bold;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.3s;
}

/* 道具明細 modal 標題區：圖示放在名稱左側，三個裝備頁面共用 */
.modal-item-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 20px;
}

.modal-item-header .hero-name {
  flex: 1;
  margin: 0;
}

.modal-item-icon-wrap {
  width: 50px;
  height: 50px;
  flex: 0 0 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(77, 163, 255, 0.45);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.18);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

.modal-item-icon {
  width: 50px;
  height: 50px;
  object-fit: contain;
}

.modal-item-icon-fallback {
  display: none;
  color: var(--text-muted);
  font-size: 12px;
}

.modal-item-icon-wrap.is-empty .modal-item-icon-fallback {
  display: block;
}

[data-theme="light"] .modal-item-icon-wrap {
  background: rgba(255, 255, 255, 0.8);
  border-color: rgba(0, 102, 204, 0.35);
}

@media (max-width: 768px) {
  .modal-item-icon-wrap {
    width: 50px;
    height: 50px;
    flex-basis: 50px;
  }

  .modal-item-icon {
    width: 50px;
    height: 50px;
  }
}

.accordion-header:hover {
  background: rgba(255, 255, 255, 0.05);
}

/* 🚀 修正：摺疊狀態的 CSS */
.accordion.collapsed .accordion-content {
  display: none;
}

.accordion.collapsed {
  margin-bottom: 20px;
}

.accordion-header::after {
  content: "▾";
  transition: transform 0.3s ease;
}

.accordion.collapsed .accordion-header::after {
  transform: rotate(-90deg);
}

.accordion-content {
  padding: 0 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px; /* 使用 gap 替代 <br>，排版更緊湊 */
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.filter-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
}

.filter-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1;
}

.filter-label {
  font-weight: bold;
  color: var(--text-muted);
  min-width: 80px;
  padding-top: 6px; /* 對齊按鈕高度 */
}

.filter-btn {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  border-radius: 8px;
  padding: 6px 14px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
}

.filter-btn:hover {
  background: rgba(77, 163, 255, 0.15);
  border-color: var(--primary-blue);
}

.filter-btn.active {
  background: linear-gradient(135deg, var(--primary-blue), var(--primary-dark));
  border-color: var(--primary-blue);
  box-shadow: 0 4px 12px rgba(77, 163, 255, 0.3);
  color: #fff !important;
}

.clear-btn {
  background: var(--tag-clear-bg);
  border: 1px solid var(--tag-clear-border);
  color: var(--highlight-yellow);
  border-radius: 8px;
  padding: 8px 16px;
  cursor: pointer;
  transition: all 0.2s;
}

.clear-btn:hover {
  background: var(--highlight-yellow);
  color: #000;
}

/* 搜尋高亮 */
.highlight, .highlight2 {
  background-color: rgba(255, 216, 107, 0.3);
  color: var(--highlight-yellow);
  font-weight: bold;
  border-radius: 4px;
  padding: 2px 4px;
}

/* 特殊說明連結 (keyword-link) */
.keyword-link {
  color: var(--primary-blue);
  cursor: pointer;
  border-bottom: 1px dashed var(--primary-blue);
  transition: all 0.2s ease;
  font-weight: 600;
  padding: 0 2px;
}

.keyword-link:hover {
  background: rgba(77, 163, 255, 0.15);
  border-bottom-style: solid;
  text-shadow: 0 0 10px rgba(77, 163, 255, 0.5);
  border-radius: 4px;
}

/* 表格樣式 */
#hero-table-container {
  width: 100% !important;
  max-width: 100% !important;
  background: transparent;
  border-radius: 20px;
  border: 1px solid var(--glass-border);
  overflow: visible; 
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  margin: 20px 0;
}

#heroes-table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100% !important;
  min-width: 100% !important;
  table-layout: fixed;
  word-wrap: break-word;
}

/* 設定各欄位寬度比例，避免錯位 */
#heroes-table th:nth-child(1) { width: 70px; }  /* 圖示 */
#heroes-table th:nth-child(2) { width: 15%; }  /* 名稱 */
#heroes-table th:nth-child(3) { width: 80px; }  /* 等級 */
#heroes-table th:nth-child(4) { width: 100px; } /* 攻擊 */
#heroes-table th:nth-child(5) { width: 100px; } /* 命中 */
#heroes-table th:nth-child(6) { width: 100px; } /* 耐用 */
#heroes-table th:nth-child(7) { width: auto; }  /* 說明 (剩餘寬度) */

thead th {
  position: sticky;
  top: 73px;
  z-index: 10;
  background: linear-gradient(180deg, var(--nav-bg-1), var(--nav-bg-2));
  backdrop-filter: blur(15px);
  color: var(--primary-blue);
  padding: 16px 10px;
  font-size: 13px;
  font-weight: 700;
  border-bottom: 1px solid rgba(77, 163, 255, 0.3);
  background-clip: padding-box; 
}

#hero-table-container table tr:first-child th:first-child { border-top-left-radius: 20px; }
#hero-table-container table tr:first-child th:last-child { border-top-right-radius: 20px; }

tbody td {
  padding: 12px 8px;
  text-align: center;
  border-bottom: 1px solid var(--border-separator);
  font-size: 12.5px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.03);
}

tbody tr:hover {
  background: rgba(77, 163, 255, 0.1) !important;
}

tbody tr:hover td {
  color: var(--text-main);
}

/* Modal 彈出視窗 */
#modalOverlay {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  z-index: 2000;
}

#modalBox {
  display: none;
  position: fixed;
  top: 55%; left: 50%;
  transform: translate(-50%, -50%);
  width: 88vw;
  max-width: 650px;
  max-height: 72vh;
  overflow-y: auto;
  z-index: 2001;
  background: linear-gradient(135deg, var(--nav-bg-1), var(--nav-bg-2));
  border: 1px solid var(--glass-border);
  border-radius: 28px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.2);
  color: var(--text-main);
  padding: 30px 20px;
  scrollbar-width: thin;
  scrollbar-color: var(--primary-blue) transparent;
}

/* 圖片容器置中 */
.hero-images {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 25px;
  width: 100%;
}

.hero-images img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
  transition: transform 0.3s ease;
}

.hero-images img:hover {
  transform: scale(1.02);
}

.hero-name {
  color: var(--primary-blue);
  font-size: 28px;
  font-weight: 800;
  border-bottom: 1px solid var(--border-separator);
  padding-bottom: 15px;
  margin-bottom: 25px;
  text-align: center;
}

.hero-details-container {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 15px;
}

.hero-column-base {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  padding: 18px;
  border-radius: 16px;
  box-sizing: border-box;
}

.hero-column {
  flex: 0 0 calc(50% - 10px);
}

.hero-column-details {
  flex: 0 0 100%;
  margin-top: 5px;
}

.hero-column-base p {
  margin: 8px 0;
  font-size: 15px;
  line-height: 1.4;
  color: var(--text-muted);
}

.hero-column-base p strong {
  color: var(--primary-blue);
  margin-right: 8px;
}

.modal-sub-title {
  color: var(--primary-blue);
  font-size: 1.1rem;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(77, 163, 255, 0.3);
  padding-bottom: 5px;
  display: inline-block;
}

.close-btn {
  position: absolute;
  top: 15px; right: 20px;
  font-size: 32px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.close-btn:hover {
  color: var(--primary-blue);
  transform: rotate(90deg);
}

[data-theme="light"] #modalBox {
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.18);
}

[data-theme="light"] .hero-images img {
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
}

/* 手機版卡片 */
#hero-card-container {
  display: none;
  flex-direction: column;
  gap: 15px;
  margin-top: 20px;
}

.card-item {
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 15px;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-separator);
  padding-bottom: 10px;
  margin-bottom: 10px;
}

.card-icon {
  width: 44px;
  height: 44px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  border: 1px solid var(--glass-border);
  object-fit: contain;
}

.card-title {
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--primary-blue);
  margin: 0;
}

.card-body p {
  margin: 4px 0;
  font-size: 14px;
  color: var(--text-muted);
}

.card-body strong {
  color: var(--primary-blue);
}

/* 手機版響應式修正 */
@media (max-width: 768px) {
  #heroes-table, #hero-table-container {
    display: none !important;
  }

  #hero-card-container {
    display: flex;
  }

  #modalBox {
    width: 95vw;
    padding: 20px 15px;
    top: 50%;
    max-height: 80vh;
  }

  .hero-column {
    flex: 1 1 100%;
  }

  #searchContainer {
    flex-direction: column;
    align-items: stretch;
  }

  #searchInput {
    max-width: none;
  }
}

/* --- 製作清單彈窗相關樣式 (用於 works.html) --- */
.production-category {
  margin-top: 20px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 15px;
}

.production-category h3 {
  color: var(--primary-blue);
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 8px;
  margin-bottom: 12px;
  font-size: 1.1rem;
}

.no-data {
  color: var(--text-muted);
  font-size: 14px;
  font-style: italic;
}

.modal-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 5px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  overflow: hidden;
}

.modal-table th, .modal-table td {
  padding: 10px 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.modal-table th {
  background: rgba(77, 163, 255, 0.1);
  color: var(--highlight-yellow);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.modal-table tr:last-child td {
  border-bottom: none;
}

.modal-table tr:hover td {
  background: rgba(255, 255, 255, 0.05);
}

.modal-link {
  color: var(--primary-blue);
  text-decoration: none;
  font-weight: 600;
  transition: 0.2s;
}

.modal-link:hover {
  color: var(--highlight-yellow);
  text-decoration: underline;
}

/* 英雄/裝備連結樣式 (複用 map.js 風格) */
.hero-link {
  color: var(--primary-blue);
  text-decoration: none;
  border-bottom: 1px dashed var(--primary-blue);
  transition: all 0.2s ease;
  display: inline-block;
  cursor: pointer;
}

.hero-link:hover {
  color: var(--highlight-yellow);
  border-bottom: 1px solid var(--highlight-yellow);
  transform: translateY(-1px);
}

.production-grouped-list {
  padding: 10px 5px;
}
