/* ============================================================
   FutiaSpace — profile.css
   Dark-mode first, CSS-variable-driven, no hardcoded colours.
   Colours updated to FUTIA official palette.
   ============================================================ */

/* ── Reset / base ─────────────────────────────────────────── */
.profile-page {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 0 80px;
  display: flex;
  flex-direction: column;
  gap: 0;
  animation: profileFadeIn 0.35s ease both;
}

@keyframes profileFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0);    }
}

/* ── Profile header card ──────────────────────────────────── */
.profile-header {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 24px 28px;
  text-align: center;
  background: var(--bg-surface);
  overflow: hidden;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

/* Ambient gradient splash behind the header */
.profile-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%,
      color-mix(in srgb, var(--violet-600) 28%, transparent),
      transparent 70%);
  pointer-events: none;
}

/* Subtle grid texture overlay */
.profile-header::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
  opacity: 0.5;
}

/* ── Avatar ───────────────────────────────────────────────── */
.profile-avatar-large {
  position: relative;
  z-index: 1;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  flex-shrink: 0;

  /* Ring: brand gradient */
  box-shadow:
    0 0 0 3px var(--bg-surface),
    0 0 0 5px var(--violet-500),
    0 8px 28px rgba(0, 0, 0, 0.45);

  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.profile-avatar-large:hover {
  transform: scale(1.04);
  box-shadow:
    0 0 0 3px var(--bg-surface),
    0 0 0 5px var(--violet-400),
    0 12px 36px rgba(0, 0, 0, 0.55);
}

.profile-avatar-large img,
.profile-avatar-large .avatar-initials {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.profile-avatar-large .avatar-initials {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  font-weight: 700;
  background: var(--gradient-brand);
  color: #fff;
  letter-spacing: 0.02em;
}

/* ── Name ─────────────────────────────────────────────────── */
.profile-name {
  position: relative;
  z-index: 1;
  margin: 14px 0 4px;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.profile-name .verified-badge,
.verified-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  vertical-align: middle;
  margin-left: 3px;
}

.profile-name .verified-badge svg,
.verified-badge svg {
  width: 12px;
  height: 12px;
  stroke: #fff;
  stroke-width: 2.5;
}

/* ── Dept / Level / Gender ────────────────────────────────── */
.profile-dept-level {
  position: relative;
  z-index: 1;
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin: 0 0 8px;
  letter-spacing: 0.01em;
}

/* ── Bio ──────────────────────────────────────────────────── */
.profile-bio {
  position: relative;
  z-index: 1;
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 420px;
  margin: 0 0 16px;
}

/* ── Stats row ────────────────────────────────────────────── */
.profile-stats {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 14px;
}

.profile-stats span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg-elevated) 90%, transparent);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.profile-stats span strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* Streak pill – FUTIA orange hint */
.profile-stats span:first-child {
  border-color: rgba(232, 119, 34, 0.3);
}

.profile-stats span:first-child strong {
  color: var(--amber-400);
}

/* Points pill – green hint */
.profile-stats span:nth-child(2) strong {
  color: var(--violet-400);
}

/* Views pill – clickable, has eye icon */
.profile-stats span#openProfileViewsBtn,
.profile-stats span.clickable[id="openProfileViewsBtn"] {
  cursor: pointer;
  border-color: rgba(45, 125, 50, 0.35);   /* green-600 alpha */
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.15s ease;
}

.profile-stats span#openProfileViewsBtn:hover,
.profile-stats span.clickable[id="openProfileViewsBtn"]:hover {
  background: color-mix(in srgb, var(--violet-600) 20%, var(--bg-elevated));
  border-color: var(--violet-400);
  transform: translateY(-1px);
}

.profile-stats span#openProfileViewsBtn strong {
  color: var(--violet-400);
}

/* Active status pill */
.profile-stats .profile-active-status {
  font-size: 0.75rem;
  color: var(--text-muted);
  border-color: transparent;
  background: transparent;
  padding-left: 0;
  padding-right: 0;
}

/* ── Joined date ──────────────────────────────────────────── */
.profile-joined {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0 0 18px;
}

.profile-joined svg,
.profile-joined [data-lucide] {
  width: 13px;
  height: 13px;
  stroke: var(--violet-400);
}

