/* users/web/css/profile.css — fully responsive modern light/dark compatible profile styles */

/* START: theme-aware variable mapping (drop this at the top of users/web/css/profile.css)
   Non-destructive: uses site theme variables if they exist, otherwise falls back
*/
:root {
  /* prefer global theme variables, fallback to current profile values */
  --bg: var(--bg, #f7f8fb);
  --card: var(--surface, #ffffff);
  --muted: var(--text-muted, #617085);
  --text: var(--text-primary, #0f1724);
  --accent: var(--accent-purple, #6b21a8);
  --accent-2: var(--accent-purple, #8b5cf6);
  --radius-lg: 14px;
  --shadow-soft: 0 10px 35px rgba(16,24,40,0.08);
  --max-width: 1200px;
  --gap: 18px;

  /* helper surfaces used inside this CSS (respect theme if provided) */
  --profile-surface-hover: var(--surface-hover, #f3f5f8);
  --profile-surface-strong: var(--surface-strong, #f1f5f9);

  /* gradient fallback end */
  --profile-surface-gradient-end: #fbfbff;
}
/* END: theme-aware variable mapping */


* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

.page {
  max-width: var(--max-width);
  margin: 28px auto;
  padding: 18px;
}

/* Cover */
.cover {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: linear-gradient(135deg, #eef2ff, #fff0f6);
  box-shadow: var(--shadow-soft);
  height: 320px;
  margin-bottom: 60px;
}
.cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transform-origin: center;
  transition: transform .6s ease;
  filter: saturate(.95) contrast(.98);
}
.cover:hover img { transform: scale(1.03); }
.cover-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(10,10,10,.08), rgba(10,10,10,.02));
  pointer-events: none;
}

/* Grid */
.profile-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: var(--gap);
  align-items: start;
}

/* Left card */
.card-left {
  background: var(--card);
  border-radius: 12px;
  padding: 18px;
  box-shadow: var(--shadow-soft);
  min-height: 180px;
}
.avatar {
  width: 130px;
  height: 130px;
  border-radius: 999px;
  border: 6px solid #fff;
  margin: -72px auto 12px;
  display: block;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(11,15,30,.12);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.name { text-align: center; font-weight: 800; font-size: 1.25rem; margin-top: 6px; color: var(--accent); }
.username { text-align: center; color: var(--muted); font-size: .92rem; margin-top: 4px; }

/* Buttons */
.left-buttons {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 12px;
  flex-wrap: wrap;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: 0 8px 20px rgba(107,33,168,.12);
  font-weight: 700;
  cursor: pointer;
}
.btn.secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid rgba(107,33,168,.12);
  font-weight: 600;
}
.btn.ghost {
  background: transparent;
  border: 1px solid rgba(0,0,0,.06);
  color: var(--text);
}

/* Stats */
.stats {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 14px;
  flex-wrap: wrap;
}
.stat {
  text-align: center;
  padding: 8px 12px;
  border-radius: 10px;
  background: linear-gradient(180deg, #66CCCC, #fbfbff);
  min-width: 80px;
  box-shadow: 0 6px 18px rgba(15,23,42,.04);
}
.stat .num { font-weight: 800; font-size: 1.05rem; color: var(--accent); }
.stat .lbl { color: var(--muted); font-size: .86rem; margin-top: 4px; }

/* Social links */
.socials {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 14px;
}
.social-link {
  padding: 8px 10px;
  border-radius: 10px;
  background: linear-gradient(90deg, rgba(139,92,246,0.08), rgba(107,33,168,0.04));
  color: var(--accent);
  font-weight: 700;
  font-size: .92rem;
  text-decoration: none;
  display: inline-flex;
  gap: 8px;
  align-items: center;
}
.social-link i { width: 16px; }

/* Right column */
.card-right {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}
.panel {
  background: var(--card);
  padding: 18px;
  border-radius: 12px;
  box-shadow: var(--shadow-soft);
}
.profile-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
}
.title { font-weight: 800; font-size: 1.2rem; color: var(--accent); }
.meta { color: var(--muted); font-weight: 600; }

/* Bio */
.bio {
  color: var(--text);
  line-height: 1.5;
  margin-top: 12px;
  max-height: 120px;
  overflow: hidden;
  position: relative;
  padding-right: 12px;
}
.bio.muted { color: var(--muted); }
.bio.expanded { max-height: none; }
.read-more {
  margin-top: 12px;
  display: inline-block;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  border: none;
  font-weight: 700;
  cursor: pointer;
}

/* Chips */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.chip {
  padding: 8px 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, #fff4ff, #fff9f0);
  font-weight: 700;
  color: var(--accent);
  border: 1px solid rgba(107,33,168,.06);
}

/* Progress */
.progress {
  height: 10px;
  background: rgba(10,10,10,.06);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 10px;
}
.progress>i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  width: 60%;
  transition: width .6s;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid rgba(10,10,10,.04);
  padding-bottom: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.tabs button {
  background: transparent;
  border: none;
  padding: 10px 12px;
  font-weight: 700;
  color: var(--muted);
  border-radius: 8px;
  cursor: pointer;
}
.tabs button.active {
  color: #fff;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 20px rgba(139,92,246,.12);
}

/* Posts */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 6px;
}
.post-card {
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(180deg, #fff, #fff);
  box-shadow: 0 8px 30px rgba(15,23,42,.06);
  transition: transform .2s, box-shadow .2s;
  cursor: pointer;
  display: flex;
  flex-direction: column;
}
.post-media { height: 160px; background: var(--profile-surface-hover); display: block; overflow: hidden; }
.post-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(.98);
  opacity: 0;
  transition: opacity .28s, transform .5s;
}
.post-media img.loaded { opacity: 1; transform: scale(1); }
.post-body { padding: 12px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.post-title { font-weight: 700; color: var(--accent); font-size: 1rem; }
.post-time { color: var(--muted); font-size: .85rem; }
.post-excerpt { color: var(--text); line-height: 1.4; font-size: .95rem; flex: 1; }

/* --------- RESPONSIVE ----------- */

@media (max-width: 1024px) {
  .profile-grid {
    grid-template-columns: minmax(260px, 1fr) 2fr;
    gap: 14px;
  }
  .cover { height: 260px; margin-bottom: 40px; }
}

@media (max-width: 768px) {
  .profile-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .card-right { order: 1; }
  .card-left { order: 2; }
  .avatar {
    width: 110px;
    height: 110px;
    margin: -60px auto 12px;
  }
  .cover { height: 200px; margin-bottom: 30px; }
  .panel { padding: 14px; }
  .profile-head {
    flex-direction: column;
    align-items: flex-start;
  }
  .stats { justify-content: space-around; }
  .posts-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 520px) {
  .posts-grid {
    grid-template-columns: 1fr;
  }
  .cover { height: 160px; }
  .page { padding: 10px; }
}


/* ===== Option B: mobile header CSS - append to profile.css ===== */
.mobile-profile-header { display: none; }
.mobile-profile-header .mobile-header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 12px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: transparent;
}

.mobile-profile-header .mobile-left {
  display:flex;
  gap:10px;
  align-items:center;
}
.mobile-avatar {
  width:72px;
  height:72px;
  border-radius:999px;
  overflow:hidden;
  border:3px solid #fff;
  box-shadow: 0 6px 18px rgba(0,0,0,0.08);
}
.mobile-avatar img{ width:100%; height:100%; object-fit:cover; display:block }
.mobile-name { font-weight:800; font-size:1rem; }
.mobile-username { color:var(--muted); font-size:0.9rem; }

.mobile-actions { display:flex; gap:8px; align-items:center; justify-content:flex-end; }
.mobile-stats { display:flex; gap:12px; justify-content:space-between; align-items:center; }

.mobile-stats .mstat { text-align:center; font-size:0.9rem; color:var(--muted) }
.mobile-stats .mstat strong { display:block; font-weight:800; color:var(--accent) }

/* show only on small screens, hide on larger viewports */
@media (max-width: 768px) {
  .mobile-profile-header { display:block; }
  /* keep main grid functioning below, don't hide left card - we simply keep duplicate header visible */
  /* Adjust cover spacing so header sits nicely */
  .cover { margin-bottom: 8px; height: 180px; }
}
