/* Famille V2.0.189 — avatar manager + picker par thèmes */

.avatar-admin-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-radius: 28px;
  background:
    radial-gradient(circle at 100% 0%, rgba(109,93,252,.14), transparent 32%),
    linear-gradient(180deg, #ffffff, #f8fafc);
}

.avatar-admin-hero h2 {
  margin: .35rem 0 .2rem;
  letter-spacing: -.045em;
  font-weight: 1000;
}

.avatar-admin-forms {
  margin-top: 1rem;
}

.avatar-admin-library {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.avatar-theme-admin-card {
  border-radius: 28px;
  overflow: hidden;
}

.avatar-admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: .85rem;
  margin-top: 1rem;
}

.avatar-admin-item {
  display: grid;
  gap: .6rem;
  padding: .8rem;
  border-radius: 22px;
  background: #f8fafc;
  border: 1px solid rgba(226,232,240,.9);
}

.avatar-admin-item img {
  width: 86px;
  height: 86px;
  border-radius: 24px;
  object-fit: cover;
  justify-self: center;
  box-shadow: 0 14px 30px rgba(15,23,42,.12);
}

.avatar-admin-item label {
  gap: .3rem;
  font-size: .82rem;
}

.avatar-admin-item input,
.avatar-admin-item select {
  min-height: 40px;
  padding: .55rem .65rem;
  border-radius: 13px;
}

.avatar-admin-item small {
  color: #64748b;
  font-size: .72rem;
  word-break: break-word;
}

/* Picker profil/utilisateurs par thèmes */
.fv2-avatar-theme-picker {
  display: grid;
  gap: .75rem;
}

.fv2-avatar-theme {
  border: 1px solid rgba(226,232,240,.9);
  border-radius: 20px;
  background: rgba(255,255,255,.85);
  overflow: hidden;
}

.fv2-avatar-theme > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  padding: .75rem .85rem;
  background: linear-gradient(180deg, #fff, #f8fafc);
}

.fv2-avatar-theme > summary::-webkit-details-marker {
  display: none;
}

.fv2-avatar-theme > summary strong {
  color: #0f172a;
  font-weight: 950;
}

.fv2-avatar-theme > summary span {
  color: #64748b;
  font-size: .82rem;
  font-weight: 760;
}

.fv2-avatar-theme .fv2-avatar-picker {
  padding: .75rem;
}

.fv2-avatar-choice {
  min-height: 110px;
}

.fv2-avatar-choice img {
  width: 66px;
  height: 66px;
}

@media (max-width: 760px) {
  .avatar-admin-hero {
    display: grid;
    border-radius: 22px;
  }

  .avatar-admin-hero .inline-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .avatar-admin-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .avatar-admin-item {
    border-radius: 18px;
  }

  .avatar-admin-item img {
    width: 72px;
    height: 72px;
    border-radius: 20px;
  }

  .fv2-avatar-theme > summary {
    position: sticky;
    top: 0;
    z-index: 1;
  }

  .fv2-avatar-theme .fv2-avatar-picker {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .5rem;
  }

  .fv2-avatar-choice {
    min-height: 96px;
    padding: .5rem .35rem;
    border-radius: 16px;
  }

  .fv2-avatar-choice img {
    width: 56px;
    height: 56px;
    border-radius: 16px;
  }

  .fv2-avatar-choice span {
    font-size: .68rem;
  }
}

@media (max-width: 420px) {
  .avatar-admin-grid {
    grid-template-columns: 1fr;
  }

  .fv2-avatar-theme .fv2-avatar-picker {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}


/* Famille V2.0.191 — correction formulaires avatars */
.avatar-hidden-form {
  display: none !important;
}

.avatar-save-actions-v191 {
  position: sticky;
  bottom: 12px;
  z-index: 20;
  display: flex;
  justify-content: flex-end;
  padding: .75rem;
  border-radius: 20px;
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(12px);
  box-shadow: 0 18px 44px rgba(15,23,42,.14);
}


/* Famille V2.0.192 — suppression avatar via formulaire dédié */
.avatar-delete-btn {
  cursor: pointer;
}


/* Famille V2.0.193 — boutique avatars */
.avatar-pack-price-field {
  display: grid;
  gap: .25rem;
  min-width: 150px;
  font-size: .82rem;
  font-weight: 850;
}

.avatar-pack-price-field input {
  min-height: 38px;
  border-radius: 12px;
  border: 1px solid rgba(15,23,42,.14);
  padding: .45rem .6rem;
}

.avatar-shop-empty {
  padding: 1rem;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(236,253,245,.9), rgba(240,249,255,.88));
  border: 1px solid rgba(34,197,94,.18);
}

.avatar-shop-grid,
.avatar-shop-pack-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: .85rem;
  margin: .65rem 0 1rem;
}

.avatar-shop-card,
.avatar-shop-pack-card {
  display: grid;
  gap: .55rem;
  padding: .8rem;
  border-radius: 22px;
  background: #f8fafc;
  border: 1px solid rgba(226,232,240,.9);
  box-shadow: 0 12px 28px rgba(15,23,42,.06);
}

.avatar-shop-card img {
  width: 82px;
  height: 82px;
  border-radius: 24px;
  object-fit: cover;
  justify-self: center;
  box-shadow: 0 12px 26px rgba(15,23,42,.13);
}

.avatar-shop-card strong,
.avatar-shop-pack-card strong {
  font-weight: 950;
  text-align: center;
}

.avatar-shop-card small,
.avatar-shop-pack-card small {
  text-align: center;
  color: #64748b;
}

