/* profile-v1 — forked from home-v1 style.css.
   Self-contained per prototype principle.
   Tokens come from ../shared/tokens.css. */

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
input { font: inherit; color: inherit; background: none; border: 0; outline: 0; }

/* ============ APP SHELL ============ */
.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 680px) 320px;
  gap: 24px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
}

/* ============ SIDEBAR (same as home-v1) ============ */
.sidebar {
  position: sticky;
  top: 24px;
  height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.brand { display: flex; align-items: center; gap: 14px; font-size: 32px; font-weight: 800; margin-bottom: 36px; color: var(--text); }
.brand img { width: 42px; height: 42px; object-fit: contain; }

.sidebar nav { display: flex; flex-direction: column; gap: 8px; }
.sidebar nav a {
  padding: 14px 18px;
  color: var(--text-soft);
  border-radius: 999px;
  font-weight: 600;
  font-size: 16px;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.sidebar nav a.active,
.sidebar nav a:hover {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-card);
}

.new-post {
  border-radius: 999px;
  background: var(--cta-bg);
  color: var(--cta-text);
  font-weight: 700;
  padding: 14px 22px;
  font-size: 16px;
}

/* ============ MAIN COLUMN ============ */
.main { min-width: 0; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  min-height: 44px;
}

.topbar h1 { font-size: 28px; margin: 0; font-weight: 700; letter-spacing: -0.01em; }

.topbar-brand { display: none; align-items: center; gap: 8px; color: var(--text); font-weight: 800; font-size: 22px; letter-spacing: -0.01em; }
.topbar-brand img { width: 24px; height: 24px; object-fit: contain; }

.topbar .more {
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  padding: 8px 14px;
  font-size: 18px;
  line-height: 1;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

/* ============ PROFILE HEADER CARD ============ */
.profile-card {
  padding: 0;
  overflow: hidden;
  margin-bottom: 18px;
}
.profile-cover {
  height: 140px;
  background: linear-gradient(135deg, var(--ai), var(--primary));
}
.profile-body { padding: 0 22px 22px; position: relative; }

.profile-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ai), var(--info));
  color: white;
  font-weight: 800;
  font-size: 40px;
  display: grid;
  place-items: center;
  border: 4px solid var(--surface);
  margin-top: -48px;
  margin-bottom: 14px;
  user-select: none;
}

.profile-name {
  font-size: 24px;
  font-weight: 800;
  margin: 0;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.profile-name .verified { color: var(--primary); font-size: 18px; }
.profile-handle { color: var(--text-soft); margin: 2px 0 0; font-size: 14px; }

.mbti-badge {
  display: inline-block;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  border-radius: 999px;
  margin: 14px 0 10px;
}

.profile-bio {
  margin: 0 0 16px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
}

.profile-stats {
  display: flex;
  gap: 24px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 14px 0;
}
.profile-stats .stat {
  text-align: left;
  cursor: pointer;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 6px;
  color: inherit;
  font: inherit;
  transition: opacity 0.15s;
}
.profile-stats .stat:hover { opacity: 0.65; }
.profile-stats .stat b { display: block; font-weight: 800; font-size: 16px; }
.profile-stats .stat span { color: var(--text-soft); font-size: 13px; }

.profile-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}
.profile-actions button {
  flex: 1;
  border-radius: 999px;
  padding: 12px 16px;
  font-weight: 700;
  font-size: 15px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  transition: background 0.15s;
}
.profile-actions button:hover { background: var(--surface-soft); }
.profile-actions button.primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border-color: transparent;
}
.profile-actions button.primary:hover { opacity: 0.92; background: linear-gradient(135deg, var(--primary), var(--primary-dark)); }

