/* ── PROFILE VIEWER BOTTOM SHEET ─────────── */
.pv-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 9999;
  display: none;
  align-items: flex-end;
  justify-content: center;
}
.pv-overlay.open {
  display: flex;
}
.pv-sheet {
  width: 100%;
  max-width: 500px;
  background: #0B0C0E;
  border-radius: 16px 16px 0 0;
  transform: translateY(105%);
  /* La hoja completa ya NO scrollea como un solo bloque: solo la parte
     de abajo (bio/miembro desde/roles/nota) lo hace, dentro de
     .pv-scroll-body. Esto evita el hueco negro vacío que quedaba tras
     el "encabezado" (banner+avatar+nombre) cuando el contenido era corto. */
  /* Antes solo tenía max-height, así que con poco contenido la hoja se
     encogía y el "tope" (borde superior) bajaba — no quedaba fijo.
     Ahora se fija tanto el máximo como el alto real, así el tope
     siempre queda en el mismo sitio sin importar cuánto contenido haya;
     lo que varía es cuánto scrollea .pv-scroll-body por dentro. */
  height: 78vh;
  max-height: 78vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  transition: transform 0.32s cubic-bezier(0.34,1.06,0.64,1);
}
.pv-overlay.open .pv-sheet {
  transform: translateY(0);
}

/* Loading state: shown while avatar/banner/profile data "load" so the
   sheet doesn't pop content in abruptly. Sits on top of pv-scroll-body,
   same rounded top corners as the sheet, solid #0C0B0E background. */
.pv-loading {
  position: absolute;
  inset: 0;
  background: #0C0B0E;
  border-radius: 16px 16px 0 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 20;
  opacity: 1;
  transition: opacity 0.22s ease;
}
.pv-loading.show { display: flex; }
.pv-loading.fade-out { opacity: 0; }
.pv-loading-dots {
  display: flex;
  gap: 8px;
}
.pv-loading-dots span {
  width: 9px;
  height: 9px;
  border-radius: 3px; /* slightly squared corners, not fully round */
  background: rgba(255,255,255,0.55);
  animation: pvDotBounce 1.1s ease-in-out infinite;
}
.pv-loading-dots span:nth-child(2) { animation-delay: 0.15s; }
.pv-loading-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes pvDotBounce {
  0%, 80%, 100% { transform: scale(0.72); opacity: 0.45; }
  40% { transform: scale(1); opacity: 1; }
}

/* Drag handle area */
.pv-drag-handle {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 0 4px;
  cursor: grab;
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 10;
  background: transparent;
  touch-action: none;
}
.pv-drag-handle:active { cursor: grabbing; }
.pv-drag-pill {
  width: 36px; height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,0.55);
}

/* Banner */
.pv-banner {
  height: 224px !important;
  background: var(--accent);
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}

/* Status badge on avatar */
.pv-status-badge {
  position: absolute;
  bottom: 2px; right: 2px;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: #0B0C0E;
  border: 3px solid #0B0C0E;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  pointer-events: none;
  z-index: 5;
}
.pv-status-badge img {
  width: 100%; height: 100%;
  object-fit: contain; display: block;
}

/* Bloque que envuelve avatar + nombre/tag/botones. Se pinta con un
   degradado propio, medido sobre SU alto real (0% -> 100%) en vez de
   posiciones en píxeles fijas, para que nunca quede un tramo "pegado"
   al color oscuro formando una caja opaca pegada a la base del banner. */
.pv-header-block {
  position: relative;
}

/* Avatar */
.pv-avatar-wrap {
  padding: 0 16px;
  margin-top: -44px !important;
  margin-bottom: 8px;
  flex-shrink: 0;
}
.pv-avatar-ring {
  position: relative;
  display: inline-block;
  width: 88px; height: 88px;
}
.pv-avatar {
  width: 88px; height: 88px;
  border-radius: 50%;
  background: #0B0C0E;
  border: 6px solid #0B0C0E;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; font-weight: 700; color: #fff;
  overflow: hidden; position: relative;
}
.pv-avatar img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
}

