/* Profile page styles (extracted from profile.html) + Avatar chooser (moved from main.css)
   Load after css/main.css
*/

/* Page-level tokens and base */
:root{
  --card-bg:rgba(255,255,255,.35);
  --card-brd:rgba(255,255,255,.55);
  --grad-1:#4facfe;
  --grad-2:#00f2fe;
}
@media (prefers-color-scheme:dark){
  :root{
    --card-bg:rgba(0,0,0,.35);
    --card-brd:rgba(255,255,255,.25);
    --grad-1:#2D2A6F;
    --grad-2:#1D8CF8;
  }
}
*{ box-sizing:border-box }
/* Minimal icon replacement for previous Font Awesome usage */
.fa,
.fa-solid,
.fa-brands{
  font-style: normal;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Map specific icon classes to emoji/text glyphs */
.fa-user::before,
.fa-circle-user::before{
  content: "👤";
}

.fa-lock::before{
  content: "🔒";
}

.fa-id-card::before{
  content: "🪪"; /* falls back to a simple glyph on older systems */
}

.fa-envelope::before{
  content: "✉️";
}

.fa-key::before{
  content: "🔑";
}

.fa-google::before{
  content: "G";
  font-weight: 700;
  font-size: 0.95em;
}

/* NEW: pencil icon for inline profile edits */
.fa-pen::before{
  content: "✏️";
  font-size: 0.9em;
}


/* Auth primary buttons – pulled out of inline styles */
#loginSubmit,
#saveBtn{
  margin-top: 24px;
}
#forgotSendBtn{
  margin-top: 18px;
}

#pwResetBtn{
  margin-top: 10px;
}
.forgot-step-heading{
  font-weight: 600;
  margin: 4px 0 10px;
}

/* These were inline style="margin-top:10px" on .forgot-cta */
#forgotStep1 .forgot-cta,
#forgotStep2 .forgot-cta,
#forgotStep3 .forgot-cta{
  margin-top: 10px;
}
/* Initial visibility for auth panels – JS can still toggle display */
#formSignup,
#formForgot{
  display: none;
}
/* Only step 1 is visible initially */
#forgotStep2,
#forgotStep3{
  display: none;
}


/* Profile page background + type */
body{
  margin:0;
  /* Poppins removed – approximate with system UI fonts */
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", sans-serif;
  font-weight: 400;
  min-height:100vh;
  display:flex;
  flex-direction:column;
  /* NOTE:
     Background and animation intentionally removed so the
     shared “moving black” background from main/index CSS
     takes over again.
  */
}



@keyframes bgShift{
  0%{background-position:0 50%}
  50%{background-position:100% 50%}
  100%{background-position:0 50%}
}

/* Nav – shared glassy app nav (matches Courses/Dashboard) */
.dash-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 24px;
  max-width: 1120px;
  margin: 16px auto 8px;

  background:
    radial-gradient(circle at 0 0, rgba(148, 163, 184, 0.28), transparent 55%),
    radial-gradient(circle at 100% 100%, rgba(56, 189, 248, 0.2), transparent 55%),
    rgba(15, 23, 42, 0.9);
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.65);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.85);

  backdrop-filter: blur(14px) saturate(1.12);
  -webkit-backdrop-filter: blur(14px) saturate(1.12);
}

.dash-nav-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.dash-logo {
  font-size: 1.3rem;
  text-shadow: 0 4px 10px rgba(0, 0, 0, 0.55);
}

.dash-nav-title {
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.78rem;
  color: #e5edff;
  opacity: 0.9;
  white-space: nowrap;
}

