/* ── EpsonFlow MVP — Avatar Detail Page ────────────────────── */

/* ── 1. Avatar Hero ───────────────────────────────────────── */
.avatar-hero {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
}

.avatar-hero__thumb {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--border);
  flex-shrink: 0;
}

.avatar-hero__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-hero__initials {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: var(--text-on-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  flex-shrink: 0;
}

.avatar-hero__info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.avatar-hero__top {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.avatar-hero__name {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.avatar-hero__meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  flex-wrap: wrap;
}

.avatar-hero__meta span + span::before {
  content: "\00B7";
  margin-right: 6px;
  color: var(--text-muted);
}

.avatar-hero__archetype {
  font-style: italic;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.avatar-hero__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

/* ── 2. Tabs ──────────────────────────────────────────────── */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  gap: 0;
}

.tabs__btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 12px 20px;
  font-family: var(--font);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.tabs__btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.tabs__btn--active {
  border-bottom-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.tabs__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 600;
  background: var(--bg-page);
  color: var(--text-muted);
}

/* ── 3. Tab Panels ────────────────────────────────────────── */
.tab-panel {
  display: none;
}

.tab-panel--active {
  display: block;
  padding-top: 24px;
}

/* ── 4. Gallery ───────────────────────────────────────────── */
.gallery-section {
  margin-bottom: 32px;
}

.gallery-section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.gallery-section__title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.gallery-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
  cursor: pointer;
}

.gallery-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: #D1D5DB;
}

.gallery-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.gallery-card__label {
  padding: 8px 12px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Gallery selection */
.gallery-card { display: block; position: relative; }
.gallery-card__check { display: none; }
.gallery-card__img-wrap { position: relative; }
.gallery-card__img-wrap img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}
.gallery-card__badge {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}
.gallery-card--selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-light);
}
.gallery-card--selected:hover {
  border-color: var(--accent);
}
.gallery-card:has(.gallery-card__check:checked) {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-light);
}
.gallery-section__actions {
  margin-top: 12px;
  display: flex;
  gap: 8px;
}
.gallery-form { width: 100%; }

