/* Thème Capsule — palette reprise du projet MTG Collection */
:root {
  --bg: #0b1220;
  --bg-deep: #070c15;
  --surface: #141d31;
  --surface-2: #1b2740;
  --border: #26334f;
  --text: #e9e7df;
  --text-dim: #93a0ba;
  --gold: #c9a24b;
  --gold-strong: #e3bd5f;
  --radius: 10px;
  --shadow: 0 6px 22px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background:
    radial-gradient(1100px 500px at 50% -10%, rgba(63, 111, 196, 0.18), transparent 70%),
    var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.7rem 1.4rem;
  background: rgba(11, 18, 32, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.logo {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  text-decoration: none;
}
.logo img {
  height: 3rem;
  width: auto;
  display: inline-block;
  vertical-align: middle;
}
.topbar img.logo {
  height: 48px;
}

.topbar { align-items: center; }
.mtg-link { display: inline-flex; align-items: center; }
.mtg-link img { height: 3rem; width: auto; display: block; }

.nav {
  display: flex;
  gap: 0.3rem;
  margin-left: auto;
}

.nav a {
  color: var(--text-dim);
  text-decoration: none;
  padding: 0.3rem 0.7rem;
  border-radius: 8px;
  border: 1px solid transparent;
}

.nav a:hover {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border);
}

.nav a.active {
  color: var(--gold);
  background: var(--surface);
  border-color: var(--border);
}

.tagline {
  color: var(--text-dim);
  font-size: 0.9rem;
}

.container {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 2.5rem 1.4rem 3rem;
}

h1 {
  margin: 0 0 0.4rem;
  font-size: 2.4rem;
  letter-spacing: 0.02em;
}

.intro {
  margin: 0 0 2rem;
  color: var(--text-dim);
  max-width: 60ch;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.9rem;
}

.card {
  background: linear-gradient(160deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.2rem 1.3rem;
}

.card-logo {
  display: block;
  width: 100%;
  max-width: 220px;
  height: auto;
  margin: 0 0 0.8rem;
}

.card-logo-icon {
  width: 48px;
  max-width: none;
}

.card h2 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  color: var(--gold-strong);
}

.card p {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.95rem;
}

.more {
  display: inline-block;
  margin-top: 0.7rem;
  color: var(--gold);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
}

.more:hover {
  color: var(--gold-strong);
  text-decoration: underline;
}

.status {
  margin-top: 2rem;
  color: var(--text-dim);
  font-size: 0.9rem;
  font-style: italic;
}

/* ---------- Catalogue ---------- */

h2 {
  font-size: 1.05rem;
  color: var(--gold-strong);
  margin: 0 0 0.8rem;
}

.section-title {
  margin-top: 2rem;
}

.panel {
  background: linear-gradient(160deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.3rem 1.4rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.8rem;
  align-items: end;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.85rem;
  color: var(--text-dim);
}

input,
select {
  font: inherit;
  color: var(--text);
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
  min-width: 0;
}

input:focus,
select:focus,
.btn:focus-visible {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 162, 75, 0.35);
}

.btn {
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  color: var(--bg-deep);
  background: var(--gold);
  border: 1px solid var(--gold);
  border-radius: 8px;
  padding: 0.5rem 1rem;
}

.btn:hover {
  background: var(--gold-strong);
}

.btn.ghost {
  color: var(--text-dim);
  background: transparent;
  border-color: var(--border);
  font-weight: 400;
  padding: 0.35rem 0.7rem;
}

.btn.ghost:hover {
  color: var(--danger);
  border-color: var(--danger);
  background: transparent;
}

.feedback {
  min-height: 1.2em;
  margin: 0.7rem 0 0;
  font-size: 0.9rem;
  color: var(--gold);
}

.feedback.error {
  color: var(--danger);
}

.groups {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 0.9rem;
}

.group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem 1rem;
}

.group-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.7rem;
}