/* ── Action buttons ───────────────────────────────────────── */
.profile-actions {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.profile-actions .btn {
  padding: 8px 20px;
  font-size: 0.83rem;
  font-weight: 600;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.01em;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.profile-actions .btn:hover {
  transform: translateY(-1px);
  opacity: 0.92;
}

.profile-actions .btn:active {
  transform: translateY(0);
}

.profile-actions .btn-primary {
  background: var(--gradient-brand);
  color: #fff;
  border: none;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--violet-600) 40%, transparent);
}

.profile-actions .btn-secondary {
  background: transparent;
  color: var(--violet-400);
  border: 1.5px solid var(--violet-500);
}

.profile-actions .btn-secondary:hover {
  background: color-mix(in srgb, var(--violet-600) 14%, transparent);
}

/* ── Section card shared base ─────────────────────────────── */
.profile-details-section,
.profile-achievements-section,
.profile-posts-section {
  margin: 1px 0 0;
  padding: 20px 18px;
  background: var(--bg-surface);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.section-title {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 0 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  gap: 7px;
}

.section-title::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 14px;
  border-radius: 2px;
  background: var(--gradient-brand);
  flex-shrink: 0;
}

/* ── About / Detail rows ──────────────────────────────────── */
.detail-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-md, 10px);
  background: var(--bg-elevated);
  margin-bottom: 6px;
  font-size: 0.845rem;
  color: var(--text-secondary);
  line-height: 1.5;
  border: 1px solid transparent;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.detail-row:last-child {
  margin-bottom: 0;
}

.detail-row:hover {
  border-color: rgba(45, 125, 50, 0.18);   /* green-600 alpha */
  background: color-mix(in srgb, var(--bg-elevated) 80%, var(--violet-600));
}

/* Icon column */
.detail-row > svg,
.detail-row > [data-lucide],
.detail-row > i[data-lucide] {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  margin-top: 2px;
  stroke: var(--violet-400);
  color: var(--violet-400);
}

/* Bold label */
.detail-row strong {
  color: var(--text-primary);
  font-weight: 600;
  margin-right: 4px;
  white-space: nowrap;
}

/* Profile completion nudge card */
.profile-nudge-card {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  padding: 11px 14px;
  background: color-mix(in srgb, var(--violet-600) 12%, var(--bg-elevated));
  border: 1px solid color-mix(in srgb, var(--violet-400) 35%, transparent);
  border-radius: var(--radius-md, 10px);
  font-size: 0.82rem;
}

.profile-nudge-card [data-lucide] {
  color: var(--violet-400);
  stroke: var(--violet-400);
  flex-shrink: 0;
  width: 16px;
  height: 16px;
}

.profile-nudge-card p {
  margin: 0 0 3px;
  color: var(--text-primary);
  font-size: 0.83rem;
}

.profile-nudge-card a {
  color: var(--violet-400);
  font-weight: 600;
  font-size: 0.78rem;
  text-decoration: none;
}

.profile-nudge-card a:hover {
  text-decoration: underline;
}

/* ── Coursemate matching ───────────────────────────────────── */
.match-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.match-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-elevated);
  border-radius: var(--radius-md, 10px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: border-color 0.15s ease;
}

.match-item:hover {
  border-color: color-mix(in srgb, var(--violet-500) 40%, transparent);
}

.match-item .match-avatar {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  overflow: hidden;
  cursor: pointer;
}

.match-item .match-avatar img,
.match-item .match-avatar .avatar-initials {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.match-item > div:not(.match-avatar) {
  flex: 1;
  min-width: 0;
}

.match-item strong {
  display: block;
  font-size: 0.855rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.match-item strong:hover {
  color: var(--violet-400);
}

.match-item span {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.match-item .btn-sm {
  flex-shrink: 0;
  padding: 5px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--gradient-brand);
  color: #fff;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.15s ease;
  white-space: nowrap;
}

.match-item .btn-sm:hover {
  opacity: 0.88;
  transform: translateY(-1px);
}

.match-item .btn-sm [data-lucide] {
  width: 13px;
  height: 13px;
}

/* ── Achievements ──────────────────────────────────────────── */
.achievements-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.achievement-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: var(--bg-elevated);
  border-radius: var(--radius-md, 10px);
  border: 1px solid color-mix(in srgb, var(--amber-400) 20%, transparent);
  transition: border-color 0.18s ease, transform 0.15s ease;
}

.achievement-card:hover {
  border-color: color-mix(in srgb, var(--amber-400) 45%, transparent);
  transform: translateY(-1px);
}

.achievement-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--amber-400) 14%, var(--bg-elevated));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--amber-400) 30%, transparent);
}