/* ── 5. Profile ───────────────────────────────────────────── */
.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.profile-section {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.profile-section--wide {
  grid-column: span 2;
}

.profile-section__title {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.profile-bible {
  border-left: 4px solid var(--accent);
  padding-left: 16px;
  font-style: italic;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text-primary);
  margin: 0;
}

.profile-archetype {
  display: inline-block;
  background: var(--accent-light);
  color: var(--accent-text);
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.88rem;
  margin-bottom: 8px;
}

.profile-traits {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: inline-block;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.chip--sm {
  padding: 2px 8px;
  font-size: 0.72rem;
}

.profile-kv {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-light);
}

.profile-kv:last-child {
  border-bottom: none;
}

.profile-kv__key {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.profile-kv__val {
  font-weight: 500;
  font-size: 0.85rem;
  color: var(--text-primary);
}

.profile-callout {
  background: var(--bg-page);
  border-left: 3px solid var(--accent);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  line-height: 1.6;
  font-size: 0.88rem;
  color: var(--text-primary);
}

/* ── 6. Workshop Progress ─────────────────────────────────── */
.ws-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 32px;
  padding: 24px;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.ws-progress__step {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 80px;
}

.ws-progress__node {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--bg-white);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
  transition: all var(--transition);
}

.ws-progress__step--done .ws-progress__node {
  background: var(--green);
  border-color: var(--green);
  color: white;
}

.ws-progress__step--current .ws-progress__node {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

.ws-progress__label {
  margin-top: 6px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: center;
}

.ws-progress__step--done .ws-progress__label {
  color: var(--green);
}

.ws-progress__step--current .ws-progress__label {
  color: var(--accent);
  font-weight: 600;
}

.ws-progress__connector {
  flex: 1;
  height: 2px;
  background: var(--border);
  align-self: center;
  min-width: 40px;
  margin-bottom: 22px;
}

.ws-progress__connector--done {
  background: var(--green);
}

/* ── 7. Workshop Action ───────────────────────────────────── */
.ws-action {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: left;
}

.ws-action h3 {
  margin-bottom: 8px;
  font-size: 1.1rem;
  font-weight: 650;
  color: var(--text-primary);
}

.ws-action p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 16px;
}

.ws-prev {
  margin-top: 24px;
  border-top: 1px solid var(--border-light);
  padding-top: 16px;
}

.ws-prev__label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.ws-prev__thumbs {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.ws-prev__img {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: 1px solid var(--border);
}

/* ── 8. Workshop Images ───────────────────────────────────── */
.ws-images__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
}

.ws-images__card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.ws-images__card:hover {
  border-color: #D1D5DB;
  box-shadow: var(--shadow-sm);
}

.ws-images__card:has(input:checked) {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.ws-images__check {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
  cursor: pointer;
}

.ws-images__card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.ws-images__meta {
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.ws-images__prompt {
  padding: 0 12px 12px;
}

.ws-images__prompt summary {
  font-size: 0.78rem;
  color: var(--text-muted);
  cursor: pointer;
  font-weight: 500;
}

.ws-images__prompt pre {
  white-space: pre-wrap;
  font-size: 0.75rem;
  max-height: 100px;
  overflow-y: auto;
  background: var(--bg-page);
  padding: 8px;
  border-radius: var(--radius-sm);
  margin-top: 6px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.ws-images__card--failed {
  border-color: var(--red-border);
  background: var(--red-bg);
}

.ws-images__actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
}

/* ── 9. Workshop Enrichment ───────────────────────────────── */
.ws-enrichment__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin: 20px 0;
}

.ws-enrichment__card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color var(--transition), box-shadow var(--transition);
  cursor: pointer;
}

.ws-enrichment__card:hover {
  box-shadow: var(--shadow-sm);
  border-color: var(--border-focus);
}

.ws-enrichment__card:has(input:checked) {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.ws-enrichment__label {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.ws-enrichment__archetype {
  font-style: italic;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 8px;
}

.ws-enrichment__refine {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
}

/* ── 10. Workshop Spinner ─────────────────────────────────── */
.ws-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.ws-spinner__dots {
  display: flex;
  gap: 6px;
}

.ws-spinner__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  animation: pulse 1.2s ease-in-out infinite;
}

.ws-spinner__dot:nth-child(2) {
  animation-delay: 0.2s;
}

.ws-spinner__dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes pulse {
  0%, 100% {
    opacity: 0.3;
    transform: scale(0.8);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}

/* ── 11. History ──────────────────────────────────────────── */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.history-item:hover {
  box-shadow: var(--shadow-sm);
  border-color: var(--border-focus);
  color: inherit;
}

.history-item__thumb {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
}

.history-item__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.history-item__placeholder {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: var(--bg-page);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  flex-shrink: 0;
}

.history-item__info {
  flex: 1;
  min-width: 0;
}

.history-item__title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.history-item__meta {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ── 12. Empty State (avatar detail variant) ──────────────── */
.empty-state--inline {
  padding: 60px 20px;
  text-align: center;
}

.empty-state--inline .empty-state__icon {
  font-size: 2rem;
  margin-bottom: 12px;
}

/* ── 13. Responsive ───────────────────────────────────────── */
@media (max-width: 768px) {
  .avatar-hero {
    flex-direction: column;
    text-align: center;
    align-items: center;
  }

  .avatar-hero__info {
    align-items: center;
  }

  .avatar-hero__top {
    justify-content: center;
  }

  .avatar-hero__meta {
    justify-content: center;
  }

  .avatar-hero__actions {
    justify-content: center;
  }

  .profile-grid {
    grid-template-columns: 1fr;
  }

  .profile-section--wide {
    grid-column: span 1;
  }

  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }

  .ws-images__grid {
    grid-template-columns: 1fr;
  }

  .ws-progress {
    overflow-x: auto;
    justify-content: flex-start;
    padding: 16px;
  }

  .ws-enrichment__grid {
    grid-template-columns: 1fr;
  }

  .tabs {
    overflow-x: auto;
  }

  .tabs__btn {
    white-space: nowrap;
    flex-shrink: 0;
  }
}