/* ============ SOCIAL DNA CARD ============ */
.dna-card {
  padding: 22px;
  margin-bottom: 18px;
  background: linear-gradient(180deg, var(--surface), var(--primary-soft));
}
.dna-card h2 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.dna-card h2 .ai-tag {
  background: var(--primary);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  letter-spacing: 0.05em;
}
.dna-card p { margin: 0 0 14px; line-height: 1.65; color: var(--text); font-size: 15px; }
.dna-traits { display: flex; flex-wrap: wrap; gap: 8px; }
.dna-traits .trait {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
}

/* ============ TABS ============ */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}
.tabs .tab {
  flex: 1;
  padding: 14px 8px;
  text-align: center;
  color: var(--text-soft);
  font-weight: 600;
  font-size: 15px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.tabs .tab.active { color: var(--text); border-bottom-color: var(--text); }
.tabs .tab:hover:not(.active) { color: var(--text); background: var(--surface-soft); }

.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ============ POSTS (reuse home post style) ============ */
.post { padding: 18px; margin-bottom: 18px; }
.post-head { display: flex; align-items: center; gap: 12px; }
.post-head .who { flex: 1; min-width: 0; }
.post-head .who strong { display: block; font-weight: 700; }
.post-head .who small { display: block; color: var(--text-soft); margin-top: 2px; font-size: 12px; }
.post-body {
  margin-top: 12px;
  font-size: 16px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.post .tags { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; }
.post .tags a { color: var(--primary-dark); font-size: 14px; font-weight: 600; }
.post .actions {
  display: flex;
  gap: 24px;
  color: var(--text-soft);
  margin-top: 14px;
  font-size: 14px;
}
.post .actions .act { cursor: pointer; padding: 4px 8px; margin: -4px -8px; border-radius: 999px; transition: background 0.15s, color 0.15s; }
.post .actions .act:hover { background: var(--surface-soft); color: var(--text); }
.post .actions .act.liked { color: var(--like); }

.avatar { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; color: white; font-weight: 800; flex-shrink: 0; user-select: none; }
.avatar.g1 { background: linear-gradient(135deg, var(--primary), var(--ai)); }
.avatar.g2 { background: linear-gradient(135deg, var(--ai), var(--info)); }
.avatar.g3 { background: linear-gradient(135deg, var(--success), var(--ai)); }
.avatar.g4 { background: linear-gradient(135deg, var(--accent), var(--accent-warm)); }
.avatar.g5 { background: linear-gradient(135deg, var(--primary), var(--accent)); }

/* ============ PHOTO GRID ============ */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.photo-tile {
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  overflow: hidden;
  position: relative;
  display: grid;
  place-items: end start;
  padding: 12px;
  color: white;
  cursor: pointer;
  border: 1px solid var(--line);
}
.photo-tile .title {
  position: relative;          /* needed for z-index to take effect */
  font-size: 13px;
  font-weight: 600;
  text-shadow: 0 1px 4px rgba(0,0,0,0.4);
  z-index: 1;
}
.photo-tile.locked::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(6px);
}
.photo-tile.locked .lock {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 28px;
  z-index: 1;
}
.photo-tile .price {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  z-index: 2;
}

/* ============ ABOUT TAB ============ */
.about-list { list-style: none; padding: 0; margin: 0; }
.about-list li {
  display: flex;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.about-list li:last-child { border-bottom: 0; }
.about-list .k { color: var(--text-soft); }
.about-list .v { color: var(--text); font-weight: 600; }
.about-card { padding: 18px 22px; }

/* About tab → Pay per Ask CTA card */
.about-ppa {
  display: block;
  padding: 18px 22px;
  margin-top: 14px;
  background: linear-gradient(180deg, var(--surface), var(--primary-soft));
  transition: transform 0.15s, border-color 0.15s;
}
.about-ppa:hover {
  transform: translateY(-1px);
  border-color: var(--primary);
}
.about-ppa .ppa-h {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 10px;
}
.about-ppa h3 {
  margin: 0;
  font-size: 16px; font-weight: 800;
  display: inline-flex; align-items: center; gap: 8px;
}
.about-ppa h3::before {
  content: "AI";
  background: var(--primary);
  color: white;
  font-size: 10px; font-weight: 800;
  padding: 3px 7px; border-radius: 999px;
  letter-spacing: 0.06em;
}
.about-ppa .ppa-price {
  display: inline-flex; align-items: baseline; gap: 4px;
  font-variant-numeric: tabular-nums;
}
.about-ppa .ppa-price b { font-size: 20px; font-weight: 800; }
.about-ppa .ppa-price small { font-size: 12px; color: var(--text-soft); font-weight: 700; }
.about-ppa p {
  margin: 0 0 14px;
  font-size: 14px; line-height: 1.65;
  color: var(--text);
}
.about-ppa .ppa-cta {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--cta-bg);
  color: var(--cta-text);
  font-weight: 700; font-size: 14px;
}

/* About tab → AI Compatibility card (reuses .compat-card styling) */
.about-compat { padding: 20px; margin-top: 14px; }
.about-compat h2 { margin: 0 0 6px; font-size: 18px; font-weight: 700; }

/* ============ RIGHT PANEL ============ */
.right-panel { display: flex; flex-direction: column; gap: 18px; }
.right-panel .card { padding: 20px; }
.right-panel h2 { font-size: 18px; margin: 0 0 12px; font-weight: 700; }

/* Compatibility card */
.compat-card { background: linear-gradient(180deg, var(--surface), var(--primary-soft)); }
.compat-card .score-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 6px 0 10px;
}
.compat-card .score {
  font-size: 42px;
  font-weight: 900;
  color: var(--primary);
  letter-spacing: -0.02em;
  line-height: 1;
}
.compat-card .score-label { font-weight: 700; color: var(--text); }
.compat-card .mbti-pair {
  font-size: 13px;
  color: var(--text-soft);
  margin-bottom: 12px;
}
.compat-card .mbti-pair b { color: var(--text); font-weight: 700; }
.compat-card p { font-size: 14px; line-height: 1.6; color: var(--text); margin: 0 0 14px; }
.compat-card button {
  width: 100%;
  padding: 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  font-weight: 700;
  font-size: 14px;
}