.achievement-icon [data-lucide],
.achievement-icon svg {
  width: 18px;
  height: 18px;
  stroke: var(--amber-400);
  color: var(--amber-400);
}

.achievement-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.achievement-info strong {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.achievement-info span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.share-achievement-btn {
  align-self: flex-start;
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  font-size: 0.73rem;
  font-weight: 600;
  border-radius: 999px;
  background: transparent;
  color: var(--violet-400);
  border: 1px solid color-mix(in srgb, var(--violet-500) 50%, transparent);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.share-achievement-btn:hover {
  background: color-mix(in srgb, var(--violet-600) 18%, transparent);
  border-color: var(--violet-400);
}

.share-achievement-btn [data-lucide] {
  width: 11px;
  height: 11px;
}

/* ── Recent posts section ──────────────────────────────────── */
.profile-posts-section {
  border-bottom: none;
  padding-bottom: 32px;
}

#profilePostsContainer {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.empty-text {
  text-align: center;
  padding: 28px 16px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ── Profile views modal ────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  animation: overlayIn 0.2s ease both;
}

@keyframes overlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal-box {
  width: 100%;
  max-width: 480px;
  background: var(--bg-surface);
  border-radius: var(--radius-lg, 16px) var(--radius-lg, 16px) 0 0;
  padding: 20px 18px 28px;
  box-shadow: var(--shadow-md, 0 20px 60px rgba(0,0,0,0.5));
  animation: sheetUp 0.28s cubic-bezier(0.34, 1.18, 0.64, 1) both;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

@keyframes sheetUp {
  from { transform: translateY(32px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.modal-box h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 2px;
}

.vertical-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-md, 10px);
  transition: background 0.14s ease;
  cursor: pointer;
}

.list-item:hover {
  background: var(--bg-elevated);
}

.list-item strong {
  font-size: 0.855rem;
  color: var(--text-primary);
}

.list-item [data-lucide="arrow-right"] {
  width: 15px;
  height: 15px;
  stroke: var(--text-muted);
}

/* ── Responsive tweaks ──────────────────────────────────────── */
@media (max-width: 480px) {
  .profile-header {
    padding: 32px 16px 22px;
  }

  .profile-avatar-large {
    width: 76px;
    height: 76px;
  }

  .profile-name {
    font-size: 1.18rem;
  }

  .profile-stats {
    gap: 5px;
  }

  .profile-stats span {
    padding: 4px 9px;
    font-size: 0.77rem;
  }

  .profile-details-section,
  .profile-achievements-section,
  .profile-posts-section {
    padding: 16px 14px;
  }

  .achievement-card {
    gap: 10px;
  }

  .modal-overlay {
    padding: 0;
  }

  .modal-box {
    border-radius: var(--radius-lg, 16px) var(--radius-lg, 16px) 0 0;
    padding: 18px 14px 24px;
  }
}

/* ── Light mode overrides ──────────────────────────────────── */
@media (prefers-color-scheme: light) {
  .profile-header::before {
    background: radial-gradient(ellipse 80% 60% at 50% -10%,
      color-mix(in srgb, var(--violet-400) 15%, transparent),
      transparent 70%);
  }

  .profile-header::after {
    opacity: 0.25;
  }

  .detail-row {
    border-color: rgba(0, 0, 0, 0.05);
  }

  .detail-row:hover {
    background: color-mix(in srgb, var(--bg-elevated) 80%, var(--violet-400));
    border-color: color-mix(in srgb, var(--violet-400) 22%, transparent);
  }

  .match-item,
  .achievement-card {
    border-color: rgba(0, 0, 0, 0.06);
  }

  .modal-overlay {
    background: rgba(0, 0, 0, 0.4);
  }
}