/* FORMS & INPUTS */
label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--muted);
}

input[type="text"],
input[type="password"],
input[type="url"],
select {
  width: 100%;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 16px;
  font-family: inherit;
}

input[type="file"] {
  font-size: 0.85rem;
  color: var(--muted);
}

/* BUTTONS */
.btn {
  border: none;
  border-radius: 12px;
  padding: 11px 16px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
}

.btn.primary { background: var(--primary); color: #111; }
.btn.primary:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn.danger { background: rgba(239, 68, 68, 0.16); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.4); }
.btn.small { padding: 6px 11px; font-size: 0.82rem; border-radius: 9px; }
.btn.full { width: 100%; }

.icon-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 1rem;
}

/* FILTERS & CHIPS */
.filter-drawer {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 6px;
}

.filter-toggles { display: flex; flex-wrap: wrap; gap: 12px; }
.filter-actions { display: flex; justify-content: flex-end; gap: 8px; }

.checkbox-row {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  color: var(--text);
  font-size: 0.83rem;
}
.checkbox-row input { width: auto; }

.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }

.chip {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.78rem;
  cursor: pointer;
  user-select: none;
}

.chip.selected {
  background: rgba(245, 158, 11, 0.18);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}

/* BADGES */
.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text);
}
.badge.th { background: rgba(245, 158, 11, 0.2); color: var(--primary); }
.badge.dup { background: rgba(59, 130, 246, 0.2); color: #93c5fd; }
.badge.warn { background: rgba(239, 68, 68, 0.18); color: #fca5a5; }
.badge.ready { background: rgba(34, 197, 94, 0.18); color: #86efac; }
.badge.cooldown { background: rgba(245, 158, 11, 0.18); color: #fcd34d; }

/* EMPTY STATES */
.empty-card {
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px 16px;
  width: 100%;
}
.empty-emoji { font-size: 2rem; margin-bottom: 6px; }

/* FORMULAIRE AJOUT BASE */
.choice-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.choice-box.recommended {
  border-color: rgba(245, 158, 11, 0.65);
  background: rgba(245, 158, 11, 0.08);
}

.choice-title { font-weight: 700; font-size: 0.92rem; }

.or-divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}
.or-divider::before,
.or-divider::after {
  content: "";
  flex: 1;
  border-bottom: 1px solid var(--border);
}
.or-divider span { padding: 0 10px; }

.avail-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 4px;
}

.avail-radio {
  flex-direction: row;
  align-items: center;
  gap: 7px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 10px;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.avail-radio input { width: auto; margin: 0; }

.avail-delay-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 6px;
}

/* MODALS */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.76);
}

.modal-sheet {
  position: relative;
  width: 100%;
  max-width: 540px;
  max-height: 92dvh;
  background: var(--surface);
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: var(--safe-bottom);
}

.modal-sheet.full-compare {
  max-width: 100vw;
  height: 94dvh;
}

.modal-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-header h3 { margin: 0; font-size: 1.02rem; }

.modal-body {
  padding: 14px 16px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-img-preview {
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  background: #000;
  border-radius: 10px;
}

.owner-match-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.compare-body {
  flex: 1;
  overflow: hidden;
  padding: 8px;
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 8px;
}

.compare-pane {
  background: #05070a;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
}

.compare-pane img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform-origin: center center;
  user-select: none;
  pointer-events: none;
}

.compare-label {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.8);
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  z-index: 3;
}

.zoom-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.zoom-nav-info {
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* TOAST */
.toast {
  position: fixed;
  bottom: calc(74px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: #1f2937;
  color: #fff;
  border: 1px solid var(--border);
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 0.85rem;
  z-index: 100;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
}

@media (min-width: 640px) {
  .modal {
    align-items: center;
    padding: 16px;
  }

  .modal-sheet {
    border-radius: 20px;
    padding-bottom: 0;
  }

  .modal-sheet.full-compare {
    width: 92vw;
    max-width: 980px;
    height: 92dvh;
  }
}

/* DRAG HANDLE MOBILE + ACTIVE FILTER BUTTON */
.modal-handle {
  width: 38px;
  height: 4px;
  border-radius: 999px;
  background: var(--border);
  margin: 8px auto 0;
  flex-shrink: 0;
}

.btn.has-filters {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(245, 158, 11, 0.14);
}

@media (min-width: 640px) {
  .modal-handle {
    display: none;
  }
}

/* ONBOARDING */
.onboarding-slide {
  text-align: center;
  padding: 10px 6px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.onboarding-emoji {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: rgba(245, 158, 11, 0.14);
  border: 1px solid rgba(245, 158, 11, 0.4);
  display: grid;
  place-items: center;
  font-size: 2rem;
}

.onboarding-slide h4 {
  margin: 0;
  font-size: 1.15rem;
}

.onboarding-slide p {
  max-width: 360px;
  line-height: 1.45;
}

.onboarding-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: 4px;
}

.onboarding-swipe-hint {
  display: flex;
  gap: 8px;
  margin-top: 4px;
  font-size: 0.78rem;
  font-weight: 700;
}

.hint-pass {
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(239, 68, 68, 0.5);
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.1);
}

.hint-match {
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(34, 197, 94, 0.5);
  color: #86efac;
  background: rgba(34, 197, 94, 0.1);
}

.onboarding-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 4px 0;
}

.onboarding-dot {
  width: 8px;
  height: 8px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: var(--border);
  cursor: pointer;
  transition: width 0.18s ease, background 0.18s ease;
}

.onboarding-dot.active {
  width: 22px;
  background: var(--primary);
}

.onboarding-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.onboarding-actions-row {
  display: flex;
  gap: 8px;
}