/* ============================================================
   FlowStash — Public Profile Shared Styles
   Used by /seller/[handle] and /buyer/[handle]
   ============================================================ */

/* ── Profile Hero ── */
.pub-profile {
  padding: var(--space-12) 0 var(--space-16);
}

.pub-profile__hero {
  display: flex;
  align-items: flex-start;
  gap: var(--space-8);
  margin-bottom: var(--space-12);
  padding-bottom: var(--space-10);
  border-bottom: 1px solid var(--border-subtle);
}

.pub-profile__avatar-wrap {
  flex-shrink: 0;
  position: relative;
}

.pub-profile__avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(124, 58, 237, 0.25);
  background: var(--bg-tertiary);
  box-shadow: 0 0 20px rgba(124, 58, 237, 0.15);
}

.pub-profile__avatar-initials {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 700;
  background: rgba(124, 58, 237, 0.10);
  color: #a78bfa;
  border: 2px solid rgba(124, 58, 237, 0.25);
  flex-shrink: 0;
  box-shadow: 0 0 20px rgba(124, 58, 237, 0.12);
}

.pub-profile__info {
  flex: 1;
  min-width: 0;
}

.pub-profile__name {
  font-size: var(--text-3xl);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-tighter);
  margin-bottom: var(--space-1);
  line-height: 1.1;
}

.pub-profile__handle {
  font-size: var(--text-sm);
  color: var(--text-ghost);
  font-family: var(--font-mono);
  margin-bottom: var(--space-3);
}

.pub-profile__tagline {
  font-size: var(--text-base);
  color: var(--text-secondary);
  margin-bottom: var(--space-3);
}

.pub-profile__bio {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 600px;
  margin-bottom: var(--space-4);
}

.pub-profile__links {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.pub-profile__link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  color: #a78bfa;
  text-decoration: none;
  transition: opacity var(--duration-fast);
}

.pub-profile__link:hover { opacity: 0.7; }

/* ── Stats Row ── */
.pub-profile__stats {
  display: flex;
  gap: var(--space-8);
  flex-wrap: wrap;
  margin-top: var(--space-4);
}

.pub-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pub-stat__value {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  font-family: var(--font-mono);
  background: var(--gradient-accent-text);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.pub-stat__label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-widest);
  color: var(--text-ghost);
}

/* ── Section ── */
.pub-section {
  margin-bottom: var(--space-14);
}

.pub-section__title {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.pub-section__count {
  font-size: var(--text-sm);
  font-family: var(--font-mono);
  color: var(--text-ghost);
  font-weight: var(--weight-normal);
}

/* ── Products Grid ── */
.pub-products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-6);
}

.pub-product-card {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  background: var(--bg-secondary);
  transition: all var(--duration-normal);
  cursor: pointer;
  text-decoration: none;
  display: block;
  color: inherit;
  box-shadow: var(--shadow-glow-card);
}

.pub-product-card:hover {
  transform: translateY(-3px);
  border-color: rgba(124, 58, 237, 0.25);
  background: var(--bg-tertiary);
  box-shadow: var(--shadow-md), var(--planet-glow-sm);
}

.pub-product-card__name {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  margin-bottom: var(--space-2);
  line-height: 1.3;
}

.pub-product-card__desc {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-bottom: var(--space-4);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pub-product-card__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pub-product-card__rating {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.pub-product-card__price {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  background: var(--gradient-accent-text);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-family: var(--font-mono);
}

.pub-product-card__price--free {
  color: var(--success);
}

/* ── Reviews List ── */
.pub-reviews-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.pub-review-card {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  background: var(--bg-secondary);
  box-shadow: var(--shadow-glow-card);
}

.pub-review-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-3);
  gap: var(--space-4);
}

.pub-review-card__meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pub-review-card__reviewer {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-primary);
}

.pub-review-card__context {
  font-size: var(--text-xs);
  color: var(--text-ghost);
  font-family: var(--font-mono);
}

.pub-review-card__stars {
  font-size: var(--text-sm);
  color: var(--warning);
  white-space: nowrap;
  flex-shrink: 0;
}

.pub-review-card__comment {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ── Purchases Grid (buyer page) ── */
.pub-purchases-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--space-4);
}

.pub-purchase-card {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-5);
  background: var(--bg-secondary);
  text-decoration: none;
  display: block;
  color: inherit;
  transition: all var(--duration-fast);
}

.pub-purchase-card:hover {
  border-color: var(--border-hover);
  background: var(--bg-tertiary);
}

.pub-purchase-card__name {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  margin-bottom: var(--space-1);
  color: var(--text-primary);
}

.pub-purchase-card__date {
  font-size: var(--text-xs);
  color: var(--text-ghost);
  font-family: var(--font-mono);
}

/* ── Empty State ── */
.pub-empty {
  text-align: center;
  padding: var(--space-12);
  color: var(--text-ghost);
}

.pub-empty svg {
  margin-bottom: var(--space-4);
  opacity: 0.3;
}

.pub-empty p {
  font-size: var(--text-sm);
}

/* ── Loading / Not Found ── */
.pub-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  gap: var(--space-4);
  color: var(--text-ghost);
}

.pub-not-found {
  text-align: center;
  padding: var(--space-20) 0;
}

.pub-not-found__code {
  font-size: 5rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--border-subtle);
  line-height: 1;
  margin-bottom: var(--space-4);
}

/* ── Profile edit form (in my-profile & dashboard) ── */
.public-profile-form {
  max-width: 600px;
}

