/* Click · Fondo personalizado del perfil */

/* El comportamiento actual se mantiene intacto cuando no hay fondo personalizado. */
.profile-v396-shell.has-custom-profile-background:before{
  display:block;
  background-image:
    linear-gradient(180deg,rgba(10,10,40,.58),rgba(18,12,58,.82)),
    var(--profile-background-image)!important;
  background-size:cover!important;
  background-position:center!important;
  background-repeat:no-repeat!important;
  filter:none!important;
  transform:none!important;
  opacity:1!important;
}

.profile-background-modal{
  position:fixed;
  inset:0;
  z-index:10080;
  display:none;
  align-items:center;
  justify-content:center;
  padding:24px;
}
.profile-background-modal.is-open{display:flex}
.profile-background-backdrop{
  position:absolute;
  inset:0;
  background:rgba(17,10,42,.72);
  backdrop-filter:blur(10px);
  -webkit-backdrop-filter:blur(10px);
}
.profile-background-dialog{
  position:relative;
  z-index:1;
  width:min(760px,100%);
  max-height:min(760px,calc(100vh - 34px));
  overflow:auto;
  border:1px solid rgba(154,116,235,.30);
  border-radius:28px;
  background:#fff;
  box-shadow:0 30px 90px rgba(14,7,38,.38);
}
.profile-background-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:20px;
  padding:24px 26px 18px;
  border-bottom:1px solid #eee8fa;
}
.profile-background-head span{
  color:#8c63ec;
  font-size:11px;
  font-weight:900;
  text-transform:uppercase;
  letter-spacing:.07em;
}
.profile-background-head h2{
  margin:4px 0 5px;
  color:#30275e;
  font-size:25px;
}
.profile-background-head p{
  max-width:560px;
  margin:0;
  color:#827a96;
  font-size:12px;
  line-height:1.5;
}
.profile-background-close{
  flex:0 0 auto;
  width:40px;
  height:40px;
  border:0;
  border-radius:50%;
  background:#f3effb;
  color:#6c48cf;
  font-size:25px;
  line-height:1;
  cursor:pointer;
}
.profile-background-body{
  display:grid;
  gap:16px;
  padding:22px 26px 26px;
}
.profile-background-preview{
  position:relative;
  min-height:245px;
  overflow:hidden;
  border-radius:22px;
  border:1px solid #ded6f5;
  background:
    linear-gradient(180deg,rgba(25,20,66,.34),rgba(25,16,70,.84)),
    var(--profile-cover-image);
  background-size:cover;
  background-position:center;
  box-shadow:inset 0 -90px 110px rgba(18,10,52,.26);
}
.profile-background-preview.custom{
  background:
    linear-gradient(180deg,rgba(13,12,43,.22),rgba(19,12,57,.58)),
    var(--preview-background);
  background-size:cover;
  background-position:center;
}
.profile-background-preview-overlay{
  position:absolute;
  left:18px;
  right:18px;
  bottom:16px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:12px 14px;
  border:1px solid rgba(255,255,255,.18);
  border-radius:15px;
  background:rgba(25,15,66,.58);
  color:#fff;
  backdrop-filter:blur(9px);
  -webkit-backdrop-filter:blur(9px);
}
.profile-background-preview-overlay span{
  padding:5px 9px;
  border-radius:999px;
  background:rgba(172,105,255,.35);
  font-size:10px;
  font-weight:900;
}
.profile-background-preview-overlay strong{
  font-size:12px;
  text-align:right;
}
.profile-background-form{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  gap:12px;
}
.profile-background-file{
  min-width:0;
  padding:13px 15px;
  border:1px dashed #c9b8ee;
  border-radius:16px;
  background:#fbf9ff;
  cursor:pointer;
}
.profile-background-file input{
  position:absolute;
  width:1px;
  height:1px;
  opacity:0;
  pointer-events:none;
}
.profile-background-file span{
  display:block;
  color:#633dcc;
  font-size:13px;
  font-weight:900;
}
.profile-background-file small{
  display:block;
  margin-top:3px;
  color:#9189a4;
  font-size:10px;
}
.profile-background-save{
  min-height:58px;
  padding:0 20px;
  border:0;
  border-radius:16px;
  background:linear-gradient(135deg,#6f3af2,#a143ff);
  color:#fff;
  font-weight:900;
  cursor:pointer;
  box-shadow:0 10px 22px rgba(111,58,242,.20);
}
.profile-background-auto{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  padding:15px 16px;
  border:1px solid #e6e0f1;
  border-radius:17px;
  background:#fcfbfe;
}
.profile-background-auto strong{
  display:block;
  color:#433b65;
  font-size:12px;
}
.profile-background-auto span{
  display:block;
  margin-top:3px;
  color:#8b849c;
  font-size:10px;
  line-height:1.4;
}
.profile-background-auto button{
  min-height:38px;
  padding:0 14px;
  border:1px solid #d9c9ff;
  border-radius:12px;
  background:#f3edff;
  color:#6d45db;
  font-size:10px;
  font-weight:900;
  cursor:pointer;
  white-space:nowrap;
}
.profile-background-current{
  flex:0 0 auto;
  padding:6px 10px!important;
  border-radius:999px;
  background:#e7f5e4;
  color:#4f9b58!important;
  font-weight:900;
}
body.profile-background-lock{overflow:hidden}

@media(max-width:760px){
  .profile-v396-shell.has-custom-profile-background:before{
    display:block!important;
    position:fixed!important;
    inset:64px 0 0!important;
    z-index:-1!important;
  }
  .profile-background-modal{padding:10px}
  .profile-background-dialog{
    width:100%;
    max-height:calc(100vh - 20px);
    border-radius:22px;
  }
  .profile-background-head{padding:19px 18px 15px}
  .profile-background-head h2{font-size:21px}
  .profile-background-body{padding:16px 18px 20px}
  .profile-background-preview{min-height:205px}
  .profile-background-form{grid-template-columns:1fr}
  .profile-background-save{min-height:50px}
  .profile-background-auto{
    align-items:flex-start;
    flex-direction:column;
  }
  .profile-background-auto form,
  .profile-background-auto button{width:100%}
}

@media(max-width:430px){
  .profile-background-modal{padding:5px}
  .profile-background-dialog{
    max-height:calc(100vh - 10px);
    border-radius:18px;
  }
  .profile-background-head{padding:16px 14px 13px}
  .profile-background-head p{font-size:11px}
  .profile-background-body{padding:14px}
  .profile-background-preview{min-height:180px;border-radius:17px}
  .profile-background-preview-overlay{
    left:10px;right:10px;bottom:10px;
    align-items:flex-start;
    flex-direction:column;
  }
  .profile-background-preview-overlay strong{text-align:left}
}

.profile-background-size-tip{
  margin-top:5px!important;
  color:#7c7392!important;
  line-height:1.4!important;
}
.profile-background-size-tip::before{
  content:"↔ ";
  color:#7650df;
  font-weight:900;
}


/* ===== Vista previa real + loader del fondo ===== */
.profile-background-preview{isolation:isolate}
.profile-background-loading{
  position:absolute;inset:0;z-index:8;
  display:grid;place-items:center;align-content:center;gap:9px;
  padding:24px;text-align:center;
  background:
    radial-gradient(circle at 50% 35%,rgba(143,79,255,.28),transparent 34%),
    rgba(24,14,60,.82);
  color:#fff;
  backdrop-filter:blur(10px);
  -webkit-backdrop-filter:blur(10px);
}
.profile-background-loading[hidden]{display:none!important}
.profile-background-loading strong{font-size:15px}
.profile-background-loading>span{color:#d9cfff;font-size:11px}
.profile-background-loading>small{color:#fff;font-size:11px;font-weight:800}

.profile-background-spinner{
  width:74px;height:54px;display:flex;align-items:center;justify-content:center;gap:8px;
  margin-bottom:3px;
}
.profile-background-spinner i{
  width:13px;height:13px;border-radius:50%;
  background:linear-gradient(135deg,#fff,#b887ff);
  box-shadow:0 0 16px rgba(187,128,255,.55);
  animation:profileBgDot .8s ease-in-out infinite alternate;
}
.profile-background-spinner i:nth-child(2){animation-delay:.15s}
.profile-background-spinner i:nth-child(3){animation-delay:.30s}
@keyframes profileBgDot{
  from{transform:translateY(7px) scale(.85);opacity:.55}
  to{transform:translateY(-7px) scale(1.08);opacity:1}
}

.profile-background-loading-track{
  width:min(310px,78%);
  height:8px;border-radius:999px;overflow:hidden;
  background:rgba(255,255,255,.16);
  box-shadow:inset 0 1px 2px rgba(0,0,0,.2);
}
.profile-background-loading-track i{
  display:block;height:100%;border-radius:inherit;
  background:linear-gradient(90deg,#8f55ff,#d888ff,#fff);
  transition:width .18s ease;
}

.profile-background-save:disabled{
  cursor:not-allowed;opacity:.55;box-shadow:none;
  filter:saturate(.65)
}
.profile-background-save:not(:disabled){
  animation:profileBgReady .3s ease both
}
@keyframes profileBgReady{
  from{transform:scale(.98);opacity:.75}
  to{transform:scale(1);opacity:1}
}

.profile-background-upload-status{
  margin-top:-3px;padding:11px 13px;border-radius:13px;
  font-size:11px;font-weight:800;line-height:1.4;
}
.profile-background-upload-status[hidden]{display:none!important}
.profile-background-upload-status.ok{
  color:#3f8750;background:#eaf8eb;border:1px solid #cdebcf
}
.profile-background-upload-status.error{
  color:#a24155;background:#fff0f2;border:1px solid #f1ccd3
}

@media(max-width:760px){
  .profile-background-loading{padding:18px}
  .profile-background-loading-track{width:82%}
}

/* Click · Fix fondo personalizado V3 · visible en modo claro y oscuro */
body.profile-premium-v396 .profile-v396-shell.has-custom-profile-background{
  position:relative!important;
  z-index:0!important;
  isolation:isolate!important;
}
body.profile-premium-v396 .profile-v396-shell.has-custom-profile-background::before,
html[data-theme="light"] body.profile-premium-v396 .profile-v396-shell.has-custom-profile-background::before{
  content:""!important;
  display:block!important;
  position:fixed!important;
  inset:92px 0 0!important;
  z-index:-1!important;
  pointer-events:none!important;
  background-image:
    linear-gradient(180deg,rgba(10,10,40,.42),rgba(18,12,58,.68)),
    var(--profile-background-image)!important;
  background-size:cover!important;
  background-position:center!important;
  background-repeat:no-repeat!important;
  filter:none!important;
  transform:none!important;
  opacity:1!important;
}
@media(max-width:900px){
  body.profile-premium-v396 .profile-v396-shell.has-custom-profile-background::before,
  html[data-theme="light"] body.profile-premium-v396 .profile-v396-shell.has-custom-profile-background::before{
    display:block!important;
    inset:64px 0 0!important;
  }
}