/* Info */
.pv-info {
  padding: 4px 16px 8px;
  flex-shrink: 0;
}
.pv-name-row {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 8px;
}
.pv-more-btn {
  background: #2b2d31; border: none; border-radius: 50%;
  width: 36px; height: 36px; min-width: 36px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: #e0e1e5;
  margin-top: 2px;
}
.pv-more-btn:hover { background: #35373c; }
.pv-username {
  font-size: 1.25rem; font-weight: 800;
  color: var(--pv-text, #ffffff);
}
.pv-tag {
  font-size: 0.85rem; color: var(--pv-text, #ffffff); opacity: 0.6;
  margin-bottom: 4px;
  display: flex; align-items: center; gap: 4px;
  overflow: visible;
}
.pv-bio {
  font-size: 0.88rem; color: var(--pv-text, #ffffff);
  white-space: pre-wrap;
}
.pv-bio-section { margin-bottom: 0; }
.pv-bio-label { display: none; }
.pv-member-since {
  font-size: 0.88rem; color: var(--pv-text, #ffffff);
  display: block;
}
.pv-member-section { margin-bottom: 0; }
.pv-combined-section { display: flex; flex-direction: column; gap: 12px; }

/* ── Contenedor scrollable interno ───────────────────────────
   Ahora envuelve TODO el contenido (banner, avatar, nombre y las
   secciones) — el único elemento que queda fuera y fijo es el
   "drag handle" de arriba. El límite de 1px (#323234) queda así justo
   debajo del handle (arriba del banner) y al final del contenido. El
   recuadro en sí (.pv-sheet) no cambia de tamaño al hacer scroll: solo
   se desplaza el contenido de dentro. */
.pv-scroll-body {
  flex: 1 1 auto;
  min-height: 60px;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  border-top: 1px solid #323234;
  border-bottom: 1px solid #323234;
  padding-bottom: 12px;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
  transition: scrollbar-color 0.25s ease;
}
.pv-scroll-body.pv-scrolling {
  scrollbar-color: #37383A transparent;
}
.pv-scroll-body::-webkit-scrollbar {
  width: 5px;
}
.pv-scroll-body::-webkit-scrollbar-track {
  background: transparent;
}
.pv-scroll-body::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 3px;
  transition: background 0.25s ease;
}
.pv-scroll-body.pv-scrolling::-webkit-scrollbar-thumb {
  background: #37383A;
}

/* Sections */
.pv-section {
  margin: 0 12px 10px;
  /* Sin color de perfil: tarjeta oscura sólida de siempre (igual que
     "Tú"). Con color: --pv-card-bg/--pv-card-border/--pv-card-blur se
     rellenan en JS con los valores glassmorphism (blanco translúcido +
     blur + borde sutil) — ver openProfileViewer, sistema de color. */
  background: var(--pv-card-bg, #22252C);
  border: var(--pv-card-border, none);
  -webkit-backdrop-filter: var(--pv-card-blur, none);
  backdrop-filter: var(--pv-card-blur, none);
  border-radius: 8px;
  padding: 12px 14px;
}
.pv-section-label {
  font-size: 0.72rem; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--pv-text, #ffffff); opacity: 1;
  margin-bottom: 6px;
  display: flex; align-items: center; gap: 8px;
}
.pv-note-edit {
  cursor: pointer; opacity: 1; color: var(--pv-text, #ffffff);
  display: flex; align-items: center; margin-left: auto;
}
.pv-note-edit:hover { opacity: 0.8; }
.pv-section-value {
  font-size: 0.88rem; color: var(--pv-text, #ffffff);
}
.pv-roles-empty {
  font-size: 0.82rem; color: var(--pv-text, #ffffff); opacity: 0.75;
  font-style: italic;
}
.pv-roles-add-btn {
  margin-left: auto; width: 22px; height: 22px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; border: none; cursor: pointer;
  background: rgba(255,255,255,.12); color: var(--pv-text, #ffffff);
  transition: .12s;
}
.pv-roles-add-btn:hover { background: rgba(255,255,255,.22); }
.pv-roles-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.pv-role-chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(0,0,0,.28); border-radius: 8px;
  padding: 6px 12px 6px 6px; cursor: pointer; border: none; transition: .12s;
}
.pv-role-chip:hover { background: rgba(0,0,0,.4); }
.pv-role-chip-dot-wrap { position: relative; width: 20px; height: 20px; flex-shrink: 0; }
.pv-role-chip-dot {
  position: absolute; inset: 0; border-radius: 50%; background: #e3e5e8;
}
.pv-role-chip-x {
  position: absolute; inset: 0; border-radius: 50%;
  background: rgba(0,0,0,.55); color: #fff;
  display: none; align-items: center; justify-content: center;
}
.pv-role-chip.selected .pv-role-chip-x { display: flex; }
.pv-role-chip-name { font-size: 0.85rem; font-weight: 600; color: var(--pv-text, #ffffff); }
.pv-note-value {
  font-size: 0.85rem; color: var(--pv-text, #ffffff); opacity: 0.85;
}
.pv-note-section { margin-bottom: 24px; }

/* ── PROFILE MODAL (edit modal in index) ─────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
}
.modal-overlay.open { display: flex; }

.modal-box {
  background: #161719;
  border-radius: 12px;
  width: min(480px, 95vw);
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}
.modal-close {
  position: absolute; top: 12px; right: 12px;
  background: none; border: none;
  color: var(--text-muted); font-size: 1.1rem;
  cursor: pointer; padding: 4px 8px; border-radius: 4px;
}
.modal-close:hover { background: var(--bg-hover); color: var(--text); }
.modal-title {
  font-size: 1rem; font-weight: 700;
  color: var(--text-header);
  padding: 20px 20px 0;
}

/* Banner */
.profile-banner-wrap {
  position: relative;
  height: 100px;
  margin-top: 12px;
}
.profile-banner {
  height: 100%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  background-size: cover;
  background-position: center;
  cursor: pointer;
}
.banner-edit-btn {
  background: rgba(0,0,0,0.45);
  color: #fff;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background var(--transition);
}
.banner-edit-btn:hover { background: rgba(0,0,0,0.65); }

/* Avatar */
.profile-avatar-wrap {
  display: flex;
  padding: 0 20px;
  margin-top: -28px;
  margin-bottom: 12px;
}
.profile-avatar-ring { position: relative; }
.profile-avatar-circle {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: var(--accent);
  border: 6px solid #191B20;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; font-weight: 700; color: #fff;
  overflow: hidden;
  position: relative;
}
.profile-avatar-circle img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
.avatar-edit-btn {
  position: absolute; bottom: 2px; right: 2px;
  width: 24px; height: 24px;
  background: var(--accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem;
  cursor: pointer;
  border: 2px solid #191B20;
}

/* Form fields */
.profile-form {
  padding: 0 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.profile-form label {
  font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  margin-top: 10px;
}
.profile-form input,
.profile-form select {
  background: var(--bg-dark);
  border: 1px solid #26292F;
  border-radius: 4px;
  padding: 9px 10px;
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
  width: 100%;
}
.profile-form select { cursor: pointer; }

.save-profile-btn {
  margin-top: 16px;
  background: var(--accent);
  border: none; color: #fff;
  padding: 10px;
  border-radius: 4px;
  font-size: 0.9rem; font-weight: 700;
  cursor: pointer;
  transition: background var(--transition);
}
.save-profile-btn:hover { background: var(--accent-hover); }

.save-feedback {
  font-size: 0.82rem;
  color: var(--green);
  text-align: center;
  min-height: 1.2em;
}

/* ── ATTACH BOTTOM SHEET ─────────────────── */
.attach-sheet {
  width: 100%;
  max-width: 500px;
  background: #25272A;
  border-radius: 20px 20px 0 0;
  transform: translateY(105%);
  overflow: hidden;
  position: relative;
  transition: transform 0.32s cubic-bezier(0.34,1.06,0.64,1);
}
.attach-sheet-body {
  padding: 12px 16px 40px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.attach-sheet-grid {
  flex-direction: row !important;
  justify-content: center;
  gap: 20px !important;
  padding: 24px 20px 44px !important;
}
.attach-grid-item {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 10px !important;
  width: 90px !important;
  height: auto !important;
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  font-size: 0.82rem !important;
  font-weight: 600 !important;
  color: #dbdee1 !important;
  cursor: pointer;
  text-align: center;
  transition: opacity 0.15s;
}
.attach-grid-item:hover { opacity: 0.8; }
.attach-grid-item:active { opacity: 0.6; }
.attach-grid-sub {
  display: block;
  margin-top: -8px;
  font-size: 0.75rem;
  color: #949ba4;
  font-weight: 500;
}
.attach-grid-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}
.attach-icon-camera { background: #1e1f22; border: 2.5px solid #3c3f44; }
.attach-icon-camera-video { background: #fff; border: 2.5px solid #e0e0e0; color: #111 !important; }
.attach-icon-camera-video svg { fill: #111; }
.attach-icon-files { background: #5865f2; }
.attach-sheet-item {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  background: #2A2D34;
  border: 2px solid #25272A;
  border-radius: 16px;
  padding: 20px 22px;
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}
.attach-sheet-item:hover { background: #32353d; }
.attach-sheet-item:active { background: #26292F; }
.attach-sheet-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}
