/* ---- 抽卡後台專用樣式（接在 style.css 之後）---- */

/* 篩選列 */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 10px 12px; margin-bottom: 14px;
}
.filter-bar .fb-q { flex: 1 1 220px; min-width: 160px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 7px; }
.filter-bar select { padding: 7px 10px; border: 1px solid var(--border); border-radius: 7px; background: #fff; }
.filter-bar .spacer { flex: 1; }
.filter-bar .fb-count { font-size: 13px; color: var(--muted); white-space: nowrap; }

/* 稀有度標籤：底色用該等級自己的顏色，一眼分得出來 */
.rarity-chip {
  display: inline-block; min-width: 42px; text-align: center;
  padding: 2px 9px; border-radius: 6px; font-size: 12px; font-weight: 700;
  color: #fff; background: var(--rc); box-shadow: inset 0 -2px 0 rgba(0,0,0,0.18);
}

/* 表格縮圖 */
.thumb { width: 40px; height: 56px; object-fit: cover; border-radius: 5px; background: #eef2f5; display: block; }
.empty-thumb {
  width: 40px; height: 56px; border-radius: 5px; background: #eef2f5; color: var(--muted);
  font-size: 11px; display: flex; align-items: center; justify-content: center;
}

/* 卡片圖庫檢視 */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.card-tile {
  background: var(--card); border-radius: 10px; box-shadow: var(--shadow); overflow: hidden;
  cursor: pointer; border: 2px solid transparent; transition: transform .12s, border-color .12s;
}
.card-tile:hover { transform: translateY(-2px); border-color: var(--primary); }
.card-tile .pic { width: 100%; aspect-ratio: 400/560; object-fit: cover; background: #e9edf2; display: block; }
.card-tile .pic.none { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 13px; }
.card-tile .meta { padding: 8px 10px; }
.card-tile .meta .nm { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-tile .meta .sub { font-size: 12px; color: var(--muted); margin-top: 3px; display: flex; gap: 6px; align-items: center; }
.card-tile.off { opacity: 0.45; }

/* 圖片上傳欄位 */
.img-picker { display: flex; gap: 12px; align-items: flex-start; }
.img-preview {
  width: 104px; height: 146px; border: 2px dashed var(--border); border-radius: 8px;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  background: #f7f9fb; color: var(--muted); font-size: 12px; text-align: center; flex-shrink: 0;
}
.img-preview.drag { border-color: var(--primary); background: var(--primary-light); }
.img-preview img { width: 100%; height: 100%; object-fit: cover; }
.img-actions { display: flex; flex-direction: column; gap: 6px; }

/* 媒體庫選擇器 */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; max-height: 60vh; overflow-y: auto; }
.media-item { cursor: pointer; border: 2px solid transparent; border-radius: 7px; overflow: hidden; background: #f2f5f8; }
.media-item:hover { border-color: var(--primary); }
.media-item img { width: 100%; height: 84px; object-fit: cover; display: block; }
.media-item span { display: block; font-size: 11px; padding: 3px 5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 長條圖 */
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 7px; font-size: 13px; }
.bar-label { width: 130px; flex-shrink: 0; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { flex: 1; height: 16px; background: #eef2f5; border-radius: 8px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 8px; transition: width .3s; }
.bar-value { width: 92px; text-align: right; flex-shrink: 0; font-variant-numeric: tabular-nums; }

/* 機率權重編輯列 */
.rate-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.rate-row .code { width: 70px; flex-shrink: 0; }
.rate-row input[type=range] { flex: 1; }
.rate-row input[type=number] { width: 92px; padding: 5px 8px; border: 1px solid var(--border); border-radius: 6px; }
.rate-row .pct { width: 78px; text-align: right; font-variant-numeric: tabular-nums; color: var(--primary-dark); font-weight: 600; }

/* 簽到獎勵表 */
.day-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.day-cell { background: #f7f9fb; border: 1px solid var(--border); border-radius: 8px; padding: 8px; text-align: center; }
.day-cell .d { font-size: 12px; color: var(--muted); }
.day-cell input { width: 100%; text-align: center; padding: 5px; border: 1px solid var(--border); border-radius: 6px; margin-top: 4px; }
.day-cell.week { border-color: var(--primary); background: var(--primary-light); }

/* Discord Embed 預覽 */
.embed-preview {
  background: #313338; color: #dbdee1; border-radius: 8px; padding: 14px 16px;
  border-left: 4px solid var(--rc, #5865f2); max-width: 440px; font-size: 14px;
}
.embed-preview .e-title { color: #fff; font-weight: 700; font-size: 15px; margin-bottom: 6px; }
.embed-preview .e-desc { color: #b9bbbe; margin-bottom: 10px; white-space: pre-wrap; }
.embed-preview .e-fields { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 10px; }
.embed-preview .e-f-name { font-size: 12px; color: #fff; font-weight: 600; }
.embed-preview .e-f-val { font-size: 13px; }
.embed-preview img.e-img { max-width: 100%; border-radius: 6px; margin-top: 4px; display: block; }
.embed-preview .e-foot { font-size: 11.5px; color: #949ba4; margin-top: 8px; }

/* 兩欄版面（表單 + 預覽） */
.split { display: grid; grid-template-columns: 1fr 300px; gap: 18px; align-items: start; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }

/* 寬版彈窗（卡片編輯要放預覽） */
.modal.wide { max-width: 760px; }

/* 玩家詳情的分頁 */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; flex-wrap: wrap; }
.tabs button {
  background: none; border: none; padding: 8px 14px; cursor: pointer; color: var(--muted);
  border-bottom: 2px solid transparent; font-size: 14px;
}
.tabs button.active { color: var(--primary-dark); border-bottom-color: var(--primary); font-weight: 600; }

.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12.5px; }
.pos { color: var(--ok); font-weight: 600; }
.neg { color: var(--danger); font-weight: 600; }

/* .field input 是 width:100%，勾選框會被拉成整行寬 —— 這裡把它拉回原本大小 */
.field label.switch { display: inline-flex; margin-bottom: 0; font-size: 14px; color: var(--text); }
.field .switch input[type=checkbox] { width: 16px; height: 16px; flex-shrink: 0; margin: 0; }
.field input[type=color] { padding: 2px; }

/* 統計數字放得下「實際 x%／理論 y%」而不換行 */
.bar-value { width: 168px; white-space: nowrap; font-size: 12.5px; }
@media (max-width: 700px) { .bar-label { width: 90px; } .bar-value { width: 110px; } }

/* 兩行以上的勾選框標籤，勾選框要對齊第一行而不是置中 */
.field label.switch { align-items: flex-start; }
.field .switch input[type=checkbox] { margin-top: 3px; }