.avatar-shop-pack-preview {
  display: flex;
  justify-content: center;
  min-height: 60px;
}

.avatar-shop-pack-preview img {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  object-fit: cover;
  margin-left: -10px;
  border: 3px solid #fff;
  box-shadow: 0 10px 22px rgba(15,23,42,.12);
}

.avatar-shop-pack-preview img:first-child {
  margin-left: 0;
}

.avatar-shop-card form,
.avatar-shop-pack-card form {
  display: grid;
}

.avatar-shop-card button:disabled,
.avatar-shop-pack-card button:disabled {
  opacity: .55;
  cursor: not-allowed;
}

@media (max-width: 760px) {
  .avatar-shop-grid,
  .avatar-shop-pack-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .avatar-shop-card,
  .avatar-shop-pack-card {
    border-radius: 18px;
  }
}


/* Famille V2.0.194 — sécurité tailles avatars PC/mobile */
.fv2-avatar-theme-picker,
.fv2-avatar-picker,
.avatar-admin-grid,
.avatar-shop-grid,
.avatar-shop-pack-grid {
  max-width: 100%;
  overflow: hidden;
}

.fv2-avatar-picker {
  align-items: stretch;
}

.fv2-avatar-choice {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

.fv2-avatar-choice img,
.fv2-avatar-img,
.avatar-admin-item img,
.avatar-shop-card img,
.avatar-shop-pack-preview img {
  display: block;
  max-width: 100% !important;
  object-fit: cover !important;
}

/* Sélecteur profil / admin utilisateurs */
.fv2-avatar-choice img {
  width: 64px !important;
  height: 64px !important;
  min-width: 64px !important;
  max-width: 64px !important;
  min-height: 64px !important;
  max-height: 64px !important;
  border-radius: 18px !important;
}

.fv2-avatar-choice span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

/* Gestion admin avatars */
.avatar-admin-item {
  min-width: 0;
  overflow: hidden;
}

.avatar-admin-item img {
  width: 82px !important;
  height: 82px !important;
  min-width: 82px !important;
  max-width: 82px !important;
  min-height: 82px !important;
  max-height: 82px !important;
  border-radius: 22px !important;
}

.avatar-admin-item input,
.avatar-admin-item select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

/* Boutique profil enfant */
.avatar-shop-card,
.avatar-shop-pack-card {
  min-width: 0;
  overflow: hidden;
}

.avatar-shop-card img {
  width: 78px !important;
  height: 78px !important;
  min-width: 78px !important;
  max-width: 78px !important;
  min-height: 78px !important;
  max-height: 78px !important;
  border-radius: 22px !important;
}

.avatar-shop-pack-preview {
  max-width: 100%;
  overflow: hidden;
}

.avatar-shop-pack-preview img {
  width: 48px !important;
  height: 48px !important;
  min-width: 48px !important;
  max-width: 48px !important;
  min-height: 48px !important;
  max-height: 48px !important;
  border-radius: 16px !important;
}

.avatar-shop-card strong,
.avatar-shop-card small,
.avatar-shop-pack-card strong,
.avatar-shop-pack-card small {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Avatar affiché dans le hero profil : grand mais contrôlé */
.fv2-profile-avatar-img,
.fv2-profile-hero-avatar img {
  width: 78px !important;
  height: 78px !important;
  min-width: 78px !important;
  max-width: 78px !important;
  min-height: 78px !important;
  max-height: 78px !important;
  border-radius: 24px !important;
  object-fit: cover !important;
}

/* Protection globale dans les blocs avatars */
.fv2-avatar-fieldset img,
.profile-avatar-shop-card img,
.avatar-theme-admin-card img {
  height: auto;
  max-width: 100%;
}

@media (max-width: 900px) {
  .avatar-admin-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)) !important;
  }

  .avatar-shop-grid,
  .avatar-shop-pack-grid {
    grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)) !important;
  }
}

@media (max-width: 760px) {
  .fv2-avatar-theme .fv2-avatar-picker {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }

  .fv2-avatar-choice {
    min-height: 92px !important;
    padding: .48rem .32rem !important;
  }

  .fv2-avatar-choice img {
    width: 52px !important;
    height: 52px !important;
    min-width: 52px !important;
    max-width: 52px !important;
    min-height: 52px !important;
    max-height: 52px !important;
    border-radius: 15px !important;
  }

  .avatar-admin-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .avatar-admin-item img {
    width: 68px !important;
    height: 68px !important;
    min-width: 68px !important;
    max-width: 68px !important;
    min-height: 68px !important;
    max-height: 68px !important;
    border-radius: 18px !important;
  }

  .avatar-shop-grid,
  .avatar-shop-pack-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: .6rem !important;
  }

  .avatar-shop-card img {
    width: 62px !important;
    height: 62px !important;
    min-width: 62px !important;
    max-width: 62px !important;
    min-height: 62px !important;
    max-height: 62px !important;
    border-radius: 18px !important;
  }

  .avatar-shop-pack-preview img {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    max-width: 40px !important;
    min-height: 40px !important;
    max-height: 40px !important;
    border-radius: 14px !important;
    margin-left: -8px;
  }

  .fv2-profile-avatar-img,
  .fv2-profile-hero-avatar img {
    width: 64px !important;
    height: 64px !important;
    min-width: 64px !important;
    max-width: 64px !important;
    min-height: 64px !important;
    max-height: 64px !important;
    border-radius: 20px !important;
  }
}

@media (max-width: 420px) {
  .fv2-avatar-theme .fv2-avatar-picker {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .avatar-shop-grid,
  .avatar-shop-pack-grid,
  .avatar-admin-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}