/* Ask card */
.ask-card p { font-size: 14px; color: var(--text-soft); margin: 0 0 12px; line-height: 1.6; }
.ask-card .ask-price {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 14px;
}
.ask-card .ask-price b {
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.01em;
}
.ask-card .ask-price small {
  font-size: 13px;
  color: var(--text-soft);
  font-weight: 600;
}
.ask-card .ask-cta {
  display: block;
  width: 100%;
  padding: 12px;
  text-align: center;
  border-radius: 999px;
  background: var(--cta-bg);
  color: var(--cta-text);
  font-weight: 700;
  font-size: 14px;
}

/* Suggested list */
.suggested { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 14px; }
.suggested li { display: flex; align-items: center; gap: 12px; }
.suggested .who { flex: 1; min-width: 0; }
.suggested .who b { display: block; font-weight: 700; font-size: 14px; }
.suggested .who small { color: var(--text-soft); font-size: 12px; }
.suggested .follow {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 700;
  font-size: 13px;
  transition: background 0.15s;
}
.suggested .follow:hover { background: var(--surface-soft); }

/* ============ CONNECTIONS MODAL ============ */
.cmodal[hidden] { display: none; }
.cmodal {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  padding: 16px;
}
.cmodal-overlay {
  position: absolute; inset: 0;
  background: rgba(15,23,42,0.55);
  backdrop-filter: blur(4px);
}
.cmodal-card {
  position: relative;
  background: var(--surface);
  border-radius: 22px;
  width: 100%;
  max-width: 440px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-float);
  animation: cmodalIn 0.18s ease-out;
}
@keyframes cmodalIn { from { transform: translateY(8px) scale(0.97); opacity: 0; } to { transform: none; opacity: 1; } }

.cmodal-handle { display: none; }

.cmodal-h {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 18px 0;
}
.cmodal-h h3 { margin: 0; font-size: 18px; font-weight: 800; }
.cmodal-h .x {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 14px;
  color: var(--text-soft);
}
.cmodal-h .x:hover { background: var(--surface-soft); color: var(--text); }

