/* Styles spécifiques à la page d'admin des métadonnées : complète dex.css (variables,
   .app-header, .field, .btn, .grid, .tile, .gender-badge, .tab-bar déjà définis là-bas).
   Page interne non liée dans la nav, jamais déployée : elle partage le shell mobile
   (entête standard + tab-bar) avec le reste de l'app, mais garde sa propre mise en page
   interne (.dex-toolbar#toolbar, largeur de body en 1400px). */

body {
  max-width: 1400px;
  margin: 0 auto;
  display: block;
  padding-bottom: calc(62px + env(safe-area-inset-bottom));
}

.dex-toolbar#toolbar {
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 60px;
  z-index: 10;
}

.gender-ratio-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 16px 72px;
  max-width: 640px;
  margin: 0 auto;
  width: 100%;
}

.gender-ratio-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}

.gender-ratio-row img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  flex: 0 0 auto;
}

.gender-ratio-row-label {
  flex: 1;
  font-size: 12px;
  color: var(--text);
}

.gender-ratio-row select {
  min-width: 0;
  font-size: 11px;
  background: #1e1e1e;
  color: #eee;
  border: 1px solid #555;
  border-radius: 4px;
  padding: 3px 4px;
}

/* Picker-cards des 3 nouvelles pages "Dates" : des ancres, pas des boutons (navigation
   native vers une page distincte) — .picker-card (dex.css) ne réinitialise pas le
   soulignement par défaut des <a>, contrairement à .tab-bar-item. */
a.picker-card {
  text-decoration: none;
}

.admin-grid {
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  padding-bottom: 72px;
}

.admin-grid .tile {
  min-width: 0;
}

.tile.tile--tagged {
  border-color: #f1c40f;
}

.tile-controls {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
  cursor: default;
}

.tile-controls select,
.tile-controls input[type="text"] {
  width: 100%;
  min-width: 0;
  font-size: 11px;
  background: #1e1e1e;
  color: #eee;
  border: 1px solid #555;
  border-radius: 4px;
  padding: 3px 4px;
}

.tile-controls label.check {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #ccc;
}

.tile-dates {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 2px 0;
}

.tile-date-row {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
}

.tile-date-label {
  color: #999;
}

.tile-date-value {
  color: #ccc;
}

.tile-chip-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 3px;
}

.tile-chip-row-label {
  font-size: 10px;
  color: #999;
  margin-right: 2px;
}

.meta-chip {
  font-size: 10px;
  line-height: 1;
  padding: 4px 5px;
  border-radius: 4px;
  border: 1px solid #555;
  background: #1e1e1e;
  color: #ccc;
  cursor: pointer;
}

.meta-chip.active {
  background: #f1c40f;
  border-color: #f1c40f;
  color: #1e1e1e;
  font-weight: 600;
}

.tile-chip-row[data-kind="exclude"] .meta-chip.active {
  background: #e74c3c;
  border-color: #e74c3c;
  color: #fff;
}

/* État "auto" : ce que la logique automatique décide déjà sans surcharge admin (voir
   computeAutoIncluded). Style en liseré pour rester visuellement subordonné à .active
   (une vraie surcharge doit toujours dominer cet indicateur informatif). */
.meta-chip.auto {
  background: transparent;
  border-style: dashed;
  border-color: #f1c40f;
  color: #f1c40f;
}

.tile-chip-row[data-kind="exclude"] .meta-chip.auto {
  border-color: #e74c3c;
  color: #e74c3c;
}

.save-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(62px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: #1c1c1c;
  border-top: 1px solid #444;
  z-index: 10;
}

.save-status {
  font-size: 13px;
  color: #ccc;
}

.save-status.dirty {
  color: #f1c40f;
}

.save-status.error {
  color: #e74c3c;
}

/* --- Mode "Fonds d'écran" --- */

.background-admin-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 16px 72px;
  max-width: 640px;
  margin: 0 auto;
  width: 100%;
}

.bg-admin-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
}

.bg-admin-row:hover {
  border-color: #f1c40f;
}

.bg-admin-row-thumb {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  object-fit: cover;
  flex: 0 0 auto;
  background: var(--surface-alt);
}

.bg-admin-row-info {
  flex: 1;
  min-width: 0;
}

.bg-admin-row-name {
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bg-admin-row-meta {
  font-size: 11px;
  color: #999;
  margin-top: 2px;
}

.bg-edit-summary {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-alt);
}

.bg-edit-summary-date {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.bg-edit-summary-note {
  margin-top: 6px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  white-space: pre-line;
}

.bg-edit-checklist {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bg-edit-checklist-empty {
  font-size: 12px;
  color: var(--text-muted);
}

.bg-checklist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-alt);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}

.bg-checklist-item-mark {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 2px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  font-size: 12px;
  font-weight: 700;
}

.bg-checklist-item-name {
  flex: 1;
  color: var(--text);
  font-weight: 600;
}

.bg-checklist-item.done {
  background: var(--owned-soft);
  border-color: var(--owned);
}

.bg-checklist-item.done .bg-checklist-item-mark {
  background: var(--owned);
  border-color: var(--owned);
  color: #fff;
}

.bg-checklist-item.done .bg-checklist-item-name {
  color: var(--text-muted);
  font-weight: 400;
  text-decoration: line-through;
}

.bg-edit-date-row {
  display: flex;
  gap: 10px;
}

.bg-edit-date-row .field {
  flex: 1;
}

.bg-edit-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.bg-edit-links-empty {
  font-size: 12px;
  color: var(--text-muted);
}

.bg-link-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px 4px 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-alt);
  font-size: 11px;
  color: var(--text);
}

.bg-link-chip img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  flex: 0 0 auto;
}

.bg-link-chip-remove {
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 0 2px;
}

.bg-edit-search-results {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.bg-search-species-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.bg-search-species-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.bg-visual-thumb {
  width: 36px;
  height: 36px;
  padding: 3px;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
}

.bg-visual-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
}

.bg-visual-thumb.linked {
  border-color: #f1c40f;
  background: rgba(241, 196, 15, .15);
}

.bg-edit-manual-row {
  display: flex;
  gap: 8px;
}

.bg-edit-manual-row .text-input {
  flex: 1;
}

.bg-edit-manual-preview {
  width: 32px;
  height: 32px;
  object-fit: contain;
  flex: 0 0 auto;
  background: var(--surface-alt);
  border-radius: 4px;
}

.bg-edit-manual-feedback {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
}

.bg-edit-manual-feedback.error {
  color: #e74c3c;
}

.costume-code {
  display: block;
  font-family: monospace;
  font-size: 11px;
  color: var(--text-muted);
}

.costume-code--missing {
  color: #e74c3c;
}

.tile .label.hidden-visual-note {
  display: block;
  font-size: 11px;
  font-style: italic;
  color: var(--text-muted);
  white-space: normal;
  overflow: visible;
  -webkit-line-clamp: initial;
  -webkit-box-orient: initial;
}

.sprites-tmp-compare-source {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-alt);
}

.sprites-tmp-compare-img {
  width: 96px;
  height: 96px;
  object-fit: contain;
  image-rendering: pixelated;
}

.sprites-tmp-compare-filename {
  font-family: monospace;
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  word-break: break-all;
  user-select: all;
}

.sprites-tmp-compare-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.sprites-tmp-compare-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.sprites-tmp-compare-card img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  image-rendering: pixelated;
}

.sprites-tmp-compare-card-filename {
  font-family: monospace;
  font-size: 9px;
  color: var(--text-muted);
  text-align: center;
  word-break: break-all;
}
