/* ================= DASHBOARD (PAGE-SCOPED) ================= */
/* Everything is scoped to body.dashboard-page so it can't affect other pages */

html, body{
  height: auto;
  min-height: 100%;
}

body.dashboard-page{
  min-height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;

  background: linear-gradient(
    135deg,
    #1a0b2e 0%,
    #16213e 25%,
    #0f3460 50%,
    #533483 75%,
    #7b2cbf 100%
  );
  background-attachment: fixed;
  position: relative;
}

/* Starfield overlay */
body.dashboard-page::before{
  content:"";
  position: fixed;
  inset: 0;
  pointer-events:none;
  z-index:-1;
  background-image:
    radial-gradient(2px 2px at 20px 30px, rgba(255,255,255,.85), transparent),
    radial-gradient(2px 2px at 40px 70px, rgba(255,255,255,.55), transparent),
    radial-gradient(1px 1px at 90px 40px, rgba(255,255,255,.45), transparent),
    radial-gradient(1px 1px at 130px 80px, rgba(255,255,255,.35), transparent),
    radial-gradient(2px 2px at 160px 30px, rgba(255,255,255,.45), transparent);
  background-repeat: repeat;
  background-size: 200px 100px;
  animation: sparkle 20s linear infinite;
}

@keyframes sparkle{
  from { transform: translateX(0); }
  to   { transform: translateX(200px); }
}

/* Prevent random gray text from global styles bleeding in */
body.dashboard-page .muted{
  color: rgba(255,255,255,1);
}

/* Make sure headings are white */
body.dashboard-page .section-title{
  color: #fff;
}

/* Ensure activity list text is white */
body.dashboard-page .activity-title{
  color: rgba(255,255,255,1);
}
body.dashboard-page .activity-desc{
  color: rgba(255,255,255,1);
}
body.dashboard-page .activity-placeholder h4{
  color: rgba(255,255,255,1);
}
body.dashboard-page .activity-placeholder p{
  color: rgba(255,255,255,1);
}

/* Loading screen - dark glass */
body.dashboard-page .loading-screen{
  position: fixed;
  inset: 0;
  background: rgba(5,6,20,.75);
  backdrop-filter: blur(10px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
}

body.dashboard-page .loading-content{
  background: rgba(10,12,26,.70);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 18px;
  padding: 26px 28px;
  text-align: center;
  box-shadow: 0 26px 80px rgba(0,0,0,.55);
  color: rgba(255,255,255,.95);
}

body.dashboard-page .loading-spinner{
  width: 44px;
  height: 44px;
  border: 4px solid rgba(255,255,255,.18);
  border-top: 4px solid rgba(199,125,255,.85);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 14px;
}

@keyframes spin{
  0% { transform: rotate(0); }
  100% { transform: rotate(360deg); }
}

body.dashboard-page .loading-content p{
  margin: 0;
  opacity: .95;
  font-weight: 800;
}

/* ===== Worlds list refresh ===== */
body.dashboard-page #worldList{
  display: flex;
  flex-direction: column;
  gap: 12px;
}

body.dashboard-page .world-row{
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.10);
  background: linear-gradient(135deg, rgba(255,255,255,0.10), rgba(255,255,255,0.04));
  backdrop-filter: blur(10px);
}

body.dashboard-page .world-thumb{
  width: 96px;
  height: 54px;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(255,255,255,.12);
  background: radial-gradient(circle at 20% 30%, rgba(120,160,255,0.35), rgba(0,0,0,0.0) 55%),
              radial-gradient(circle at 70% 65%, rgba(200,120,255,0.28), rgba(0,0,0,0.0) 60%),
              rgba(5,7,18,0.55);
}

body.dashboard-page .world-thumb img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

body.dashboard-page .world-main{
  display: flex;
  flex-direction: column;
  gap: 6px;
}

body.dashboard-page .world-title-row{
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

body.dashboard-page .world-title{
  font-size: 16px;
  font-weight: 800;
  color: rgba(255,255,255,0.96);
  font-family: var(--font-display);
}

body.dashboard-page .world-meta{
  font-size: 12px;
  color: rgba(255,255,255,0.72);
}

body.dashboard-page .world-status{
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.9);
}

body.dashboard-page .world-status.published{
  border-color: rgba(128,255,200,0.35);
  color: rgba(187,255,222,0.95);
  background: rgba(64,220,160,0.12);
}

body.dashboard-page .world-status.draft{
  border-color: rgba(255,220,160,0.3);
  color: rgba(255,236,200,0.95);
  background: rgba(255,200,120,0.12);
}

body.dashboard-page .world-status.unlisted{
  border-color: rgba(140,200,255,0.32);
  color: rgba(200,230,255,0.95);
  background: rgba(90,170,255,0.14);
}

body.dashboard-page .world-actions{
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  position: relative;
}

body.dashboard-page .icon-btn{
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.92);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}

