/* ============================================================
   TagYourSpot — Avatar Selector (thème app)
   ============================================================ */

#tys-avatar-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  align-items: flex-end;
  justify-content: center;
  animation: tys-fade-in 0.2s ease;
}

@keyframes tys-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Bottom sheet — thème clair comme le panel settings ── */
.tys-av-sheet {
  width: 100%;
  max-width: 520px;
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(22px) saturate(160%);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  border-radius: 24px 24px 0 0;
  border-top: 1px solid rgba(255, 255, 255, 0.6);
  padding: 0 0 env(safe-area-inset-bottom, 20px);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  animation: tys-slide-up 0.32s cubic-bezier(.25,.8,.25,1);
  overflow: hidden;
  box-shadow: 0 -4px 32px rgba(0, 0, 0, 0.12);
}

@keyframes tys-slide-up {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ── Poignée ── */
.tys-av-handle {
  width: 36px;
  height: 4px;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 2px;
  margin: 12px auto 0;
  flex-shrink: 0;
}

/* ── Header ── */
.tys-av-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px 12px;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.07);
}

.tys-av-header-title {
  font-size: 17px;
  font-weight: 700;
  color: rgba(0, 0, 0, 0.85);
  font-family: Arial, sans-serif;
  letter-spacing: -0.3px;
}

.tys-av-reset {
  background: rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(0, 0, 0, 0.1);
  color: rgba(0, 0, 0, 0.5);
  font-size: 12px;
  font-weight: 600;
  font-family: Arial, sans-serif;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.tys-av-reset:hover {
  background: rgba(0, 0, 0, 0.1);
  color: rgba(0, 0, 0, 0.8);
}

/* ── Zone scrollable ── */
.tys-av-scroll {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 18px 16px 28px;
  flex: 1;
}

/* ── Groupe ── */
.tys-av-group {
  margin-bottom: 26px;
}

.tys-av-group-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 12px;
  padding-left: 2px;
  font-family: Arial, sans-serif;
  color: rgba(0, 0, 0, 0.45);
}

/* ── Grille 4 colonnes ── */
.tys-av-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

@media (max-width: 360px) {
  .tys-av-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
}

/* ── Item ── */
.tys-av-item {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 16px;
  padding: 6px;
  transition: transform 0.15s, background 0.15s, border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
  border: 2px solid transparent;
  background: rgba(255, 255, 255, 0.5);
}

.tys-av-item:active {
  transform: scale(0.9);
}

.tys-av-img {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: contain;
  display: block;
  image-rendering: auto;
  backface-visibility: hidden;
  transform: translateZ(0);
}

/* ── Sélectionné ── */
.tys-av-item.tys-av-selected {
  background: rgba(33, 150, 243, 0.12);
  border-color: #2196F3;
  transform: scale(1.05);
}

/* ── Mode sombre ── */
body.dark .tys-av-sheet {
  background: rgba(28, 32, 48, 0.88);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 -4px 32px rgba(0, 0, 0, 0.4);
}

body.dark .tys-av-handle {
  background: rgba(255, 255, 255, 0.2);
}

body.dark .tys-av-header {
  border-bottom-color: rgba(255, 255, 255, 0.07);
}

body.dark .tys-av-header-title {
  color: rgba(255, 255, 255, 0.92);
}

body.dark .tys-av-reset {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.5);
}

body.dark .tys-av-reset:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

body.dark .tys-av-group-label {
  color: rgba(255, 255, 255, 0.4);
}

body.dark .tys-av-item {
  background: rgba(255, 255, 255, 0.05);
}

body.dark .tys-av-item.tys-av-selected {
  background: rgba(33, 150, 243, 0.2);
  border-color: #2196F3;
}

/* ── Animations ── */
@keyframes tys-pop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.2); }
  100% { transform: scale(1); }
}

#tys-avatar-bubble.tys-av-pop {
  animation: tys-pop 0.35s cubic-bezier(.36,.07,.19,.97);
}

#tys-avatar-bubble {
  transition: transform 0.2s;
}

#tys-avatar-bubble img {
  image-rendering: auto;
  backface-visibility: hidden;
  transform: translateZ(0);
}
