/*
 * Copyright (C) 2026 Yzapre
 * SPDX-License-Identifier: AGPL-3.0-or-later
 */

/* ── Finds Tracker page ──────────────────────────────── */
.ft-wrap {
  max-width: 980px;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* ── Toolbar: storage usage + backup export/import ───── */
.ft-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.ft-storage-note {
  font-size: 0.78rem;
  color: var(--muted);
}
.ft-storage-note.ft-storage-warn { color: #eba163; }
.ft-storage-note.ft-storage-danger { color: #ff9999; font-weight: 600; }
.ft-toolbar-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.ft-toolbar-btn {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 0.35rem 0.7rem;
  font-family: inherit;
  transition: background 0.1s;
  white-space: nowrap;
}
.ft-toolbar-btn:hover { background: var(--border); }

/* ── Category selector ───────────────────────────────── */
.ft-cat-bar {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.ft-cat-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.85rem;
  cursor: pointer;
  color: var(--text);
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s;
}
.ft-cat-btn:hover { background: var(--border); }
.ft-cat-btn.active {
  background: var(--cat-accent);
  border-color: var(--cat-accent);
  color: #111111;
  font-weight: 700;
}
.ft-cat-icon {
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.ft-cat-icon img {
  width: 100%; height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
}
.ft-cat-name { font-size: 0.88rem; white-space: nowrap; }
.ft-cat-count {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.05rem 0.45rem;
  color: var(--muted);
}
.ft-cat-btn.active .ft-cat-count {
  background: rgba(0, 0, 0, 0.15);
  color: #111111;
  border-color: rgba(0, 0, 0, 0.25);
}

/* ── Panel header ─────────────────────────────────────── */
.ft-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--cat-accent);
  margin-bottom: 0.9rem;
}
.ft-panel-head h2 { font-size: 1.2rem; margin-bottom: 0.15rem; }
.ft-rarity { font-size: 0.8rem; color: var(--muted); }
.ft-panel-head-right {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}
.ft-total { font-size: 0.8rem; color: var(--muted); white-space: nowrap; }
.ft-add-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.45rem 0.85rem;
  font-family: inherit;
  transition: background 0.1s;
  white-space: nowrap;
}
.ft-add-btn:hover { background: var(--border); }

/* ── Card grid ────────────────────────────────────────── */
.ft-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.85rem;
}
.ft-empty {
  grid-column: 1 / -1;
  font-size: 0.88rem;
  color: var(--muted);
  padding: 1.75rem 1rem;
  text-align: center;
  background: var(--panel);
  border: 1px dashed var(--border);
  border-radius: 8px;
}

.ft-card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: opacity 0.1s, box-shadow 0.1s;
}
.ft-card.dragging { opacity: 0.4; }
.ft-card.drag-over { box-shadow: 0 0 0 2px var(--text); }
.ft-card-image {
  aspect-ratio: 16 / 10;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.ft-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.ft-card-noimg {
  font-size: 0.78rem;
  color: var(--muted);
}
.ft-card-del,
.ft-card-edit {
  position: absolute;
  top: 0.4rem;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(255,255,255,0.25);
  color: #fff;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  z-index: 2;
  transition: background 0.1s;
}
.ft-card-del { right: 0.4rem; }
.ft-card-edit { left: 0.4rem; font-size: 0.85rem; }
.ft-card-del:hover { background: rgba(180,30,30,0.85); }
.ft-card-edit:hover { background: rgba(255,255,255,0.25); }
.ft-card-body {
  padding: 0.6rem 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
}
.ft-card-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  color: var(--muted);
}
.ft-card-depth {
  margin-left: auto;
  white-space: nowrap;
}
.ft-card-drag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 20px; height: 20px;
  border-radius: 4px;
  color: var(--muted);
  cursor: grab;
  font-size: 0.8rem;
  touch-action: none;
  user-select: none;
  transition: background 0.1s, color 0.1s;
}
.ft-card-drag:hover { background: var(--border); color: var(--text); }
.ft-card-drag:active { cursor: grabbing; }
.ft-card-notes {
  font-size: 0.85rem;
  color: var(--text);
  white-space: pre-wrap;
  line-height: 1.35;
}

/* ── Add-find modal ───────────────────────────────────── */
.ft-modal-box { max-width: 420px; }
.ft-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin: 0.75rem 0 0.25rem;
}
.ft-field { display: flex; flex-direction: column; gap: 0.3rem; }
.ft-field-row { display: flex; gap: 0.75rem; }
.ft-field-row .ft-field { flex: 1; }
.field-label { font-size: 0.78rem; color: var(--muted); }

.ft-form input[type="text"],
.ft-form input[type="number"],
.ft-form textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  padding: 0.4rem 0.55rem;
  font-size: 0.88rem;
  font-family: inherit;
  width: 100%;
}
.ft-form textarea { resize: vertical; min-height: 70px; }

.ft-upload {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: var(--bg);
  cursor: pointer;
  min-height: 110px;
  overflow: hidden;
  transition: border-color 0.1s;
}
.ft-upload:hover { border-color: var(--muted); }
.ft-upload-empty {
  font-size: 0.82rem;
  color: var(--muted);
  padding: 1rem;
  text-align: center;
}
#ft-upload-preview {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  display: block;
}
.ft-remove-image-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.78rem;
  padding: 0.2rem 0;
  font-family: inherit;
  align-self: flex-start;
}
.ft-remove-image-btn:hover { color: #ff9999; }

.modal-box h3 { margin-bottom: 0.25rem; }

/* ── Mobile ───────────────────────────────────────────── */
@media (max-width: 480px) {
  .ft-field-row { flex-direction: column; }
  .ft-panel-head { align-items: flex-start; }
}
