/**
 * Modern User Profile
 * Following best practices for contemporary profile layouts
 */

.user-profile-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-6);
}

/* Profile Header Card */
.user-profile-header {
  background: var(--color-bg-base);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  box-shadow: var(--shadow-md);
  margin-bottom: var(--space-6);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-6);
  align-items: start;
  transition: box-shadow var(--transition-base);
}

.user-profile-header:hover {
  box-shadow: var(--shadow-lg);
}

/* Avatar Section */
.user-profile-avatar {
  position: relative;
}

.user-profile-avatar img {
  width: 240px;
  height: 240px;
  border-radius: var(--radius-xl);
  object-fit: cover;
  box-shadow: var(--shadow-md);
  border: 4px solid var(--color-bg-subtle);
  transition: transform var(--transition-base);
}

.user-profile-avatar img:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-lg);
}

/* Main Info Section */
.user-profile-info {
  min-width: 0; /* Allow text truncation */
}

/* Name + gender on one baseline-aligned row */
.user-profile-name-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.user-profile-name {
  font-size: clamp(1.75rem, 1.2rem + 2.2vw, 2.5rem);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-base);
  margin: 0;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

/* Gender as a soft coloured pill instead of a bare icon */
.user-profile-gender {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  flex-shrink: 0;
}

.user-profile-gender.is-male {
  color: #3b82f6;
  background: color-mix(in srgb, #3b82f6 14%, transparent);
}

.user-profile-gender.is-female {
  color: #ec4899;
  background: color-mix(in srgb, #ec4899 14%, transparent);
}

/* Meta line under the name: id + instructor/course as tidy pills */
.user-profile-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.user-profile-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  padding: 0.3125rem 0.75rem 0.3125rem 0.375rem;
  border-radius: var(--radius-full);
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border-base);
  color: var(--color-text-base);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  line-height: 1.3;
}

.user-profile-chip > i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  flex-shrink: 0;
}

.user-profile-chip__text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-profile-chip--id {
  font-family: var(--font-family-mono, ui-monospace, monospace);
  font-weight: var(--font-weight-semibold);
  font-variant-numeric: tabular-nums;
}

.user-profile-chip--id > i {
  background: color-mix(in srgb, var(--color-primary) 15%, transparent);
  color: var(--color-primary);
}

.user-profile-chip--instructor > i {
  background: color-mix(in srgb, var(--ctp-blue) 15%, transparent);
  color: var(--ctp-blue);
}

/* Status Badges */
.user-profile-badges {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
}

.user-profile-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  background: var(--color-bg-subtle);
  color: var(--color-text-base);
  border-radius: var(--radius-full);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  border: 1px solid var(--color-border-base);
}

.user-profile-badge.is-instructor {
  background: var(--ctp-blue);
  color: white;
  border-color: var(--ctp-blue);
}

.user-profile-badge.is-suspended {
  background: var(--ctp-yellow);
  color: white;
  border-color: var(--ctp-yellow);
}

/* Contact Info */
.user-profile-contacts {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.user-profile-contact-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  background: var(--color-bg-subtle);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  text-decoration: none;
  color: var(--color-text-base);
  border: 1px solid transparent;
}

.user-profile-contact-item:hover {
  background: var(--color-bg-muted);
  border-color: var(--color-border-muted);
  transform: translateX(2px);
}

.user-profile-contact-item i {
  width: 20px;
  text-align: center;
  color: var(--color-primary);
}

/* Action Buttons Section */
.user-profile-actions {
  display: flex;
  flex-direction: row;
  gap: var(--space-2);
  align-items: center;
  flex-wrap: wrap;
  margin-top: var(--space-4);
}
/* History Sections */
.user-profile-section {
  background: var(--color-bg-base);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  box-shadow: var(--shadow-md);
  margin-bottom: var(--space-6);
}

.user-profile-section-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-4);
  border-bottom: 2px solid var(--color-border-base);
}

.user-profile-section-title {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-base);
  margin: 0;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.user-profile-section-title i {
  color: var(--color-primary);
}

/* Responsive Design */
@media (max-width: 768px) {
  .user-profile-container {
    padding: var(--space-4);
  }

  .user-profile-header {
    grid-template-columns: 1fr;
    padding: var(--space-5);
    text-align: center;
  }

  .user-profile-avatar {
    justify-self: center;
  }

  .user-profile-avatar img {
    width: 180px;
    height: 180px;
  }

  /* Keep the name row and id + instructor meta centered under the avatar */
  .user-profile-name-row,
  .user-profile-meta {
    justify-content: center;
  }

  .user-profile-section {
    padding: var(--space-4);
  }

  /* Stack action buttons full-width so they are easy to tap */
  .user-profile-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .user-profile-actions > .btn {
    width: 100%;
    justify-content: flex-start;
  }

  /* Contact rows read better left-aligned even in the centered header */
  .user-profile-contacts {
    text-align: left;
  }
}

/* Empty State */
.user-profile-empty {
  text-align: center;
  padding: var(--space-8);
  color: var(--color-text-muted);
}

.user-profile-empty i {
  font-size: 3rem;
  color: var(--color-border-strong);
  margin-bottom: var(--space-4);
}

/* Chat removal status */
.user-profile-badge.is-chat-removed {
  background: var(--ctp-red);
  color: white;
  border-color: var(--ctp-red);
}

/* ------------------------------------------------------------------ */
/* History cards (mobile) — shown only < 768px via .hidden-desktop.    */
/* Mirrors the seminars-list card pattern: `display` lives inside the  */
/* mobile media query so it never beats the .hidden-desktop utility    */
/* (equal specificity, later source order) on larger screens.          */
.profile-history-cards {
  flex-direction: column;
  gap: var(--space-3);
}

@media (max-width: 767px) {
  .profile-history-cards {
    display: flex;
  }
}

.profile-history-card {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.profile-history-card__main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.profile-history-card__title {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
  color: var(--color-foreground);
}

.profile-history-card__title a {
  color: var(--color-foreground);
  text-decoration: none;
}

.profile-history-card__meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  font-size: var(--font-size-xs);
  color: var(--color-muted-foreground);
}

.profile-history-card__meta i {
  flex-shrink: 0;
  font-size: 0.75em;
  opacity: 0.8;
}

.profile-history-card__meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-history-card__chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.profile-history-card__side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-1);
  flex-shrink: 0;
  text-align: right;
}

.profile-history-card__date,
.profile-history-card__year {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--color-foreground);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.profile-history-card__id {
  font-size: var(--font-size-xs);
  color: var(--color-muted-foreground);
  font-variant-numeric: tabular-nums;
}

/* Paid / check-in chips */
.profile-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  border: 1px solid transparent;
}

.profile-chip i {
  font-size: 0.85em;
}

.profile-chip--paid {
  background: color-mix(in srgb, var(--ctp-green) 15%, transparent);
  color: var(--ctp-green);
  border-color: color-mix(in srgb, var(--ctp-green) 30%, transparent);
}

.profile-chip--checkin {
  background: color-mix(in srgb, var(--ctp-blue) 15%, transparent);
  color: var(--ctp-blue);
  border-color: color-mix(in srgb, var(--ctp-blue) 30%, transparent);
}
