/* Vinyles Collection — thème « bac à disques » : fond nuit, accents orange/moutarde des pochettes 70's,
   disques qui sortent de leur pochette au survol. Volontairement sobre : 2 couleurs d'accent, pas d'images. */
:root {
  --bg: #15111c;
  --bg2: #1d1726;
  --surface: #241d2f;
  --surface2: #2e2539;
  --line: rgba(255, 255, 255, 0.08);
  --text: #f6efe6;
  --muted: #a99db5;
  --primary: #ff6b3d;       /* orange « label » */
  --primary-ink: #1a0f08;
  --secondary: #ffc23d;     /* moutarde */
  --wish: #ff7eb6;
  --danger: #ff5c6c;
  --radius: 14px;
  --container: rgba(255, 107, 61, 0.14);
  --oncontainer: #ffd2c2;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background:
    radial-gradient(1200px 500px at 85% -10%, rgba(255, 107, 61, 0.16), transparent 60%),
    radial-gradient(900px 400px at -10% 110%, rgba(255, 194, 61, 0.10), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
}
a { color: var(--secondary); }
h1, h2, h3 { letter-spacing: -0.01em; }
h2 { font-size: 1.45rem; margin: 6px 0 14px; }
h3 { font-size: 1.05rem; margin: 0 0 8px; }
code { background: var(--surface2); padding: 1px 5px; border-radius: 4px; font-size: 0.85em; }

/* ── barre du haut ── */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 20px;
  background: rgba(21, 17, 28, 0.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 1.15rem; font-weight: 500; }
.brand b { color: var(--primary); font-weight: 800; }
.logo-disc {
  width: 30px; height: 30px; border-radius: 50%; flex: 0 0 auto;
  background:
    radial-gradient(circle, var(--bg) 0 8%, var(--primary) 9% 30%, transparent 31%),
    repeating-radial-gradient(circle, #111 0 2px, #2a2a2a 2px 3px);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.06);
  animation: spin 6s linear infinite;
}
.who { display: flex; align-items: center; gap: 8px; }
.who-email { color: var(--muted); font-size: 0.85rem; }
@media (max-width: 640px) { .who-email { display: none; } }
.hidden { display: none !important; }

main { padding: 18px 16px 96px; max-width: 1180px; margin: 0 auto; }

/* ── cartes / formulaires ── */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.card.narrow { max-width: 430px; margin: 48px auto; }
.card h1, .card h2 { margin-top: 0; }
.card h1 { color: var(--primary); }

label { display: block; margin: 12px 0; font-size: 0.86rem; color: var(--muted); }
label.check { display: flex; gap: 10px; align-items: flex-start; color: var(--text); }
label.check input { width: auto; margin-top: 2px; accent-color: var(--primary); }
input, select, textarea {
  width: 100%; margin-top: 5px; padding: 10px 12px;
  border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg2); color: var(--text); font-size: 1rem; font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: 0; border-color: transparent; }
input[type="file"] { padding: 8px; }

.btn {
  padding: 10px 18px; border-radius: 999px; border: none;
  font-weight: 700; cursor: pointer; font-family: inherit; font-size: 0.95rem;
  transition: transform .12s ease, filter .12s ease, background .12s ease;
}
.btn:active { transform: scale(0.97); }
.btn.primary { background: linear-gradient(135deg, var(--primary), #ff8f3d); color: var(--primary-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--surface2); }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid rgba(255, 92, 108, 0.45); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.small { padding: 6px 13px; font-size: 0.83rem; }

.error { color: var(--danger); font-weight: 600; }
.muted { color: var(--muted); }
.center { text-align: center; }
.small { font-size: 0.8rem; }
.mono { font-family: ui-monospace, monospace; word-break: break-all; }
.hint {
  background: rgba(255, 194, 61, 0.10); border: 1px dashed rgba(255, 194, 61, 0.45);
  color: #ffe3a3; border-radius: 10px; padding: 9px 12px; font-size: 0.85rem; margin: 8px 0 12px;
}

/* ── navigation du bas (comme l'application Android) ── */
.bottom-nav {
  position: fixed; left: 50%; bottom: 12px; transform: translateX(-50%);
  width: min(560px, calc(100% - 20px));
  display: flex; padding: 6px;
  background: rgba(36, 29, 47, 0.92); backdrop-filter: blur(10px);
  border: 1px solid var(--line); border-radius: 22px;
  box-shadow: var(--shadow); z-index: 30;
}
.bottom-nav .tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 7px 2px; background: none; border: none; border-radius: 16px; cursor: pointer;
  color: var(--muted); font-size: 0.68rem; font-weight: 700; font-family: inherit;
}
.bottom-nav .tab .icon { font-size: 1.25rem; line-height: 1; }
.bottom-nav .tab.active { color: var(--primary-ink); background: var(--secondary); }

.fab {
  position: fixed; right: 22px; bottom: 92px; width: 60px; height: 60px; border-radius: 50%;
  border: none; cursor: pointer; z-index: 25; font-size: 1.8rem; font-weight: 700; color: var(--primary-ink);
  background:
    radial-gradient(circle, var(--primary) 0 34%, transparent 35%),
    repeating-radial-gradient(circle, #121212 0 2px, #262626 2px 3px);
  box-shadow: 0 6px 18px rgba(255, 107, 61, 0.35);
  transition: transform .3s ease;
}
.fab:hover { transform: rotate(90deg); }

/* ── chips, segments, filtres ── */
.chiprow { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 10px; }
.chip {
  flex: 0 0 auto; padding: 7px 15px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font-size: 0.85rem; font-weight: 700; cursor: pointer; white-space: nowrap; font-family: inherit;
}
.chip.selected { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.segmented {
  display: inline-flex; gap: 2px; padding: 3px; margin: 0 0 12px;
  background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; max-width: 100%; overflow-x: auto;
}
.seg {
  border: none; background: none; color: var(--muted); padding: 6px 13px; border-radius: 9px;
  font-weight: 700; font-size: 0.85rem; cursor: pointer; white-space: nowrap; font-family: inherit;
}
.seg.selected { background: var(--surface2); color: var(--secondary); box-shadow: inset 0 0 0 1px var(--line); }

.filters-row { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 14px; }
.filters-row select { width: auto; flex: 0 0 auto; min-width: 110px; margin-top: 0; padding: 7px 10px; font-size: 0.88rem; }

.toolbar { display: flex; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; align-items: center; }
.toolbar input[type="search"] { flex: 1; min-width: 160px; margin-top: 0; border-radius: 999px; padding-left: 16px; }
.toolbar select { width: auto; }

.collection-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; gap: 10px; }
.collection-header h2 { margin: 0; }

.member-strip { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 12px; }
.member-pill {
  display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto;
  padding: 4px 12px 4px 4px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font-weight: 600; cursor: pointer; font-family: inherit;
}
.member-pill:first-child { padding-left: 12px; }
.member-pill.selected { border-color: var(--secondary); box-shadow: 0 0 0 1px var(--secondary) inset; }

.selection-bar {
  display: flex; align-items: center; gap: 10px; background: var(--container); color: var(--oncontainer);
  border-radius: 12px; padding: 8px 12px; margin-bottom: 10px; flex-wrap: wrap;
}
.selection-bar .count { font-weight: 700; flex: 1; }
.selection-bar select { width: auto; margin: 0; }

/* ── grille : pochettes avec le disque qui dépasse ── */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 18px 16px; }
.record-card {
  position: relative; cursor: pointer; display: flex; flex-direction: column; gap: 8px;
  background: none; border-radius: var(--radius);
}
.record-card .sleeve { position: relative; aspect-ratio: 1; margin-right: 14px; }
.record-card .jacket {
  position: relative; z-index: 1; width: 100%; height: 100%; border-radius: 6px; overflow: hidden;
  background: linear-gradient(135deg, #3b2f4a, #2a2135);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}
.record-card .jacket img { width: 100%; height: 100%; object-fit: cover; display: block; }
.record-card .no-cover {
  display: flex; width: 100%; height: 100%; align-items: center; justify-content: center;
  font-size: 3rem; font-weight: 800; color: rgba(255, 255, 255, 0.18);
  background: repeating-linear-gradient(45deg, rgba(255, 107, 61, 0.10) 0 12px, transparent 12px 24px);
}
.disc {
  position: absolute; top: 4%; right: -10px; width: 92%; height: 92%; border-radius: 50%; z-index: 0;
  transition: transform .45s cubic-bezier(.2, .8, .2, 1);
}
.disc.vinyl {
  background:
    radial-gradient(circle, #15111c 0 3%, var(--primary) 3.5% 17%, transparent 17.5%),
    repeating-radial-gradient(circle, #0d0d0d 0 1.5px, #232323 1.5px 3px);
}
.disc.cd {
  background:
    radial-gradient(circle, #15111c 0 7%, #d9d9e0 7.5% 15%, transparent 15.5%),
    conic-gradient(from 30deg, #c9d6ff, #f2c6ff, #c6fff0, #fff3c4, #c9d6ff);
  opacity: 0.92;
}
.record-card:hover .disc { transform: translateX(34%) rotate(40deg); }
.record-card.is-wish .jacket { outline: 2px dashed rgba(255, 126, 182, 0.55); outline-offset: 3px; }
.record-card.is-wish .jacket img { filter: saturate(0.75); }
.record-card.selected .jacket { outline: 3px solid var(--secondary); outline-offset: 3px; }
.record-card .body { min-width: 0; padding: 0 2px; }
.record-card .title { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.record-card .artist { color: var(--primary); font-weight: 600; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.record-card .meta { font-size: 0.76rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.record-card .select-check { position: absolute; top: 8px; left: 8px; width: 22px; height: 22px; z-index: 3; margin: 0; accent-color: var(--secondary); }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.tag {
  display: inline-flex; align-items: center; gap: 4px; font-size: 0.7rem; font-weight: 700;
  padding: 2px 8px; border-radius: 999px; background: var(--surface2); color: var(--muted); white-space: nowrap;
}
.tag.support { color: var(--secondary); }
.tag.wish { color: var(--wish); background: rgba(255, 126, 182, 0.12); }
.tag.owner { color: var(--text); padding-left: 2px; }
.badge {
  display: inline-block; font-size: 0.7rem; font-weight: 700; padding: 2px 8px; border-radius: 10px;
  margin-top: 6px; background: var(--secondary); color: #1b1b1b;
}

.empty { text-align: center; padding: 40px 10px; }
.empty-disc {
  width: 120px; height: 120px; margin: 0 auto 14px; border-radius: 50%;
  background:
    radial-gradient(circle, var(--bg) 0 4%, var(--secondary) 4.5% 18%, transparent 18.5%),
    repeating-radial-gradient(circle, #0d0d0d 0 2px, #222 2px 4px);
  animation: spin 4s linear infinite;
}

/* ── avatars ── */
.avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; display: inline-flex; }
.avatar.letter {
  align-items: center; justify-content: center; font-weight: 800; font-size: 0.9rem; color: #1a1220;
  background: hsl(var(--hue, 30) 85% 70%);
}
.avatar.xs { width: 18px; height: 18px; font-size: 0.6rem; }
.avatar.sm { width: 26px; height: 26px; font-size: 0.75rem; }
.avatar.md { width: 40px; height: 40px; }
.avatar.big { width: 72px; height: 72px; font-size: 1.8rem; }
.empty-avatar { align-items: center; justify-content: center; background: var(--surface2); }

/* ── dialogues ── */
dialog {
  border: 1px solid var(--line); border-radius: 18px; padding: 0; max-width: 600px; width: 92%;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(8, 5, 12, 0.7); backdrop-filter: blur(3px); }
dialog .card { box-shadow: none; border: none; margin: 0; }
.formgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.formgrid .span2 { grid-column: 1 / -1; }
@media (max-width: 560px) { .formgrid { grid-template-columns: 1fr; } }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.dialog-actions .btn.danger { margin-right: auto; }

/* ── recherche Discogs ── */
.discogs { display: flex; gap: 8px; margin: 10px 0; }
.discogs input { margin-top: 0; border-radius: 999px; padding-left: 16px; }
.discogs-results {
  max-height: 300px; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px;
  margin-bottom: 12px; background: var(--surface);
}
.discogs-result {
  display: flex; gap: 12px; padding: 10px; cursor: pointer; border-bottom: 1px solid var(--line); align-items: center;
}
.discogs-result:last-child { border-bottom: none; }
.discogs-result:hover { background: var(--surface2); }
.discogs-result img, .thumb-ph {
  width: 54px; height: 54px; object-fit: cover; border-radius: 6px; flex: 0 0 auto;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
}
.thumb-ph { display: inline-block; border-radius: 50%; }
.thumb-ph.vinyl { background: radial-gradient(circle, var(--surface) 0 6%, var(--primary) 7% 22%, transparent 23%), repeating-radial-gradient(circle, #0d0d0d 0 1.5px, #262626 1.5px 3px); }
.thumb-ph.cd { background: radial-gradient(circle, var(--surface) 0 10%, #ddd 11% 18%, transparent 19%), conic-gradient(#c9d6ff, #f2c6ff, #c6fff0, #fff3c4, #c9d6ff); }
.dr-body { flex: 1; min-width: 0; }

.recovery { columns: 2; font-family: ui-monospace, monospace; }
.qr { display: flex; justify-content: center; margin: 16px 0; }
.qr img { width: 180px; height: 180px; background: #fff; padding: 8px; border-radius: 10px; }

.cover-detail {
  width: 100%; max-width: 240px; aspect-ratio: 1; object-fit: cover; border-radius: 8px;
  margin: 0 auto 14px; display: block; box-shadow: var(--shadow);
}
.cover-picker { display: flex; gap: 8px; align-items: center; margin: 4px 0 10px; }
.cover-picker img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; }
#detailOwner { display: flex; align-items: center; gap: 6px; }

.warning-box {
  background: var(--container); color: var(--oncontainer);
  border-radius: 10px; padding: 10px 12px; font-size: 0.85rem; margin: 10px 0;
}

/* ── scan ── */
.scan-wrap { display: flex; flex-direction: column; align-items: center; gap: 12px; }
#scanVideo { width: 100%; max-width: 420px; border-radius: 14px; background: #000; }
.scan-status { font-weight: 600; }

/* ── statistiques ── */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; text-align: center;
}
.stat-card .value { font-size: 1.7rem; font-weight: 800; color: var(--secondary); }
.stat-card .label { font-size: 0.78rem; color: var(--muted); }
.agg-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.agg-card h3 { margin: 0 0 10px; font-size: 1rem; }
.agg-row { margin-bottom: 8px; }
.agg-row .agg-top { display: flex; justify-content: space-between; font-size: 0.85rem; margin-bottom: 3px; }
.agg-bar-bg { background: var(--bg2); border-radius: 4px; height: 7px; overflow: hidden; }
.agg-bar-fill { background: linear-gradient(90deg, var(--primary), var(--secondary)); height: 100%; border-radius: 4px; }
.member-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.member-stat { display: flex; align-items: center; gap: 10px; background: var(--bg2); border-radius: 12px; padding: 10px; }
.ms-body { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.ms-total { font-size: 1.4rem; font-weight: 800; color: var(--secondary); }

/* ── revente / alertes ── */
.price-refresh-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.resale-row {
  display: flex; gap: 10px; align-items: center; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 10px; margin-bottom: 8px;
}
.resale-row .cover { width: 48px; height: 48px; border-radius: 6px; object-fit: cover; background: var(--bg2); flex: 0 0 auto; }
.resale-row .body { flex: 1; min-width: 0; }
.resale-row .price { font-weight: 800; text-align: right; white-space: nowrap; color: var(--secondary); }
.alert-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 10px; }
.alert-card .prices-row { display: flex; gap: 14px; font-size: 0.85rem; margin: 6px 0; flex-wrap: wrap; }
.alert-badge { display: inline-block; font-size: 0.78rem; font-weight: 700; padding: 3px 10px; border-radius: 8px; background: var(--bg2); color: var(--muted); }
.alert-badge.under-budget { background: rgba(80, 220, 140, 0.16); color: #8ff0b9; }
.alert-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }

/* ── réglages ── */
.members { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.member-row { display: flex; align-items: center; gap: 12px; background: var(--bg2); border-radius: 12px; padding: 10px; flex-wrap: wrap; }
.mr-body { flex: 1; min-width: 150px; }
.mr-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.member-form { border-top: 1px solid var(--line); padding-top: 8px; }
.avatar-pick { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.import-summary { background: var(--bg2); border-radius: 10px; padding: 10px 12px; margin: 10px 0; font-size: 0.9rem; }

@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .logo-disc, .empty-disc { animation: none; }
  .disc, .fab { transition: none; }
}