.group-head h3 {
  margin: 0;
  font-size: 1rem;
  flex: 1;
}

.swatch {
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 50%;
  background: var(--swatch, #888);
  border: 1px solid rgba(255, 255, 255, 0.25);
  flex: none;
}

.badge {
  min-width: 1.9rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--gold);
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.05rem 0.5rem;
}

.capsule-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.capsule-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-top: 0.45rem;
  border-top: 1px solid var(--border);
}

.capsule-list > .capsule-row:first-child {
  border-top: none;
  padding-top: 0;
}

.capsule-label {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.capsule-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.capsule-brand {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.qty {
  width: 4.2rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
  padding: 0.3rem 0.2rem;
}

.empty {
  color: var(--text-dim);
  font-size: 0.88rem;
  font-style: italic;
}

/* ---------- Mosaïque ---------- */

.dropzone {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 7rem;
  padding: 1.2rem;
  text-align: center;
  cursor: pointer;
  color: var(--text-dim);
  background: var(--bg-deep);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s, color 0.15s;
}

.dropzone:hover,
.dropzone.over {
  color: var(--gold);
  border-color: var(--gold);
}

.form-grid label output {
  font-variant-numeric: tabular-nums;
  color: var(--gold);
}

.form-grid input[type='range'] {
  padding: 0;
  border: none;
  background: transparent;
  accent-color: var(--gold);
  box-shadow: none;
}

label.checkbox {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
}

label.checkbox input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--gold);
}

.actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.actions .btn {
  min-width: 12rem;
}

.actions .btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.preview-hint {
  margin: 0 0 0.8rem;
  font-size: 0.88rem;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.preview {
  display: flex;
  justify-content: center;
  padding: 1rem;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.preview canvas {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

.style-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.6rem;
}

.style-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  padding: 0.6rem 0.7rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.style-btn:hover { border-color: var(--gold); }

.style-btn.selected {
  border-color: var(--gold);
  background: linear-gradient(160deg, rgba(212, 175, 55, 0.12), var(--surface));
}

.style-name { font-weight: 700; font-size: 0.95rem; }
.style-hint { font-size: 0.78rem; color: var(--text-dim); }

.drawings {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.drawing-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.8rem;
}

.drawing-canvas {
  width: 100%;
  height: auto;
  border-radius: 4px;
  background: var(--bg-deep);
}

.drawing-label {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-dim);
}

.nas-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  align-items: center;
  justify-content: space-between;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  font-size: 0.95rem;
}

.breadcrumb a {
  color: var(--gold);
  text-decoration: none;
}

.breadcrumb a:hover { text-decoration: underline; }

.nas-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.nas-actions input[type='search'] {
  padding: 0.4rem 0.6rem;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  min-width: 160px;
}

.upload-label { cursor: pointer; }

.nas-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.nas-item {
  display: grid;
  grid-template-columns: 2rem 1fr 6rem 10rem 6rem;
  gap: 0.6rem;
  align-items: center;
  padding: 0.55rem 0.8rem;
  border-bottom: 1px solid var(--border);
  cursor: default;
}

.nas-item:last-child { border-bottom: none; }
.nas-item:hover { background: var(--surface); }
.nas-parent { color: var(--text-dim); }

.nas-icon { font-size: 1.1rem; }
.nas-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nas-size, .nas-date { color: var(--text-dim); font-size: 0.85rem; text-align: right; }
.nas-date { text-align: left; }
.nas-actions { text-align: right; }
.nas-image { cursor: zoom-in; }

.nas-preview {
  position: fixed;
  z-index: 1000;
  width: 320px;
  height: 240px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgb(0 0 0 / 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  pointer-events: none;
}
.nas-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.nas-preview-loading {
  color: var(--text-dim);
  font-size: 0.9rem;
}

@media (max-width: 720px) {
  .nas-item { grid-template-columns: 1.6rem 1fr 5rem; }
  .nas-date, .nas-actions { display: none; }
}
