/* cover-picker.css — Foglio "Cambia copertina" (coverPicker.js). Stesso
   pattern a bottom sheet di save-to-sheet.css (.sts-*), ma coi token del
   profilo V2 (--profile-card-bg ecc.): e' un'estensione del profilo, non del
   resto del sito (dark), coerente con .profile-v2-overlay già in
   profile-v2.css. */

/* z-index alto e fisso (non --z-modal/100): si apre anche da dentro il
   wizard "Modifica profilo" (.onboarding-overlay, z-index 1600) e deve
   restare sopra di esso, sotto solo ai toast (1700). */
.cvp-layer { position: fixed; inset: 0; z-index: 1650; }
.cvp-layer[hidden] { display: none; }
.cvp-backdrop {
  position: absolute; inset: 0; background: rgba(0, 0, 0, .55);
  opacity: 0; transition: opacity var(--transition-base);
}
.cvp-layer.is-open .cvp-backdrop { opacity: 1; }
.cvp-sheet {
  position: absolute; left: 50%; bottom: 0;
  width: min(100%, var(--container-max));
  transform: translate(-50%, 100%);
  background: var(--profile-surface); color: var(--profile-ink);
  border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
  padding: 0.6rem 1.1rem calc(1.1rem + var(--safe-bottom));
  box-shadow: 0 -20px 50px rgba(0, 0, 0, .45);
  max-height: 88dvh; overflow-y: auto;
  transition: transform var(--transition-smooth);
}
.cvp-layer.is-open .cvp-sheet { transform: translate(-50%, 0); }
.cvp-grab { width: 2.4rem; height: 4px; border-radius: 2px; background: var(--profile-card-border); margin: 0 auto 0.7rem; }
body.cvp-open-lock { overflow: hidden; }

.cvp-head { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.8rem; }
.cvp-head-title { flex: 1; font-family: var(--font-display, inherit); font-size: 1.05rem; font-weight: 800; }
.cvp-back, .cvp-close {
  appearance: none; border: 0; background: none; flex: none;
  width: 2rem; height: 2rem; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--profile-ink); cursor: pointer;
}
.cvp-back[hidden] { display: none; }
.cvp-back svg, .cvp-close svg { width: 18px; height: 18px; }
.cvp-back:hover, .cvp-close:hover { background: var(--profile-fill); }

.cvp-section { margin-bottom: 0.9rem; }
.cvp-section-label {
  display: block; font-size: 0.72rem; font-weight: var(--weight-bold);
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--profile-ink-muted);
  margin-bottom: 0.5rem;
}
.cvp-shortcuts-row { display: flex; gap: 0.6rem; overflow-x: auto; scrollbar-width: none; }
.cvp-shortcuts-row::-webkit-scrollbar { display: none; }
.cvp-shortcut {
  appearance: none; border: 0; background: none; flex: 0 0 auto; width: 72px;
  display: flex; flex-direction: column; gap: 0.35rem; color: var(--profile-ink); cursor: pointer;
}
.cvp-shortcut-poster { width: 72px; height: 104px; border-radius: 12px; overflow: hidden; background: var(--profile-fill); display: block; }
.cvp-shortcut-poster img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cvp-shortcut-ph { display: block; width: 100%; height: 100%; background: var(--brand-gradient); }
.cvp-shortcut-name {
  font-size: 0.72rem; font-weight: var(--weight-semibold); text-align: left;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.cvp-search {
  display: flex; align-items: center; gap: 0.5rem;
  background: var(--profile-fill); border-radius: var(--radius-pill);
  padding: 0.6rem 0.9rem; margin-bottom: 0.7rem;
}
.cvp-search svg { width: 18px; height: 18px; color: var(--profile-ink-muted); flex: none; }
.cvp-search input {
  flex: 1; border: 0; background: none; outline: none; font: inherit;
  font-size: 0.92rem; color: var(--profile-ink); min-width: 0;
}
.cvp-search input::placeholder { color: var(--profile-ink-muted); }

.cvp-results-wrap:empty { display: none; }
.cvp-results-list { display: flex; flex-direction: column; gap: 0.4rem; }
.cvp-result {
  appearance: none; border: 0; background: var(--profile-fill-soft); border-radius: var(--radius-lg);
  display: flex; align-items: center; gap: 0.7rem; padding: 0.5rem; width: 100%;
  text-align: left; cursor: pointer; color: var(--profile-ink);
}
.cvp-result-poster { width: 2.6rem; height: 3.7rem; border-radius: 8px; overflow: hidden; flex: none; background: var(--profile-fill); display: block; }
.cvp-result-poster img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cvp-result-ph { display: block; width: 100%; height: 100%; background: var(--brand-gradient); }
.cvp-result-t { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.cvp-result-t strong { font-size: 0.9rem; font-weight: var(--weight-bold); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cvp-result-t span { font-size: 0.76rem; color: var(--profile-ink-muted); }

.cvp-loading, .cvp-empty {
  font-size: 0.85rem; color: var(--profile-ink-muted); padding: 1.4rem 0.2rem; text-align: center;
}

.cvp-reset {
  appearance: none; width: 100%; margin-top: 0.3rem; padding: 0.7rem;
  border: 1px dashed var(--profile-card-border); border-radius: var(--radius-pill);
  background: none; color: var(--profile-ink-soft); font: inherit; font-weight: var(--weight-semibold);
  font-size: 0.86rem; cursor: pointer;
}
.cvp-reset:hover { background: var(--profile-fill); }

.cvp-images-title {
  font-family: var(--font-display, inherit); font-size: 1rem; font-weight: 800;
  color: var(--profile-ink); margin-bottom: 0.7rem;
}
.cvp-image-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.55rem;
}
.cvp-image-cell {
  appearance: none; border: 2px solid transparent; padding: 0; cursor: pointer;
  border-radius: 14px; overflow: hidden; aspect-ratio: 16 / 9; background: var(--profile-fill);
}
.cvp-image-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cvp-image-cell.is-selected { border-color: var(--brand-primary); }

.cvp-preview-frame {
  position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: 16px;
  overflow: hidden; background-size: cover; background-position: center;
  background-color: var(--profile-fill); margin-bottom: 1rem;
  display: flex; align-items: flex-end; padding: 0.9rem;
}
.cvp-preview-scrim {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(0, 0, 0, 0.55));
}
.cvp-preview-avatar {
  position: relative; z-index: 1; width: 56px; height: 56px; border-radius: 50%;
  border: 3px solid #fff; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  background: var(--brand-gradient); color: #fff; font-weight: var(--weight-bold);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.cvp-preview-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

.cvp-btn {
  display: flex; align-items: center; justify-content: center; width: 100%;
  height: 2.9rem; border: 0; border-radius: var(--radius-pill); font: inherit;
  font-size: var(--text-md, 1rem); font-weight: var(--weight-bold); cursor: pointer;
}
.cvp-btn-primary { background: var(--brand-gradient); color: #fff; box-shadow: var(--shadow-brand, none); }
.cvp-btn-primary:disabled { opacity: 0.7; cursor: default; }

@media (min-width: 640px) {
  .cvp-image-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 900px) {
  .cvp-image-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  .cvp-sheet, .cvp-backdrop { transition-duration: 0.01ms; }
}
