/* ===========================================================
   Words Across v2 — Profile Styles (clean & deduped)
   =========================================================== */

:root{
  --bg-0:#05070e;
  --bg-1:#0a1020;
  --ink:#eaf1ff;
  --ink-dim:#9ab0cf;
  --muted:#8aa;
  --accent:#5ec8ff;

  --panel:#0e1426;
  --backdrop:saturate(140%) blur(10px);

  --radius-sm:10px;
  --radius-md:14px;
  --radius-lg:18px;

  --shadow-1:0 6px 18px rgba(0,0,0,.35);
  --shadow-2:0 12px 32px rgba(0,0,0,.5);

  --header-h:56px;
}

*{ box-sizing:border-box; }
html,body{ height:100%; margin:0; }
body.wa2{
  background:var(--bg-0); color:var(--ink);
  font:15px/1.4 ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,Helvetica,Arial;
}

/* =================== Header (reuse v2 look) =================== */
.wa2__hdr{
  position:sticky; top:0; z-index:20;
  height:var(--header-h);
  display:flex; align-items:center; gap:10px;
  padding:0 12px;
  background:linear-gradient(180deg, rgba(19,28,49,.9), rgba(10,16,32,.92));
  border-bottom:1px solid #132246;
  box-shadow:0 2px 18px rgba(0,0,0,.35);
}
.wa2__hdr .brand{
  flex:1 1 auto; min-width:0; font-weight:900; letter-spacing:.4px;
  background:linear-gradient(90deg, #36d1ff, var(--accent));
  -webkit-background-clip:text; background-clip:text; color:transparent;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.wa2__nav__toggle{
  background:transparent; color:var(--ink);
  border:1px solid #27406e; border-radius:8px;
  padding:6px 10px; cursor:pointer;
}
.wa2__nav{ display:flex; gap:10px; }
.wa2__nav a{
  color:var(--ink); text-decoration:none;
  padding:6px 8px; border-radius:8px;
  border:1px solid transparent;
}
.wa2__nav a:hover{ border-color:#2a4480; background:rgba(255,255,255,.04); }
@media (max-width: 720px){
  .wa2__nav{
    position:absolute; right:8px; top:calc(var(--header-h) - 4px);
    display:block; background:rgba(10,16,32,.98);
    border:1px solid #20345e; border-radius:12px; padding:8px;
    box-shadow:var(--shadow-2);
  }
  .wa2__nav[hidden]{ display:none; }
  .wa2__nav a{ display:block; }
}

/* =================== Layout =================== */
.prof{
  max-width:1000px; margin:0 auto; padding:18px 14px 48px;
}

/* =================== Hero row =================== */
.prof__hero{
  display:grid; grid-template-columns:96px 1fr; gap:14px; align-items:center;
  margin-bottom:14px;
}
.prof__avatar{
  width:96px; height:96px; border-radius:16px; overflow:hidden;
  border:1px solid rgba(160,185,225,.32);
  background:
    linear-gradient(180deg, rgba(255,255,255,.12), rgba(255,255,255,.04)),
    radial-gradient(150% 120% at 30% 8%, rgba(255,255,255,.18), transparent 60%);
  box-shadow:
    0 1px 0 rgba(255,255,255,.14) inset,
    0 -8px 16px rgba(0,0,0,.25) inset,
    0 8px 18px rgba(0,0,0,.35);
}
.prof__avatar img{
  display:block; width:100%; height:100%; object-fit:cover;
}
.prof__id{ display:flex; flex-direction:column; gap:10px; min-width:0; }
.prof__name{ display:flex; align-items:baseline; gap:10px; flex-wrap:wrap; }
.prof__display{ margin:0; font-size:22px; line-height:1.2; letter-spacing:.02em; }
.prof__handle{ color:var(--ink-dim); font-size:13px; }

.prof__actions{ display:flex; gap:8px; flex-wrap:wrap; }
.btn{
  color:#fff;
  border-radius:10px;
  border:1px solid #2b4a80;
  background:linear-gradient(180deg, rgba(45,73,128,.95), rgba(22,36,68,.92));
  padding:8px 12px;
  box-shadow:0 1px 0 rgba(255,255,255,.06) inset, 0 6px 14px rgba(0,0,0,.35);
  text-decoration:none; cursor:pointer; display:inline-flex; align-items:center; gap:6px;
}
.btn:hover{
  border-color:#3c68ba;
  background:linear-gradient(180deg, rgba(58,92,160,.98), rgba(26,44,84,.96));
}
.btn.sm{ padding:6px 10px; font-size:12px; border-radius:9px; }
.btn.ghost{
  background:linear-gradient(180deg, rgba(22,36,68,.55), rgba(16,28,52,.55));
  border-color:#27406e; color:#cfe0ff;
}

/* =================== Stats grid =================== */
.prof__stats{
  display:grid; grid-template-columns:repeat(4,1fr); gap:10px;
  margin:12px 0 16px;
}
.stat{
  border:1px solid rgba(30,40,66,.9); border-radius:14px;
  background:linear-gradient(180deg, rgba(8,12,20,.90), rgba(8,12,20,.96));
  backdrop-filter:var(--backdrop);
  padding:10px; box-shadow:var(--shadow-1);
  display:flex; flex-direction:column; gap:4px; min-height:72px;
}
.stat__label{ color:var(--ink-dim); font-size:12px; }
.stat__value{ color:#fff; font-weight:900; font-size:18px; }

/* =================== Tabs =================== */
.prof__tabs{ margin-top:8px; }
.tabs{
  display:flex; gap:8px; flex-wrap:wrap; margin-bottom:10px;
}
.tab{
  border-radius:12px; border:1px solid #1f355e;
  background:linear-gradient(180deg, rgba(16,26,50,.95), rgba(12,20,40,.95));
  color:#fff; font-weight:800; padding:8px 12px; cursor:pointer;
}
.tab.is-active{
  background:linear-gradient(180deg, rgba(28,48,92,.98), rgba(18,30,58,.98));
  border-color:#3b6dd3; box-shadow:0 0 0 1px rgba(59,109,211,.45) inset;
}
.panes{ display:block; }
.pane{ display:none; }
.pane.is-active{ display:block; }

/* =================== Cards =================== */
.card{
  border:1px solid rgba(30,40,66,.9); border-radius:14px;
  background:linear-gradient(180deg, rgba(8,12,20,.90), rgba(8,12,20,.96));
  backdrop-filter:var(--backdrop);
  padding:12px; box-shadow:var(--shadow-1);
  margin-bottom:10px;
}
.card__title{ margin:0 0 8px; font-size:16px; letter-spacing:.02em; }
.card__body{ color:#cfe0ff; }
.bullets{ margin:0; padding-left:16px; }

/* =================== Recent list placeholder =================== */
.list .empty{
  text-align:center; padding:16px 8px; color:var(--ink-dim);
}
.empty__title{ font-weight:800; color:var(--ink); }

/* =================== Inline edit (self) =================== */
.edit-grid{ display:grid; gap:12px; grid-template-columns:1fr; max-width:720px; }
.f{ display:flex; flex-direction:column; gap:6px; }
.f label{ font-size:.9rem; color:#9bb; }
.f input[type="text"], .f textarea{
  background:rgba(255,255,255,0.05);
  border:1px solid rgba(255,255,255,0.12);
  border-radius:10px; padding:10px; color:#eef; font:inherit;
}
.f textarea{ min-height:100px; resize:vertical; }

.savebar{
  position:sticky; bottom:0; display:none; padding:12px; margin-top:12px;
  background:linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(6,12,20,0.9) 40%, rgba(6,12,20,0.98) 100%);
  border-top:1px solid rgba(255,255,255,0.12); backdrop-filter: blur(6px);
}
.savebar.is-dirty{ display:flex; justify-content:flex-end; gap:8px; }

.avatar-tools{ display:flex; gap:8px; margin-top:8px; flex-wrap:wrap; }
.btn.ghost{ background:transparent; border:1px dashed rgba(255,255,255,0.25); }
.help{ color:var(--muted); font-size:.85rem; }

/* =================== Responsive =================== */
@media (max-width: 720px){
  .prof__hero{ grid-template-columns:72px 1fr; }
  .prof__avatar{ width:72px; height:72px; border-radius:14px; }
  .prof__display{ font-size:18px; }
  .prof__stats{ grid-template-columns:repeat(2,1fr); }
}
/* Ensure profile form inputs win over global styles */
.prof .f input[type="text"],
.prof .f input[type="email"],
.prof .f input[type="search"],
.prof .f input[type="url"],
.prof .f input[type="tel"],
.prof .f textarea {
  background: rgba(255,255,255,0.05) !important;
  border: 1px solid rgba(255,255,255,0.12) !important;
  border-radius: 10px !important;
  padding: 10px !important;
  color: #eef !important;
  font: inherit !important;
  width: 100%;
  display: block;
}
.prof .f textarea { min-height: 100px; resize: vertical; }
/* =================== Avatar controls unclipped =================== */
/* Your .prof__avatar had overflow:hidden to round the image, which also hid the controls. */
.prof__avatar{
  overflow: visible !important;           /* allow the controls to render outside the 96×96 box */
  position: relative;                      /* anchor for any positioned children if needed */
}
.prof__avatar img{
  border-radius: inherit !important;       /* keep the rounded look even without overflow:hidden */
}

/* Keep the tools below the image, not over it */
.avatar-tools{
  display:flex; gap:8px; margin-top:8px; flex-wrap:wrap;
}

/* If some global rule is reducing button visibility, ensure our ghost button is visible here */
.avatar-tools .btn.ghost{
  background:linear-gradient(180deg, rgba(22,36,68,.55), rgba(16,28,52,.55)) !important;
  border:1px dashed rgba(255,255,255,0.35) !important;
  color:#cfe0ff !important;
}

/* =================== Profile form inputs win over globals =================== */
.prof .f input[type="text"],
.prof .f input[type="email"],
.prof .f input[type="search"],
.prof .f input[type="url"],
.prof .f input[type="tel"],
.prof .f textarea{
  all: unset;                               /* wipe any global input styles */
  display: block;
  width: 100%;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  padding: 10px;
  color: #eef;
  line-height: 1.35;
  font: inherit;
  box-sizing: border-box;
}
.prof .f textarea{ min-height: 100px; resize: vertical; }
.prof .f input:focus,
.prof .f textarea:focus{
  outline: 0;
  border-color: rgba(94,200,255,.8);
  box-shadow: 0 0 0 2px rgba(94,200,255,.25);
}

/* =================== Sticky save bar that actually sticks =================== */
/* Sticky fails if an ancestor has overflow other than 'visible' or a transform. */
.card{ overflow: visible !important; }        /* guard against a global card overflow */
.edit-grid{ position: relative; }

/* Make sure the bar layers above content and spans the card width */
.savebar{
  position: sticky;
  bottom: 0;
  z-index: 30;                                /* above card contents */
  display: none;
  padding: 12px;
  margin-top: 12px;
  background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(6,12,20,0.9) 40%, rgba(6,12,20,0.98) 100%);
  border-top: 1px solid rgba(255,255,255,0.12);
  backdrop-filter: blur(6px);
}
.savebar.is-dirty{ display:flex; justify-content:flex-end; gap:8px; }

/* If a parent sets transform (e.g., for an animation), sticky can break; neutralize locally */
.prof .card, .prof .edit-grid{
  transform: none !important;
  will-change: auto !important;
}
/* === Avatar camera overlay === */
.prof__avatar{
  position: relative;            /* anchor overlay */
  overflow: hidden;              /* keep badge clipped to the rounded avatar */
  z-index: 1;                    /* sit above surrounding layout */
}
.prof__avatar img{
  display:block; width:100%; height:100%; object-fit:cover;
  border-radius: inherit;        /* keep rounded corners */
}

/* Only show the badge for the current user */
.prof[data-isself="1"] .avatar-edit{ display:flex; }
.avatar-edit{
  position:absolute;
  right:4px; bottom:4px;
  width:26px; height:26px;
  border-radius:8px;
  display:none;                  /* default hidden; enabled by selector above */
  align-items:center; justify-content:center;
  border:1px solid rgba(255,255,255,.35);
  background:
    linear-gradient(180deg, rgba(22,36,68,.85), rgba(10,18,36,.85));
  backdrop-filter: blur(6px) saturate(120%);
  color:#fff;
  cursor:pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,.45);
  z-index: 5;                    /* ensure above avatar image */
}
.avatar-edit svg{
  width:18px; height:18px; fill:#eaf1ff;
}
.avatar-edit:hover{
  border-color: rgba(94,200,255,.85);
  box-shadow: 0 0 0 2px rgba(94,200,255,.25), 0 6px 16px rgba(0,0,0,.55);
  transform: translateY(-1px);
}
.avatar-edit:focus{
  outline: none;
  box-shadow: 0 0 0 2px rgba(94,200,255,.5), 0 6px 16px rgba(0,0,0,.55);
}

/* If you kept the old .avatar-tools anywhere, hide it explicitly */
.avatar-tools{ display:none !important; }