.dash-nav-links {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.dash-nav-links a {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #e5edff;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.18s ease;
}

.dash-nav-links a:hover {
  background: rgba(15, 23, 42, 0.45);
}

.dash-nav-links a.active {
  background: linear-gradient(135deg, #facc15, #f97316);
  color: #111827;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.75);
}

/* Small-screen nav tweaks */
@media (max-width: 640px) {
  .dash-nav {
    padding: 10px 16px;
    margin-top: 10px;
    border-radius: 18px;
  }

  .dash-nav-title {
    display: none;
  }
}

/* Layout + card */
#wrap{ flex:1; display:flex; justify-content:center; align-items:flex-start; padding:80px 16px 120px }
.profile-icon{
  font-size:clamp(110px,12vw,180px); color:#fff; text-align:center;
  text-shadow:0 6px 14px rgba(0,0,0,.35); margin-bottom:48px;
}
.card{
  width:92vw; max-width:760px; padding:64px 56px;
  backdrop-filter:blur(20px); background:var(--card-bg); border:1px solid var(--card-brd);
  border-radius:36px; color:#fff; text-align:center;
  box-shadow:0 20px 60px rgba(0,0,0,.3);
  transition:transform .35s cubic-bezier(.2,.8,.4,1);
}
.card:hover{ transform:translateY(-4px) }
.label{ font-size:clamp(.8rem,.9vw,.95rem); font-weight:600; opacity:.8; margin:0 }
.value{ font-size:clamp(1.25rem,1.7vw,1.75rem); font-weight:600; margin:8px 0 28px; word-break:break-word }

/* Inline edit affordance */
.field-wrap{
  position:relative;
  text-align:center;
  padding-right:44px;
}
.field-wrap.no-pen{
  padding-right:0;
}
.field-wrap .label{
  margin-right:0;
}

/* NEW: slightly more room on the right for editable rows */
.field-wrap-editable{
  padding-right:56px;
}

/* Refined pencil button for first/last name edits */
.edit-pen{
  position:absolute;
  top:50%;
  right:8px;
  transform:translateY(-50%);
  width:30px;
  height:30px;
  border:none;
  border-radius:999px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;

  background:radial-gradient(circle at 30% 20%, #ffffff, #e2e8f0);
  color:#0f172a;
  box-shadow:0 4px 14px rgba(15,23,42,.35);
  transition:
    transform .12s cubic-bezier(.2,.8,.2,1),
    box-shadow .16s ease,
    background .16s ease,
    opacity .12s ease;
  padding:0;
}

/* Slightly smaller glyph inside the circle */
.edit-pen i{
  font-size:0.85rem;
}

/* Hover/active states */
.edit-pen:hover{
  transform:translateY(-50%) scale(1.07);
  box-shadow:0 6px 18px rgba(15,23,42,.5);
}
.edit-pen:active{
  transform:translateY(-50%) scale(.96);
  box-shadow:0 2px 8px rgba(15,23,42,.35);
}

/* Dark mode version */
@media(prefers-color-scheme:dark){
  .edit-pen{
    background:radial-gradient(circle at 30% 20%, rgba(15,23,42,0.92), rgba(15,23,42,0.98));
    color:#e5edff;
    border:1px solid rgba(148,163,184,0.9);
  }
}


/* Buttons + inputs */
.btn{
  width:100%; padding:18px 0; border:none; border-radius:18px;
  font-size:clamp(1rem,1.1vw,1.1rem); font-weight:600; cursor:pointer;
  box-shadow:0 6px 16px rgba(0,0,0,.25); transition:transform .15s;
}
.btn:hover{ transform:scale(1.05) }
.btn-green{ background:#8EFFA0; color:#002 }
.btn-coral{ background:#ff758c; color:#fff }

.btn-row{ display:flex; gap:12px; flex-wrap:wrap; margin-top:4px }
.btn-row .btn{ flex:1 }
.input-inline{ display:flex; gap:12px; flex-wrap:wrap; margin:8px 0 26px }
.input-inline input{
  flex:1; min-width:180px; padding:15px 16px; border-radius:14px; border:none; font-size:1rem;
  background:rgba(255,255,255,.88); color:#000;
}
@media(prefers-color-scheme:dark){
  .input-inline input{ background:rgba(0,0,0,.3); color:#fff }
}

/* Auth modal (login/signup/forgot) */
#loginModal{
  position:fixed;
  inset:0;
  z-index:1300;               /* NEW: sits above sticky nav (z=50) and above most page UI */
  display:flex;
  align-items:center;
  justify-content:center;
  background:rgba(0,0,0,.55);
  opacity:0;
  visibility:hidden;
  pointer-events:none;        /* NEW: prevents “invisible modal” clicks */
  transition:opacity .3s ease, visibility 0s linear .3s;
}
#loginModal.show{
  opacity:1;
  visibility:visible;
  pointer-events:auto;
  transition:opacity .3s ease;
}

@keyframes scaleIn{ from{ transform:scale(.85); opacity:.3 } to{ transform:scale(1); opacity:1 } }

.modal-tabs{ display:flex; margin-bottom:30px; position:relative; font-size:1rem }
.modal-tabs button{ flex:1; background:none; border:none; padding:14px 0; font-weight:600; color:#bbb; cursor:pointer }
.modal-tabs .active{ color:#fff }
.modal-tabs::after{
  content:''; position:absolute; bottom:0; left:0; width:50%; height:3px; background:#fff; border-radius:2px; transition:transform .3s;
}
.modal-tabs.login-active::after{ transform:translateX(0) }
.modal-tabs.signup-active::after{ transform:translateX(100%) }

.modal-box .input-wrap{ position:relative; margin-top:14px }
.modal-box input{ width:100%; padding:15px 16px 15px 50px; border-radius:14px; border:none; font-size:1rem; background:rgba(255,255,255,.88); color:#000 }
.modal-box .fa{ position:absolute; left:16px; top:calc(50% - .5em); color:#888 }
@media(prefers-color-scheme:dark){
  .modal-box input{ background:rgba(0,0,0,.3); color:#fff }
  .modal-box .fa{ color:#bbb }
}

/* a11y utility */
.sr-only{
  position:absolute!important; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden;
  clip:rect(0,0,0,0); white-space:nowrap; border:0;
}

/* Avatar section (page header area) */
.profile-avatar-wrap{ display:flex; flex-direction:column; align-items:center; gap:12px; margin-bottom:24px }
.avatar-large{
  width:160px; height:160px; border-radius:50%; object-fit:cover;
  box-shadow:0 8px 24px rgba(0,0,0,.35); display:none;
}
.avatar-change-btn{ width:auto; padding:10px 16px }

/* ===== Avatar chooser (moved from main.css) ===== */

body.no-scroll { overflow: hidden; }

#avatarModal {
  position: fixed; inset: 0; z-index: 1200;
  display: flex; align-items: center; justify-content: center;
  padding: 24px; overscroll-behavior: contain;
  background: radial-gradient(60% 60% at 50% 50%, rgba(30,41,59,.55), rgba(2,6,23,.65));
  -webkit-backdrop-filter: blur(2px) saturate(1.05);
  backdrop-filter: blur(2px) saturate(1.05);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .24s ease, backdrop-filter .24s ease, -webkit-backdrop-filter .24s ease, visibility 0s linear .24s;
}
#avatarModal.show{
  opacity: 1; visibility: visible; pointer-events: auto;
  -webkit-backdrop-filter: blur(8px) saturate(1.15);
  backdrop-filter: blur(8px) saturate(1.15);
  transition: opacity .28s ease, backdrop-filter .28s ease, -webkit-backdrop-filter .28s ease;
}
@media (prefers-reduced-motion: reduce){
  #avatarModal{ transition: none; }
  #avatarModal.show{ transition: none; }
}

/* Panel */
#avatarModal .avatar-sheet {
  width: min(1100px, 96vw);
  max-height: min(88vh, 960px);
  background: linear-gradient(180deg, #ffffff, #fafafa 60%);
  color: #111;
  border-radius: 16px;
  border: 1px solid rgba(2,6,23,.06);
  box-shadow: 0 30px 80px rgba(2,6,23,.35), 0 8px 22px rgba(2,6,23,.25);
  display: flex; flex-direction: column; overflow: hidden;
  transform: translateY(12px) scale(.985);
  opacity: 0;
  transition: transform .26s cubic-bezier(.22,.9,.24,1), opacity .24s ease, box-shadow .3s ease;
}
#avatarModal.show .avatar-sheet { transform: translateY(0) scale(1); opacity: 1; }

/* Header */
#avatarModal .avatar-header{
  display:flex; align-items:center; justify-content:space-between;
  padding:20px 24px; border-bottom:1px solid #eee;
  background: linear-gradient(180deg, #ffffff, #fafafa);
}
#avatarModal .avatar-title{ font-size:1.4rem; font-weight:800; letter-spacing:.2px; }
#avatarModal .avatar-close-btn, #avatarCloseBtn{
  appearance:none; border:0; background:transparent; font-size:1.8rem; line-height:1;
  padding:6px 10px; cursor:pointer; border-radius:8px;
}
#avatarModal .avatar-close-btn:hover, #avatarCloseBtn:hover{ background:rgba(0,0,0,.06); }

/* Body + grid */
#avatarModal .avatar-body{ padding:20px 24px; overflow-y:auto; }
#avatarGrid{
  position:relative; display:grid; grid-template-columns:repeat(5, minmax(0,1fr));
  gap:22px; align-content:start; scroll-margin-top:8px;
}
@media (max-width:1100px){ #avatarGrid{ grid-template-columns:repeat(4,1fr); } }
@media (max-width:860px) { #avatarGrid{ grid-template-columns:repeat(3,1fr); } }
@media (max-width:620px) { #avatarGrid{ grid-template-columns:repeat(2,1fr); } }
@media (max-width:420px) { #avatarGrid{ grid-template-columns:1fr; } }
#avatarGrid.busy{ pointer-events:none; }
#avatarGrid.busy::after{
  content:""; position:absolute; inset:0; background:rgba(255,255,255,.65);
  -webkit-backdrop-filter: blur(1px); backdrop-filter: blur(1px);
}
#avatarGrid.busy::before{
  content:""; position:absolute; z-index:1; left:50%; top:50%;
  width:32px; height:32px; margin:-16px 0 0 -16px; border-radius:50%;
  border:3px solid rgba(2,6,23,.15); border-top-color:#1a73e8; animation: av-spin .7s linear infinite;
}
@keyframes av-spin{ to { transform: rotate(360deg); } }

/* Tiles */
.avatar-tile{
  position:relative; user-select:none; border-radius:14px; padding:14px 12px;
  background: linear-gradient(180deg,#fbfdff,#f6f8fb);
  border:1px solid rgba(2,6,23,.08);
  display:flex; flex-direction:column; align-items:center; outline:none;
  box-shadow:0 6px 18px rgba(2,6,23,.06), 0 1px 0 rgba(255,255,255,.8) inset;
  transition: transform .12s cubic-bezier(.2,.8,.2,1), box-shadow .18s ease, border-color .18s ease, background .18s ease, opacity .15s ease;
}
.avatar-tile:hover{
  transform:translateY(-3px) scale(1.02);
  box-shadow:0 12px 26px rgba(2,6,23,.12);
  border-color:rgba(2,6,23,.12);
  background: linear-gradient(180deg,#ffffff,#f7fafc);
}
.avatar-tile:active{ transform: translateY(-1px) scale(.995); }
.avatar-tile[hidden]{ display:none !important; }
.avatar-tile .name{
  margin-top:10px; font-weight:900; letter-spacing:.1px; color:#0f172a; font-size:.92rem;
  text-align:center; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; width:100%;
}
.avatar-tile img{
  width:100%; max-width:144px; aspect-ratio:1/1; height:auto; border-radius:12px; display:block;
  filter: drop-shadow(0 4px 10px rgba(2,6,23,.12));
  transition: transform .2s ease, filter .2s ease;
}
.avatar-tile:hover img{ transform:translateY(-1px); filter: drop-shadow(0 10px 18px rgba(2,6,23,.18)); }
.avatar-locked{ opacity:.55; }
.avatar-locked::after{
  content:"Locked"; position:absolute; bottom:8px; right:10px; font-size:.82rem; font-weight:800; letter-spacing:.15px;
  background: linear-gradient(180deg,#16a34a,#22c55e); /* subtle badge gradient */
  color:#fff; padding:2px 8px; border-radius:6px; box-shadow:0 2px 8px rgba(0,0,0,.25);
}

/* Loading placeholder */
#avatarModal .loading{
  padding:24px; text-align:center; border-radius:12px; color:transparent;
  background: linear-gradient(90deg,#f3f4f6,#ffffff,#f3f4f6); background-size:200% 100%;
  animation: av-shimmer 1.1s ease-in-out infinite;
}
@keyframes av-shimmer{ 0%{ background-position:200% 0; } 100%{ background-position:-200% 0; } }

/* Micro-optimizations */
#avatarModal .avatar-sheet{ will-change:transform; transform:translateZ(0); }
#avatarModal .avatar-body{ contain: content; }
.avatar-tile{ contain: content; }
.avatar-tile img{ content-visibility:auto; contain-intrinsic-size:144px 144px; }

/* Toolbar under header */
#avatarSearch{
  width:100%; height:42px; padding:10px 12px; border-radius:10px;
  border:1px solid #e2e8f0; outline:none; background:#fff; font-weight:600;
}
#avatarSearch:focus{ border-color:#7aa7ff; box-shadow:0 0 0 3px rgba(122,167,255,.25); }
.avatar-filters{ display:flex; gap:8px; flex-wrap:wrap; }
.avatar-chip{
  appearance:none; border:1px solid #e2e8f0; background:#fff; color:#111;
  border-radius:999px; padding:6px 12px; font-weight:800; cursor:pointer;
  transition:background .15s ease, color .15s ease, border-color .15s ease;
}
.avatar-chip:hover{ background:#f8fafc; }
.avatar-chip[aria-pressed="true"]{ background:#111; color:#fff; border-color:#111; }

#avatarToolbar{
  position:sticky; top:0; z-index:3; display:grid; grid-template-columns:1fr auto;
  gap:12px; align-items:center; padding:12px 24px;
  background: linear-gradient(180deg,#ffffff,#fafafa 70%);
  border-bottom:1px solid rgba(2,6,23,.06);
  backdrop-filter: blur(6px) saturate(1.05);
  -webkit-backdrop-filter: blur(6px) saturate(1.05);
}

/* Nicer scrolling */
#avatarModal .avatar-body{ scrollbar-gutter: stable both-edges; }
#avatarModal .avatar-body::-webkit-scrollbar{ width:10px; }
#avatarModal .avatar-body::-webkit-scrollbar-thumb{ background: rgba(2,6,23,.16); border-radius: 10px; }

/* Selection pop animation */
.avatar-tile.selected{
  border:1px solid transparent;
  background:
    linear-gradient(180deg,#ffffff,#f7fbff) padding-box,
    conic-gradient(from 20deg,#7dd3fc,#a78bfa,#60a5fa,#34d399,#7dd3fc) border-box;
  box-shadow:0 12px 28px rgba(30,64,175,.14), 0 0 0 1px rgba(26,115,232,.18) inset;
}
.avatar-tile.selected::after{
  content:"✓"; position:absolute; top:10px; right:10px; width:26px; height:26px; border-radius:999px;
  display:flex; align-items:center; justify-content:center;
  background: linear-gradient(180deg,#16a34a,#22c55e); color:#fff; font-weight:900; font-size:14px;
  box-shadow:0 2px 8px rgba(16,185,129,.4); transform: scale(.92); animation: av-pop .18s ease-out forwards;
}
@keyframes av-pop{ 0%{ transform:scale(.8); opacity:.4; } 100%{ transform:scale(1); opacity:1; } }
@media (prefers-reduced-motion: reduce){ .avatar-tile.selected::after{ animation:none !important; } }

/* Dim surrounding UI when modal open */
body.no-scroll .profile-rail,
body.no-scroll .sidebar,
body.no-scroll #card{
  opacity:.25; filter:saturate(.85) blur(.2px); pointer-events:none;
}

/* Make the big avatar a visible trigger & keyboard-accessible */
#changeAvatarBtn{
  background: transparent !important; border: 0 !important; box-shadow: none !important;
  color: #eaf2ff !important; font-weight: 800; padding: 0 !important; text-decoration: underline; cursor: pointer;
}
body.no-scroll #changeAvatarBtn{ display: none !important; }
.profile-avatar-wrap #avatarImg{ cursor: pointer; }
.profile-avatar-wrap #avatarImg:hover{ filter: drop-shadow(0 6px 14px rgba(2,6,23,.22)); }
.profile-avatar-wrap #avatarImg:focus-visible{
  outline:3px solid #7aa7ff; outline-offset:4px; border-radius:50%;
}

/* Confirm bar at bottom of modal */
.avatar-commit{
  position:sticky; bottom:0; z-index:4; display:flex; align-items:center; justify-content:space-between;
  gap:12px; padding:12px 16px; border-top:1px solid rgba(2,6,23,.06);
  background: linear-gradient(180deg,#fafafa,#ffffff); box-shadow:0 -6px 18px rgba(2,6,23,.06);
}
.avatar-commit .commit-left{ display:flex; align-items:center; gap:12px; }
.avatar-commit #avatarPendingImg{ width:48px; height:48px; border-radius:10px; display:block; box-shadow:0 6px 14px rgba(2,6,23,.10); }
.avatar-commit .commit-text{ line-height:1.2; }
.avatar-commit .commit-title{ font-size:.78rem; font-weight:800; color:#64748b; letter-spacing:.1px; }
.avatar-commit .commit-name{ font-size:1rem; font-weight:900; color:#0f172a; }
.avatar-commit .commit-actions{ display:flex; gap:10px; }

.btn.btn-plain{
  appearance:none; border:1px solid #e2e8f0; background:#fff; color:#111;
  border-radius:10px; padding:8px 12px; font-weight:800; cursor:pointer;
}
.btn.btn-plain:hover{ background:#f8fafc; }
.btn.btn-green{
  appearance:none; border:0; border-radius:10px; padding:10px 16px; font-weight:900; color:#fff; cursor:pointer;
  background: linear-gradient(90deg,#16a34a,#22c55e); box-shadow: 0 10px 24px rgba(16,185,129,.24);
}
.btn.btn-green:disabled{
  filter:saturate(.6) grayscale(.2); opacity:.7; cursor:not-allowed; box-shadow:none;
}
/* ensure buttons inside sticky commit don't stretch full width */
#avatarModal .avatar-commit .btn{ width:auto; }

/* Forgot password CTA (profile only) */
.forgot-cta{ text-align:center; margin-top:8px; }
.forgot-cta .link-btn{
  appearance:none; border:0; background:transparent; color:#fff; text-decoration:underline; font-weight:800; cursor:pointer;
}
@media(prefers-color-scheme:dark){ .forgot-cta .link-btn{ color:#fff; } }
/* ===================== Profile Page Loading Skeleton (two‑column sheet) ===================== */

/* Hide page content while loading — only show the skeleton */
body[data-loading="true"] > :not(.profile-skeleton){ visibility: hidden; }
body[data-loading="true"] .profile-skeleton{ display: grid; }

/* Overlay container */
.profile-skeleton{
  position:fixed; inset:0; z-index:2147481600;
  display:none; place-items:center; padding:16px;
  pointer-events:auto;
  background: radial-gradient(60% 60% at 50% 50%, rgba(11,18,32,.40), rgba(11,18,32,.55));
  -webkit-backdrop-filter: blur(2px) saturate(1.05);
  backdrop-filter: blur(2px) saturate(1.05);
}

/* Glass sheet with a distinct form from other pages */
.pf-shell{
  width:min(1100px,96vw);
  border-radius:18px;
  background: linear-gradient(180deg, rgba(255,255,255,.10), rgba(255,255,255,.06));
  border:1px solid rgba(255,255,255,.12);
  box-shadow: 0 34px 120px rgba(2,6,23,.55), inset 0 1px 0 rgba(255,255,255,.06);
  color:#eaf2ff;
  padding:16px;
}

/* Two-column grid: big identity on the left, compact cards on the right */
.pf-grid{
  display:grid; grid-template-columns: 360px 1fr; gap:16px; align-items:start;
}
@media (max-width: 900px){
  .pf-grid{ grid-template-columns: 1fr; }
}

/* Left rail */
.pf-left{
  display:flex; flex-direction:column; align-items:center; gap:10px;
  padding:16px; border-radius:16px;
  background: linear-gradient(180deg, rgba(255,255,255,.10), rgba(255,255,255,.05));
  border:1px solid rgba(255,255,255,.10);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
}
.pf-avatar{
  width:160px; height:160px; border-radius:50%;
  background: radial-gradient(circle at 30% 30%, #ffffff, #e2e8f0);
  box-shadow: 0 10px 26px rgba(2,6,23,.35);
}
.pf-name{ height:18px; border-radius:10px; background:rgba(255,255,255,.35); width:70%; }
.pf-sub { height:12px; border-radius:10px; background:rgba(255,255,255,.28); width:40%; }
.pf-chips{ display:flex; flex-wrap:wrap; gap:8px; justify-content:center; }
.pf-chip{
  height:12px; border-radius:999px; background:rgba(255,255,255,.28);
  width:42%; min-width:120px;
}

/* Right: compact cards */
.pf-right{ display:grid; gap:14px; grid-template-columns:repeat(2,minmax(0,1fr)); }
@media (max-width: 900px){ .pf-right{ grid-template-columns:1fr; } }
.pf-card{
  border-radius:14px; padding:14px;
  background: linear-gradient(180deg, rgba(255,255,255,.12), rgba(255,255,255,.06));
  border:1px solid rgba(255,255,255,.10);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05), 0 10px 28px rgba(2,6,23,.28);
}
.pf-card-hd{ display:flex; align-items:center; gap:10px; margin-bottom:10px; }
.pf-ico{
  width:32px; height:32px; border-radius:10px; display:grid; place-items:center;
  background: radial-gradient(circle at 30% 30%, #fff, #e2e8f0); color:#0b1220;
  box-shadow:0 3px 10px rgba(2,6,23,.18), inset 0 0 0 1px rgba(0,0,0,.06);
}
.pf-card-title{ font:900 14px/1.2 system-ui, Segoe UI, Roboto, Inter, sans-serif; }

.pf-line{ height:12px; border-radius:10px; background:rgba(255,255,255,.35); margin:8px 0; }
.pf-box { height:44px; border-radius:12px; background:rgba(255,255,255,.20); margin-top:8px; }

.pf-list{ display:flex; flex-direction:column; gap:8px; }
.pf-li  { height:12px; border-radius:10px; background:rgba(255,255,255,.30); }

/* Achievements rail (inside first card) */
.pf-rail{
  position:relative; height:7px; border-radius:999px; overflow:hidden;
  background:rgba(255,255,255,.25); border:1px solid rgba(255,255,255,.35);
  margin-top:8px;
}
.pf-fill{
  height:100%; width:0%;
  background:linear-gradient(90deg,#34C759,#22c55e);
  transition: width .28s ease;
}

/* Status footer inside sheet */
.pf-statusbar{
  display:grid; grid-template-columns: auto 1fr; align-items:center; gap:12px;
  margin-top:14px; padding-top:12px; border-top:1px solid rgba(255,255,255,.12);
}
.pf-brand{ display:flex; align-items:center; gap:10px; }
.pf-badge{
  width:36px; height:36px; border-radius:999px; display:grid; place-items:center;
  background: radial-gradient(circle at 30% 30%, #fff9c4, #facc15);
  color:#1a1403; box-shadow:0 6px 20px rgba(250,204,21,.35);
}
.pf-greet{ font:900 14px/1.2 system-ui,Segoe UI,Roboto,Inter,sans-serif; }
.pf-meta { font:800 12px/1.2 system-ui,Segoe UI,Roboto,Inter,sans-serif; color:#cbd5e1; }
.pf-status{ font:800 12px/1.2 system-ui,Segoe UI,Roboto,Inter,sans-serif; color:#f1f5f9; }

.pf-progress{
  position:relative; height:8px; border-radius:6px; overflow:hidden;
  background:rgba(255,255,255,.45); border:1px solid rgba(255,255,255,.6);
  box-shadow:inset 0 1px 3px rgba(0,0,0,.08);
}
.pf-progress-fill{
  height:100%; width:0%;
  background:linear-gradient(90deg,#0ea5e9,#8b5cf6,#f43f5e);
  transition: width .28s ease;
}

/* Step chips */
.pf-steps{ display:flex; flex-wrap:wrap; gap:10px; list-style:none; margin:0; padding:0; }
.pf-step{
  display:flex; align-items:center; gap:8px;
  padding:6px 10px; border-radius:999px;
  background:rgba(255,255,255,.08); border:1px solid rgba(255,255,255,.10);
  color:#e2e8f0; font:800 12px/1 system-ui, Segoe UI, Roboto, Inter, sans-serif;
}
.pf-step.is-current{
  background:linear-gradient(180deg,#fff3b0,#facc15);
  color:#1a1403; border-color:rgba(255,215,0,.55);
  box-shadow: 0 1px 0 rgba(255,255,255,.65) inset, 0 10px 24px rgba(255,215,0,.32);
}
.pf-step.is-done{
  background:linear-gradient(180deg,#34d399,#10b981);
  color:#032b18; border-color:rgba(16,185,129,.45);
}

/* Shimmer */
.pf-shimmer{ position:relative; overflow:hidden; }
.pf-shimmer::after{
  content:""; position:absolute; inset:0; transform:translateX(-100%);
  background: linear-gradient(90deg,
      rgba(255,255,255,0) 0%,
      rgba(255,255,255,.55) 42%,
      rgba(255,255,255,.85) 50%,
      rgba(255,255,255,.55) 58%,
      rgba(255,255,255,0) 100%);
  animation: pfShimmer 1.25s ease-in-out infinite;
}
@keyframes pfShimmer{ to { transform: translateX(100%); } }

@media (prefers-reduced-motion: reduce), (prefers-reduced-data: reduce){
  .pf-shimmer::after{ display:none; }
}
@media (forced-colors: active){
  .pf-shimmer::after{ display:none; }
  .profile-skeleton *{
    forced-color-adjust:none !important;
    background: Canvas !important;
    border-color: CanvasText !important;
    box-shadow:none !important;
  }
}
/* ===================== end Profile Page Loading Skeleton ===================== */
/* Profile main + friends side panel */
.profile-two-col{
  display:grid;
  grid-template-columns: minmax(0,1.05fr) minmax(0,1.1fr);
  gap:24px;
  align-items:flex-start;
}
@media (max-width: 780px){
  .profile-two-col{
    grid-template-columns:1fr;
  }
}

.profile-main{
  text-align:left;
}
.profile-main .field-wrap{
  text-align:left;
}

/* Friends card on the right */
.profile-friends{
  padding:18px 16px 16px;
  border-radius:22px;
  background:linear-gradient(145deg, rgba(15,23,42,0.96), rgba(30,64,175,0.96));
  border:1px solid rgba(148,163,184,0.7);
  box-shadow:0 16px 40px rgba(15,23,42,0.75);
  color:#e5edff;
}
.profile-friends h3{
  margin:0 0 4px;
  font-size:1.05rem;
  font-weight:800;
  letter-spacing:.06em;
  text-transform:uppercase;
}
.friends-subtitle{
  margin:0 0 10px;
  font-size:.8rem;
  opacity:.8;
}

/* Search bar */
.friend-search{
  display:flex;
  gap:8px;
  margin-bottom:12px;
}
.friend-search input{
  flex:1;
  min-width:0;
  border-radius:999px;
  border:1px solid rgba(148,163,184,0.85);
  padding:8px 12px;
  font-size:.9rem;
  background:rgba(15,23,42,0.85);
  color:#e5edff;
}
.friend-search input::placeholder{ color:rgba(148,163,184,0.9); }
.friend-search input:focus{
  outline:none;
  border-color:#facc15;
  box-shadow:0 0 0 1px rgba(250,204,21,0.7);
}

/* Friend buttons */
.friend-btn{
  appearance:none;
  border-radius:999px;
  padding:6px 12px;
  font-size:.8rem;
  font-weight:700;
  cursor:pointer;
  border:1px solid transparent;
  white-space:nowrap;
}
.friend-btn-primary{
  background:linear-gradient(135deg,#facc15,#f97316);
  color:#111827;
  border-color:rgba(248,250,252,0.1);
  box-shadow:0 6px 18px rgba(15,23,42,0.7);
}
.friend-btn-primary:hover{
  filter:brightness(1.05);
}
.friend-btn-ghost{
  background:transparent;
  color:#e5edff;
  border-color:rgba(148,163,184,0.7);
}
.friend-btn-ghost:hover{
  background:rgba(15,23,42,0.7);
}

/* Lists */
.friends-lists{
  display:flex;
  flex-direction:column;
  gap:12px;
}
.friends-section{
  padding:10px 8px;
  border-radius:16px;
  background:rgba(15,23,42,0.82);
  border:1px solid rgba(15,23,42,0.9);
}
.friends-section-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom:6px;
}
.friends-section-head h4{
  margin:0;
  font-size:.85rem;
  text-transform:uppercase;
  letter-spacing:.09em;
  opacity:.9;
}
.friends-requests{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
}
.friends-column{
  flex:1 1 0;
  min-width:140px;
}
.friends-column h5{
  margin:0 0 4px;
  font-size:.8rem;
  text-transform:uppercase;
  letter-spacing:.08em;
  opacity:.75;
}
.friends-section-body{
  display:flex;
  flex-direction:column;
  gap:6px;
}

/* Friend rows */
.friend-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  padding:6px 8px;
  border-radius:12px;
  background:rgba(15,23,42,0.9);
  border:1px solid rgba(51,65,85,0.9);
}
.friend-main{
  display:flex;
  align-items:center;
  gap:8px;
  min-width:0;
}
.friend-avatar{
  width:28px;
  height:28px;
  border-radius:999px;
  background:radial-gradient(circle at 30% 20%,#e5e7eb,#9ca3af);
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:.7rem;
  font-weight:800;
  color:#020617;
}
.friend-text{
  min-width:0;
}
.friend-name{
  font-size:.85rem;
  font-weight:700;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.friend-meta{
  font-size:.75rem;
  opacity:.75;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.friend-actions{
  display:flex;
  gap:6px;
  align-items:center;
}

.friends-note{
  margin:2px 0;
  font-size:.78rem;
  opacity:.7;
}

/* Outgoing pending badge */
.friend-pill{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:2px 8px;
  border-radius:999px;
  font-size:.7rem;
  font-weight:700;
  background:rgba(248,250,252,0.12);
  border:1px solid rgba(148,163,184,0.7);
}
/* ===================== Logout overlay loader ===================== */

.logout-overlay{
  position:fixed;
  inset:0;
  z-index:2147481601; /* one notch above the profile skeleton */
  display:grid;
  place-items:center;
  padding:16px;
  background:
    radial-gradient(circle at 20% 20%, rgba(15,23,42,.96), rgba(2,6,23,.98)),
    radial-gradient(circle at 100% 100%, rgba(56,189,248,.4), rgba(2,6,23,.98)),
    radial-gradient(circle at 80% 20%, rgba(99,102,241,.32), rgba(2,6,23,.92));
  -webkit-backdrop-filter: blur(10px) saturate(1.12);
  backdrop-filter: blur(10px) saturate(1.12);
  opacity:0;
  pointer-events:none;
  transition:opacity .22s ease;
}
body.logout-loading .logout-overlay{
  opacity:1;
  pointer-events:auto;
}

.logout-dialog{
  min-width:260px;
  max-width:340px;
  padding:20px 20px 18px;
  border-radius:18px;
  background:
    radial-gradient(circle at 20% 10%, rgba(99,102,241,.32), rgba(15,23,42,.96)),
    linear-gradient(145deg, rgba(15,23,42,.98), rgba(30,64,175,.98));
  border:1px solid rgba(148,163,184,.55);
  box-shadow:0 25px 70px rgba(15,23,42,.82), inset 0 0 0 1px rgba(255,255,255,.04);
  text-align:center;
  color:#e5edff;
  display:grid;
  gap:6px;
  justify-items:center;
}
.logout-orbit{
  position:relative;
  width:74px;
  height:74px;
  margin:0 auto 6px;
}

.logout-core{
  position:absolute;
  inset:24px;
  border-radius:50%;
  background:radial-gradient(circle, #fef3c7 0%, #facc15 40%, rgba(250,204,21,.2) 70%);
  box-shadow:0 0 22px rgba(250,204,21,.6), 0 0 40px rgba(56,189,248,.35);
  animation:logoutPulse 1.6s ease-in-out infinite;
}

.logout-ring{
  position:absolute;
  inset:6px;
  border-radius:50%;
  border:1px solid rgba(148,163,184,.35);
  animation:logoutSpin 1.6s linear infinite;
}

.logout-ring::after{
  content:"";
  position:absolute;
  top:-5px;
  left:50%;
  width:10px;
  height:10px;
  border-radius:50%;
  background:radial-gradient(circle, #38bdf8 0%, rgba(56,189,248,.1) 70%);
  transform:translateX(-50%);
  box-shadow:0 0 12px rgba(56,189,248,.8);
}

.logout-ring.ring-two{
  inset:12px;
  animation-duration:2.1s;
  animation-direction:reverse;
  border-color:rgba(94,234,212,.32);
}

.logout-ring.ring-two::after{
  background:radial-gradient(circle, #5eead4 0%, rgba(94,234,212,.2) 70%);
  box-shadow:0 0 12px rgba(94,234,212,.75);
}

.logout-ring.ring-three{
  inset:0;
  animation-duration:2.6s;
  border-color:rgba(129,140,248,.3);
  animation-timing-function:cubic-bezier(.6,.05,.4,.95);
}

.logout-ring.ring-three::after{
  background:radial-gradient(circle, #c7d2fe 0%, rgba(199,210,254,.2) 70%);
  box-shadow:0 0 12px rgba(199,210,254,.7);
}

@keyframes logoutSpin{
  to { transform:rotate(360deg); }
}
@keyframes logoutPulse{
  0%, 100% { transform:scale(.95); opacity:.85; }
  50% { transform:scale(1.05); opacity:1; }
}

.logout-text{
  margin:0;
  font-size:.95rem;
  font-weight:700;
  letter-spacing:.08em;
  text-transform:uppercase;
     color:transparent;
  background:linear-gradient(120deg, #e0f2fe, #f8fafc 40%, #fde68a 70%);
  -webkit-background-clip:text;
  background-clip:text;
}

.logout-subtext{
  margin:0;
  font-size:.78rem;
  letter-spacing:.08em;
  text-transform:uppercase;
  color:rgba(226,232,240,.72);
}

.logout-shimmer{
  width:100%;
  height:3px;
  border-radius:999px;
  background:linear-gradient(90deg, rgba(148,163,184,.2), rgba(56,189,248,.8), rgba(148,163,184,.2));
  background-size:200% 100%;
  animation:logoutShimmer 2.2s ease-in-out infinite;
  opacity:.8;
}

@keyframes logoutShimmer{
  0% { background-position:0% 50%; }
  50% { background-position:100% 50%; }
  100% { background-position:0% 50%; }
}

/* Dim underlying UI while logout loader is shown */
body.logout-loading .profile-rail,
body.logout-loading .sidebar,
body.logout-loading #card{
  opacity:.25;
  filter:saturate(.85) blur(.2px);
  pointer-events:none;
  transition:opacity .12s ease, filter .12s ease;
}
/* ===================== Email/reset overlay (profile-email.js flows) ===================== */

.email-overlay{
  position:fixed;
  inset:0;
  z-index:1500; /* Above #loginModal (1300) and #avatarModal (1200); below skeleton/logout if those use huge z-index */
  display:grid;
  place-items:center;
  padding:16px;

  background:
    radial-gradient(circle at 20% 20%, rgba(15,23,42,.88), rgba(2,6,23,.92)),
    radial-gradient(circle at 100% 100%, rgba(56,189,248,.22), rgba(2,6,23,.92));

  -webkit-backdrop-filter: blur(10px) saturate(1.12);
  backdrop-filter: blur(10px) saturate(1.12);

  opacity:0;
  visibility:hidden;
  pointer-events:none;
  transition:opacity .18s ease, visibility 0s linear .18s;
}

/* Show conditions:
   - body.email-loading (recommended)
   - OR .email-overlay.show / .email-overlay.is-open
   - OR aria-hidden="false"
*/
body.email-loading .email-overlay,
.email-overlay.show,
.email-overlay.is-open,
.email-overlay[aria-hidden="false"]{
  opacity:1;
  visibility:visible;
  pointer-events:auto;
  transition:opacity .18s ease;
}

/* Optional: prevent scroll while the overlay is up */
body.email-loading{
  overflow:hidden;
}

.email-dialog{
  width:min(420px, 92vw);
  padding:18px 18px 16px;
  border-radius:18px;
  text-align:center;
  color:#e5edff;

  background:
    radial-gradient(circle at 20% 10%, rgba(99,102,241,.22), rgba(15,23,42,.92)),
    linear-gradient(145deg, rgba(15,23,42,.96), rgba(30,64,175,.96));

  border:1px solid rgba(148,163,184,.55);
  box-shadow:0 25px 70px rgba(15,23,42,.82), inset 0 0 0 1px rgba(255,255,255,.04);

  display:grid;
  gap:8px;
  justify-items:center;
}

.email-spinner{
  width:54px;
  height:54px;
  border-radius:999px;
  border:3px solid rgba(148,163,184,.35);
  border-top-color:rgba(56,189,248,.95);
  animation:emailSpin .8s linear infinite;
}

@keyframes emailSpin{
  to{ transform:rotate(360deg); }
}

.email-text{
  margin:0;
  font-size:.95rem;
  font-weight:800;
  letter-spacing:.08em;
  text-transform:uppercase;
}

.email-subtext{
  margin:0;
  font-size:.78rem;
  letter-spacing:.06em;
  text-transform:uppercase;
  color:rgba(226,232,240,.72);
}

@media (prefers-reduced-motion: reduce){
  .email-overlay{ transition:none; }
  .email-spinner{ animation:none; }
}
