/* ============================================
   RENDERELLA - Reusable Components
   Profile display, avatar shapes, achievement badges
   ============================================ */

/* --- Profile Display (avatar + name + badges) --- */
.r-profile {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-xs);
  min-width: 0;
}
.r-profile-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* --- Avatar Base --- */
.r-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple));
  font-weight: 600;
  color: #000;
  overflow: hidden;
  flex-shrink: 0;
  line-height: 1;
}
.r-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* --- Avatar Shape Variants --- */
.r-avatar--circle {
  border-radius: var(--radius-full);
}
.r-avatar--square {
  border-radius: var(--radius-sm);
}
.r-avatar--diamond {
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
}
.r-avatar--triangle {
  clip-path: polygon(50% 5%, 95% 95%, 5% 95%);
}
.r-avatar--widow {
  clip-path: polygon(50% 0%, 65% 20%, 100% 10%, 80% 40%, 95% 70%, 65% 60%, 50% 100%, 35% 60%, 5% 70%, 20% 40%, 0% 10%, 35% 20%);
}
.r-avatar--hexagon {
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}
.r-avatar--shield {
  clip-path: polygon(50% 0%, 100% 15%, 95% 65%, 50% 100%, 5% 65%, 0% 15%);
}
.r-avatar--star {
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

/* --- Achievement Badge --- */
.r-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
  cursor: default;
  transition: transform 0.15s ease;
}
.r-badge:hover {
  transform: scale(1.2);
}
.r-badge ion-icon {
  font-size: 11px;
}

.r-badge-stack {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

/* --- Avatar Shape Picker (Account Settings) --- */
.avatar-shape-picker {
  display: flex;
  gap: var(--sp-sm);
  flex-wrap: wrap;
}
.avatar-shape-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-xs);
  cursor: pointer;
  padding: var(--sp-xs);
  border-radius: var(--radius-md);
  border: 2px solid transparent;
  transition: border-color 0.15s ease;
}
.avatar-shape-option:hover {
  border-color: var(--border-subtle);
}
.avatar-shape-option.active {
  border-color: var(--neon-cyan);
}
.avatar-shape-option .shape-label {
  font-size: 0.625rem;
  color: var(--text-muted);
  text-transform: capitalize;
}

/* --- Achievements Section (Account Dashboard) --- */
.achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--sp-md);
}
.achievement-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-sm);
  padding: var(--sp-md);
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  text-align: center;
}
.achievement-card .achievement-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
}
.achievement-card .achievement-icon ion-icon {
  font-size: 18px;
}
.achievement-card .achievement-label {
  font-size: 0.75rem;
  font-weight: 600;
}
.achievement-card .achievement-date {
  font-size: 0.625rem;
  color: var(--text-muted);
}
.achievement-card-empty {
  opacity: 0.3;
  border-style: dashed;
}