.cmodal-tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  padding: 14px 18px 0;
  gap: 28px;
}
.cmodal-tabs .mtab {
  padding-bottom: 12px;
  color: var(--text-soft);
  font-weight: 700; font-size: 14px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}
.cmodal-tabs .mtab.active { color: var(--text); border-bottom-color: var(--text); }
.cmodal-tabs .mtab .n { color: var(--text-muted); font-weight: 600; margin-left: 4px; font-size: 13px; }

.cmodal-search { padding: 12px 18px 4px; }
.cmodal-search input {
  width: 100%;
  background: var(--surface-soft);
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 14px;
}

.conn-list {
  flex: 1; min-height: 0;
  overflow-y: auto;
  list-style: none;
  padding: 0; margin: 0;
}
.conn-list li {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
}
.conn-list li:last-child { border-bottom: 0; }
.conn-list .meta { flex: 1; min-width: 0; }
.conn-list .meta b { display: block; font-size: 14px; font-weight: 700; }
.conn-list .meta small { color: var(--text-soft); font-size: 12px; }
.conn-list .meta .mb {
  display: inline-block;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 700; font-size: 10px;
  padding: 2px 7px; border-radius: 999px;
  letter-spacing: 0.04em;
  margin-left: 6px;
  vertical-align: middle;
}
.conn-list .you-badge {
  background: var(--surface-soft);
  color: var(--text-soft);
  font-size: 12px; font-weight: 700;
  padding: 7px 13px;
  border-radius: 999px;
}
.conn-list .follow {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 16px;
  font-weight: 700; font-size: 13px;
  background: var(--surface);
  color: var(--text);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  min-width: 88px;
}
.conn-list .follow:hover { background: var(--surface-soft); }
.conn-list .follow.following {
  background: var(--text);
  color: white;
  border-color: var(--text);
}
.conn-list .follow.following:hover {
  background: var(--surface);
  color: var(--error);
  border-color: var(--error);
}

.cmodal-foot {
  padding: 12px 18px;
  text-align: center;
  border-top: 1px solid var(--line);
  color: var(--text-muted);
  font-size: 12px;
}

/* ============ MOBILE NAV ============ */
.mobile-nav { display: none; }

/* ============ RESPONSIVE ============ */
@media (max-width: 980px) {
  /* Connections modal slides up as bottom sheet on mobile */
  .cmodal { padding: 0; align-items: end; }
  .cmodal-card {
    max-width: 100%;
    max-height: 88vh;
    border-radius: 22px 22px 0 0;
    animation: cmodalUp 0.22s ease-out;
  }
  .cmodal-handle {
    display: block;
    width: 44px; height: 4px;
    background: var(--line);
    border-radius: 999px;
    margin: 10px auto 0;
  }
  @keyframes cmodalUp { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }

  .app-shell {
    grid-template-columns: 1fr;
    padding: 12px;
    padding-bottom: 96px;
    gap: 12px;
  }
  .sidebar,
  .right-panel { display: none; }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(248, 250, 252, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 12px 4px;
    margin: 0 0 12px;
  }
  .topbar h1 { display: none; }
  .topbar-brand { display: inline-flex; }

  .photo-grid { grid-template-columns: repeat(2, 1fr); }

  .mobile-nav {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: center;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: var(--shadow-card);
    padding: 10px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 20;
  }
  .mobile-nav a {
    text-align: center;
    font-size: 12px;
    color: var(--text-soft);
    padding: 8px 4px;
  }
  .mobile-nav a.active { color: var(--text); font-weight: 600; }
  .mobile-nav .compose-btn {
    width: 46px;
    height: 46px;
    margin: auto;
    padding: 0;
    border-radius: 50%;
    background: var(--cta-bg);
    color: var(--cta-text);
    display: grid;
    place-items: center;
    line-height: 1;
  }
}