body.dashboard-page .icon-btn svg{
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ===== Passport widget ===== */
body.dashboard-page .passport-widget{
  margin-top: 10px;
  padding: 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}

@media (max-width: 900px){
  body.dashboard-page .passport-widget{
    grid-template-columns: 1fr;
  }
}

body.dashboard-page .passport-overall{
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(0,0,0,0.18);
}

body.dashboard-page .passport-overall-head{
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

body.dashboard-page .passport-overall-title{
  font-weight: 900;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.8);
  font-family: var(--font-display);
}

body.dashboard-page .passport-overall-level{
  font-weight: 900;
  font-size: 18px;
  color: rgba(255,255,255,0.95);
  font-family: var(--font-display);
}

body.dashboard-page .passport-overall-bar{
  height: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.12);
  overflow: hidden;
}

body.dashboard-page .passport-overall-bar span{
  display: block;
  height: 100%;
  width: 0;
  background: rgba(199,125,255,0.7);
}

body.dashboard-page .passport-overall-xp{
  font-size: 12px;
  font-weight: 700;
  color: rgba(255,255,255,0.75);
}

body.dashboard-page .passport-recent{
  display: flex;
  flex-direction: column;
  gap: 10px;
}

body.dashboard-page .passport-recent-title{
  font-weight: 900;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.8);
  font-family: var(--font-display);
}

body.dashboard-page .passport-recent-list{
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

body.dashboard-page .passport-recent-item{
  display: flex;
  align-items: center;
  padding: 0;
  border-radius: 0;
  border: none;
  background: transparent;
}

body.dashboard-page .passport-recent-icon{
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.95);
  overflow: hidden;
}

body.dashboard-page .passport-recent-icon svg{
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

body.dashboard-page .passport-recent-icon img{
  width: 100%;
  height: 100%;
  object-fit: cover;
}

body.dashboard-page .passport-recent-meta{
  display: none;
}

body.dashboard-page .passport-recent-title-text{
  font-weight: 700;
  font-size: 13px;
  color: rgba(255,255,255,0.92);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.dashboard-page .passport-recent-sub{
  font-size: 11px;
  color: rgba(255,255,255,0.62);
}

body.dashboard-page .passport-view-link{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  grid-column: 1 / -1;
}

body.dashboard-page .icon-btn:hover{
  transform: translateY(-1px);
  background: rgba(199,125,255,0.18);
  box-shadow: 0 10px 20px rgba(152,71,255,.35);
}

body.dashboard-page .icon-btn:disabled{
  opacity: .45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

body.dashboard-page .icon-btn.danger{
  border-color: rgba(255,120,120,0.35);
  color: rgba(255,170,170,0.95);
}

body.dashboard-page .icon-btn.danger:hover{
  background: rgba(255,120,120,0.18);
  box-shadow: 0 10px 20px rgba(255,120,120,.3);
}

body.dashboard-page .world-toast{
  position: absolute;
  top: -26px;
  right: 0;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(12,14,28,0.85);
  border: 1px solid rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.9);
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}

body.dashboard-page .world-toast.show{
  opacity: 1;
  transform: translateY(0);
}

body.dashboard-page .pager .btn{
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,0.06);
}

body.dashboard-page .worlds-head .pager{
  margin-top: 0;
}

body.dashboard-page .btn:disabled{
  opacity: 0.45;
  cursor: not-allowed;
}

@media (max-width: 720px){
  body.dashboard-page .world-row{
    grid-template-columns: auto 1fr;
    grid-template-areas:
      "thumb main"
      "thumb actions";
  }

  body.dashboard-page .world-thumb{ grid-area: thumb; }
  body.dashboard-page .world-main{ grid-area: main; }
  body.dashboard-page .world-actions{ grid-area: actions; justify-content: flex-start; }
}

/* ===== Modal ===== */
body.dashboard-page .modal-overlay{
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5,6,20,.65);
  backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
  z-index: 9999;
}

body.dashboard-page .modal-overlay.open{
  opacity: 1;
  pointer-events: auto;
}

body.dashboard-page .modal-card{
  width: min(420px, 92vw);
  padding: 18px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(10,12,26,.90);
  box-shadow: 0 30px 80px rgba(0,0,0,.65);
  color: rgba(255,255,255,.95);
}

body.dashboard-page .modal-title{
  font-weight: 900;
  font-size: 18px;
  margin-bottom: 6px;
  font-family: var(--font-display);
}

body.dashboard-page .modal-desc{
  font-size: 13px;
  color: rgba(255,255,255,.75);
  margin-bottom: 10px;
}

body.dashboard-page .modal-world{
  font-size: 13px;
  font-weight: 700;
  color: rgba(255,255,255,.9);
  margin-bottom: 10px;
}

body.dashboard-page .modal-error{
  color: rgba(255,160,160,.95);
  font-size: 12px;
  margin-bottom: 10px;
}

body.dashboard-page .modal-actions{
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