/* --- Hall of Fame Mosaic --- */
.hof-mosaic {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  grid-auto-rows: 220px;
  grid-auto-flow: dense;
  gap: var(--sp-sm);
}
.hof-tile {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, border-color 0.15s ease;
}
.hof-tile:hover {
  border-color: var(--border-active);
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4);
  z-index: 2;
}
.hof-tile--s    { grid-row: span 1; grid-column: span 1; }
.hof-tile--m    { grid-row: span 1; grid-column: span 2; }
.hof-tile--l    { grid-row: span 2; grid-column: span 2; }
.hof-tile--tall { grid-row: span 2; grid-column: span 1; }
.hof-tile--wide { grid-row: span 1; grid-column: span 2; }
.hof-tile-media {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.hof-tile-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 8px 10px;
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  justify-content: space-between;
  gap: 6px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.7) 10%, rgba(0, 0, 0, 0));
  color: #fff;
  opacity: 1;
  transition: background 0.18s ease;
  pointer-events: none;
}
.hof-tile:hover .hof-tile-overlay {
  background: linear-gradient(to top, rgba(0, 0, 0, 0.88) 30%, rgba(0, 0, 0, 0));
}
.hof-tile-overlay .r-profile {
  max-width: 60%;
  flex-shrink: 1;
  min-width: 0;
}
.hof-tile-overlay .r-profile-name {
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hof-tile-stats {
  display: flex;
  gap: 8px;
  font-size: 0.7rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  flex-shrink: 0;
}
.hof-stat {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.hof-stat ion-icon {
  font-size: 0.85rem;
}
.hof-stat--likes   ion-icon { color: #ff5b8a; }
.hof-stat--remixes ion-icon { color: #a855f7; }
.hof-stat--shares  ion-icon { color: #10b981; }

/* Achievement badges — icon-only circles (scattered corners) */
.hof-badge {
  position: absolute;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 14, 0.78);
  color: var(--badge, #FBBF24);
  border: 1px solid color-mix(in srgb, var(--badge, #FBBF24) 55%, transparent);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45),
              0 0 0 1px rgba(255, 255, 255, 0.05),
              0 0 12px color-mix(in srgb, var(--badge, #FBBF24) 35%, transparent);
  z-index: 1;
}
.hof-badge ion-icon { font-size: 14px; }
.hof-badge--tl { top: 8px;    left: 8px;  }
.hof-badge--tr { top: 8px;    right: 8px; }
.hof-badge--bl { bottom: 8px; left: 8px;  }
.hof-badge--br { bottom: 8px; right: 8px; }
/* Stack a second/third badge slightly offset so they don't collide */
.hof-badge--tl ~ .hof-badge--tl { top: 42px; }
.hof-badge--tr ~ .hof-badge--tr { top: 42px; }
.hof-badge--bl ~ .hof-badge--bl { bottom: 42px; }
.hof-badge--br ~ .hof-badge--br { bottom: 42px; }

/* Achievement pill labels — icon + text, always visible */
.hof-badge-pill {
  position: absolute;
  top: 8px;
  left: 8px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px 4px 7px;
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.88);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
  border: 1px solid color-mix(in srgb, var(--badge, #FBBF24) 50%, transparent);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5),
              0 0 10px color-mix(in srgb, var(--badge, #FBBF24) 25%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 2;
  pointer-events: none;
}
.hof-badge-pill ion-icon {
  font-size: 0.85rem;
  flex-shrink: 0;
  color: var(--badge, #FBBF24);
  filter: drop-shadow(0 0 3px color-mix(in srgb, var(--badge, #FBBF24) 50%, transparent));
}
/* Slightly brighter on tile hover */
.hof-tile:hover .hof-badge-pill {
  background: rgba(0, 0, 0, 0.92);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.6),
              0 0 14px color-mix(in srgb, var(--badge, #FBBF24) 35%, transparent);
}
@media (max-width: 768px) {
  .hof-badge-pill {
    font-size: 0.5625rem;
    padding: 2px 7px 2px 5px;
    gap: 3px;
    top: 6px;
    left: 6px;
  }
  .hof-badge-pill ion-icon { font-size: 0.65rem; }
}
/* Very small tiles: collapse pill to icon-only */
@media (max-width: 480px) {
  .hof-badge-pill .hof-badge-pill-label { display: none; }
  .hof-badge-pill {
    padding: 4px;
    border-radius: var(--radius-full);
  }
}
.hof-video-pip {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 26px;
  height: 26px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
}
.hof-video-pip ion-icon { font-size: 12px; }

/* --- Prompt Reveal (hide-by-default community prompt) --- */
.prompt-reveal {
  position: relative;
}
.prompt-reveal-text {
  display: none;
}
.prompt-reveal--open .prompt-reveal-text {
  display: block;
}
.prompt-reveal--open .prompt-reveal-btn {
  display: none;
}
.prompt-reveal-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.prompt-reveal-btn:hover {
  color: var(--text-primary);
  border-color: var(--neon-cyan);
  background: rgba(0, 240, 255, 0.05);
}
.prompt-reveal-btn ion-icon {
  font-size: 0.85rem;
}
/* Card context: sit as a compact pill inside tight cards */
.prompt-reveal--card .prompt-reveal-btn {
  padding: 2px 8px;
  font-size: 0.625rem;
}
.prompt-reveal--card .prompt-reveal-text {
  font-size: inherit;
  color: inherit;
}
.prompt-reveal--card.prompt-reveal--open .prompt-reveal-text {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
/* Cards that host a prompt-reveal should not themselves line-clamp —
   the clamping is now applied to the inner prompt-reveal-text. */
.gallery-item-prompt:has(.prompt-reveal) {
  display: block;
  -webkit-line-clamp: unset;
  overflow: visible;
  min-height: 2.6em;
}
/* Detail context: slightly larger, fits in sidebar */
.prompt-reveal--detail .prompt-reveal-btn {
  padding: 6px 12px;
  font-size: 0.75rem;
}
.prompt-empty {
  color: var(--text-disabled);
  font-style: italic;
}

.prompt-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.prompt-toggle-btn[data-state="on"],
.icon-btn[data-prompt-toggle][data-state="on"] {
  color: var(--neon-cyan);
}

/* --- Notification Bell --- */
.notification-bell {
  position: relative;
}
.notification-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  font-size: 0.6rem;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  color: #000;
  background: var(--neon-cyan);
  border-radius: var(--radius-full);
}

/* --- Notification Dropdown --- */
.notification-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  width: 320px;
  max-height: 400px;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  z-index: 1000;
  margin-top: var(--sp-xs);
}
.notification-list {
  padding: var(--sp-xs) 0;
}
.notification-item {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-sm);
  padding: var(--sp-sm) var(--sp-md);
  transition: background 0.1s ease;
}
.notification-item:hover {
  background: var(--bg-hover);
}
.notification-item.unread {
  background: rgba(0, 240, 255, 0.03);
}
.notification-content {
  min-width: 0;
  flex: 1;
}
.notification-title {
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.3;
}
.notification-time {
  margin-top: 2px;
}

@media (max-width: 768px) {
  .hof-mosaic {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    grid-auto-rows: 160px;
    gap: var(--sp-xs);
  }
  .hof-tile-overlay .r-profile-name {
    font-size: 0.65rem;
  }
  .hof-badge {
    width: 24px;
    height: 24px;
  }
  .hof-badge ion-icon {
    font-size: 12px;
  }
  .achievements-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }
  .notification-dropdown {
    width: calc(100vw - 32px);
    right: -8px;
  }
}