.avatar-editor {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  margin-bottom: var(--space-8);
  padding: var(--space-6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  background: var(--bg-card);
  transition: border-color var(--duration-normal), background var(--duration-normal);
}

.avatar-editor:hover {
  border-color: rgba(124, 58, 237, 0.20);
  background: var(--bg-tertiary);
}

.avatar-editor__wrap {
  position: relative;
  flex-shrink: 0;
  cursor: pointer;
  border-radius: 50%;
  display: block;
}

.avatar-editor__overlay {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--duration-normal);
}

.avatar-editor__wrap:hover .avatar-editor__overlay {
  opacity: 1;
}

.avatar-editor__preview {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(124, 58, 237, 0.25);
  display: block;
  background: var(--bg-tertiary);
  box-shadow: 0 0 16px rgba(124, 58, 237, 0.12);
}

.avatar-editor__preview--initials {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 700;
  color: #a78bfa;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: 2px solid rgba(124, 58, 237, 0.25);
  background: rgba(124, 58, 237, 0.08);
  box-shadow: 0 0 16px rgba(124, 58, 237, 0.12);
}

.avatar-editor__content {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  flex: 1;
}

.avatar-editor__label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-primary);
  margin: 0 0 var(--space-1);
}

.avatar-editor__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.avatar-editor__note {
  font-size: var(--text-xs);
  color: var(--text-ghost);
  margin: 0;
}

.handle-availability {
  font-size: var(--text-xs);
  margin-top: var(--space-1);
  font-family: var(--font-mono);
  height: 16px;
}

.handle-availability--ok    { color: var(--success); }
.handle-availability--taken { color: var(--error); }
.handle-availability--checking { color: var(--text-ghost); }

.profile-public-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-secondary);
  margin-bottom: var(--space-6);
}

.profile-public-toggle__info { max-width: 380px; }
.profile-public-toggle__label {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  margin-bottom: 2px;
}
.profile-public-toggle__desc {
  font-size: var(--text-xs);
  color: var(--text-ghost);
}

/* Checkbox square */
.checkbox-square {
  position: relative;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  cursor: pointer;
  display: block;
}
.checkbox-square input {
  opacity: 0;
  position: absolute;
  width: 0;
  height: 0;
}
.checkbox-square__box {
  position: absolute;
  inset: 0;
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--duration-fast), border-color var(--duration-fast);
}
.checkbox-square__box svg {
  opacity: 0;
  transform: scale(0.7);
  transition: opacity var(--duration-fast), transform var(--duration-fast);
  color: var(--text-inverse);
}
.checkbox-square input:checked + .checkbox-square__box {
  background: var(--gradient-accent);
  border-color: var(--accent);
}
.checkbox-square input:checked + .checkbox-square__box svg {
  opacity: 1;
  transform: scale(1);
}

.profile-view-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: #a78bfa;
  text-decoration: none;
  margin-bottom: var(--space-8);
  transition: opacity var(--duration-fast);
}
.profile-view-link:hover { opacity: 0.7; }
.profile-view-link svg { flex-shrink: 0; }

/* ── Seller Rating Badge (dashboard edit form) ── */
.seller-rating-badge {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  /* Reset standalone bar styles */
  padding: 0;
  border: none;
  background: transparent;
  margin-bottom: 0;
}

.seller-rating-badge__row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.seller-rating-badge__empty {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* Star icons */
.seller-rating-badge__stars {
  display: inline-flex;
  gap: 1px;
  font-size: var(--text-base);
  line-height: 1;
}

.seller-rating-badge__stars--empty .seller-rating-badge__star,
.seller-rating-badge__stars--empty {
  color: var(--text-ghost);
  letter-spacing: 1px;
}

.seller-rating-badge__star {
  display: inline-block;
  transition: color var(--duration-fast);
}

.seller-rating-badge__star--full {
  color: var(--warning);
}

.seller-rating-badge__star--half {
  color: var(--warning);
  opacity: 0.6;
}

.seller-rating-badge__star--empty {
  color: var(--text-ghost);
}

/* Numeric average */
.seller-rating-badge__avg {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  font-family: var(--font-mono);
  color: var(--text-primary);
  letter-spacing: var(--tracking-tight);
}

/* Review count */
.seller-rating-badge__count {
  font-size: var(--text-xs);
  color: var(--text-ghost);
  font-family: var(--font-mono);
}

/* Empty state label */
.seller-rating-badge__label {
  font-size: var(--text-xs);
  color: var(--text-ghost);
  font-family: var(--font-mono);
}

/* ── Mobile 480px ── */
@media (max-width: 480px) {
  .pub-profile__hero {
    flex-direction: column;
    gap: var(--space-4);
  }

  .pub-profile__name {
    font-size: var(--text-xl);
  }

  .pub-profile__bio {
    font-size: var(--text-sm);
  }

  .pub-profile__stats {
    flex-wrap: wrap;
    gap: var(--space-3);
  }
}

/* ── Mobile ── */
@media (max-width: 640px) {
  .pub-profile__hero {
    flex-direction: column;
    gap: var(--space-5);
  }

  .pub-profile__name {
    font-size: var(--text-2xl);
  }

  .pub-profile__stats {
    gap: var(--space-5);
  }

  .pub-products-grid {
    grid-template-columns: 1fr;
  }

  .pub-purchases-grid {
    grid-template-columns: 1fr;
  }

  .avatar-editor {
    flex-direction: column;
    align-items: center;
    gap: var(--space-4);
    text-align: center;
  }

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

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