/* ═══════════════════════════════════════════════════════
   PROFIL MODAL — Dark Fantasy RPG Profile System
   Matching Königreich Alerne Design Language
   Tablet Frame Design with Hardware Buttons
═══════════════════════════════════════════════════════ */

@keyframes profilOpen{from{opacity:0;transform:scale(.93) translateY(18px);}to{opacity:1;transform:scale(1) translateY(0);}}
@keyframes profilPulse{0%,100%{box-shadow:0 0 20px rgba(123,95,255,.15);}50%{box-shadow:0 0 35px rgba(123,95,255,.3);}}
@keyframes profilBorderRun{0%{background-position:0% 50%;}100%{background-position:200% 50%;}}
@keyframes profilAvatarGlow{0%,100%{box-shadow:0 0 15px rgba(123,95,255,.3),0 0 0 2px rgba(123,95,255,.25);}50%{box-shadow:0 0 30px rgba(123,95,255,.5),0 0 0 2px rgba(123,95,255,.45);}}

/* ── OVERLAY ── */
#profilModal{
  display:none;position:fixed;inset:0;z-index:9500;
  align-items:center;justify-content:center;
  background:rgba(0,0,0,.88);
  backdrop-filter:blur(12px) saturate(1.1);
}
#profilModal.show{display:flex;}

/* ═══════════════════════════════════════════════════════
   TABLET FRAME — Physical device appearance
═══════════════════════════════════════════════════════ */
.tablet-frame{
  position:relative;
  width:min(960px,94vw);
  max-height:94vh;
  display:flex;flex-direction:column;
  background:linear-gradient(145deg,#1c1c1c 0%,#111 40%,#1a1a1a 100%);
  border:2px solid #2a2a2a;
  border-radius:24px;
  box-shadow:
    0 0 0 1px rgba(0,0,0,.9),
    0 0 0 3px rgba(30,30,30,.8),
    inset 0 1px 0 rgba(255,255,255,.03),
    0 40px 100px rgba(0,0,0,.7);
  overflow:visible;
  animation:profilOpen .4s cubic-bezier(.22,1.2,.36,1) forwards;
}

/* ── Hardware buttons on top edge ── */
.tablet-hw-buttons-top{
  position:absolute;top:-2px;left:50%;transform:translateX(-50%);
  display:flex;gap:14px;z-index:10;
}
.tablet-hw-btn-top{
  width:38px;height:5px;
  border-radius:0 0 3px 3px;
  background:linear-gradient(180deg,#2a2a2a 0%,#1a1a1a 60%,#222 100%);
  border:1px solid rgba(60,60,60,.5);border-top:none;
  box-shadow:0 2px 4px rgba(0,0,0,.4),inset 0 1px 0 rgba(80,80,80,.15);
}

/* ── Hardware button on left edge ── */
.tablet-hw-btn-left{
  position:absolute;left:-2px;top:120px;
  width:5px;height:32px;
  border-radius:3px 0 0 3px;
  background:linear-gradient(90deg,#2a2a2a 0%,#1a1a1a 60%,#222 100%);
  border:1px solid rgba(60,60,60,.5);border-right:none;
  box-shadow:-2px 0 4px rgba(0,0,0,.4),inset 1px 0 0 rgba(80,80,80,.15);
  z-index:10;
}

/* Top bezel — camera & sensor */
.tablet-bezel-top{
  flex-shrink:0;
  display:flex;align-items:center;justify-content:center;gap:10px;
  padding:10px 0 8px;
  background:linear-gradient(180deg,rgba(40,40,40,.5) 0%,transparent 100%);
  border-radius:22px 22px 0 0;
}
.tablet-camera{
  width:8px;height:8px;
  border-radius:50%;
  background:radial-gradient(circle,rgba(80,80,80,.5) 0%,rgba(50,50,50,.6) 60%,rgba(30,30,30,.9) 100%);
  border:1px solid rgba(60,60,60,.4);
  box-shadow:0 0 4px rgba(0,0,0,.3),inset 0 0 2px rgba(80,80,80,.2);
}
.tablet-sensor{
  width:40px;height:4px;
  border-radius:2px;
  background:rgba(60,60,60,.2);
  border:1px solid rgba(50,50,50,.15);
}

/* Screen area */
.tablet-screen{
  flex:1;min-height:0;
  margin:0 12px;
  border-radius:4px;
  overflow:hidden;
  border:1px solid rgba(40,40,40,.4);
  background:#000;
  box-shadow:inset 0 0 20px rgba(0,0,0,.5);
}

/* Bottom bezel — home button */
.tablet-bezel-bottom{
  flex-shrink:0;
  display:flex;align-items:center;justify-content:center;
  padding:8px 0 10px;
  background:linear-gradient(0deg,rgba(40,40,40,.5) 0%,transparent 100%);
  border-radius:0 0 22px 22px;
}
.tablet-home-btn{
  width:28px;height:28px;
  border-radius:50%;
  border:1.5px solid rgba(80,80,80,.25);
  background:rgba(60,60,60,.08);
  cursor:pointer;
  transition:all .2s;
}
.tablet-home-btn:hover{
  border-color:rgba(100,100,100,.4);
  background:rgba(80,80,80,.12);
  box-shadow:0 0 8px rgba(0,0,0,.3);
}

/* ── PANEL (inside tablet screen) ── */
.profil-panel{
  position:relative;
  width:100%;
  height:100%;
  max-height:none;
  display:flex;flex-direction:column;
  background:linear-gradient(160deg,#0f0d1a 0%,#131127 55%,#0f0d1a 100%);
  border:none;
  border-radius:0;
  box-shadow:none;
  overflow:hidden;
}
.profil-panel::before{
  content:'';position:absolute;top:0;left:0;right:0;height:1px;z-index:10;
  background:linear-gradient(90deg,transparent,rgba(123,95,255,.35) 20%,rgba(180,140,255,.9) 50%,rgba(123,95,255,.35) 80%,transparent);
  background-size:200%;animation:profilBorderRun 5s linear infinite;
}

/* ── HEADER ── */
.profil-header{
  flex-shrink:0;display:flex;align-items:center;justify-content:space-between;
  padding:14px 20px 12px;
  background:rgba(0,0,0,.2);
  border-bottom:1px solid rgba(123,95,255,.12);
  position:relative;
}
.profil-header::after{content:'';position:absolute;bottom:0;left:0;right:0;height:1px;background:linear-gradient(90deg,transparent,rgba(123,95,255,.4) 30%,rgba(123,95,255,.4) 70%,transparent);}
.profil-header-left{display:flex;align-items:center;gap:10px;}
.profil-header-icon{font-size:1.1rem;color:rgba(123,95,255,.7);}
.profil-header-title{font-family:'Barlow Condensed',sans-serif;font-size:1.05rem;font-weight:900;color:rgba(222,192,255,.95);letter-spacing:.08em;text-shadow:0 0 18px rgba(123,95,255,.3);}
.profil-header-sub{font-family:'Barlow Condensed',sans-serif;font-size:.55rem;color:rgba(150,100,220,.4);letter-spacing:.15em;text-transform:uppercase;}
.profil-xbtn{
  width:30px;height:30px;background:rgba(255,255,255,.04);border:1px solid rgba(255,255,255,.08);
  color:rgba(185,145,255,.42);border-radius:5px;cursor:pointer;font-size:.75rem;
  display:flex;align-items:center;justify-content:center;transition:all .18s;
}
.profil-xbtn:hover{background:rgba(215,46,76,.18);border-color:rgba(215,46,76,.35);color:#ff7090;}

/* ── BODY ── */
.profil-body{
  flex:1;display:flex;min-height:0;overflow:hidden;
}

/* ── SIDEBAR (Avatar + Quick Info) ── */
.profil-sidebar{
  width:240px;flex-shrink:0;
  display:flex;flex-direction:column;align-items:center;
  padding:24px 16px 20px;
  border-right:1px solid rgba(123,95,255,.08);
  background:rgba(0,0,0,.12);
  overflow-y:auto;
}

.profil-avatar-wrap{
  position:relative;width:110px;height:110px;
  border-radius:50%;cursor:pointer;
  background:linear-gradient(135deg,rgba(123,95,255,.15),rgba(80,40,180,.1));
  border:2px solid rgba(123,95,255,.35);
  overflow:hidden;
  animation:profilAvatarGlow 3s ease-in-out infinite;
  transition:transform .2s;
}
.profil-avatar-wrap:hover{transform:scale(1.05);}
.profil-avatar-img{
  width:100%;height:100%;object-fit:cover;display:block;
}
.profil-avatar-overlay{
  position:absolute;inset:0;
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  background:rgba(0,0,0,.7);
  opacity:0;transition:opacity .25s;
}
.profil-avatar-wrap:hover .profil-avatar-overlay{opacity:1;}
.profil-avatar-overlay-icon{font-size:1.5rem;margin-bottom:4px;}
.profil-avatar-overlay-txt{font-family:'Barlow Condensed',sans-serif;font-size:.6rem;font-weight:700;letter-spacing:.12em;text-transform:uppercase;color:rgba(255,255,255,.8);}

.profil-sidebar-name{
  margin-top:14px;
  font-family:'Barlow Condensed',sans-serif;font-size:1.15rem;font-weight:900;
  color:rgba(222,192,255,.95);letter-spacing:.05em;text-align:center;
  text-shadow:0 0 12px rgba(123,95,255,.2);
}
.profil-sidebar-role{
  font-family:'Barlow Condensed',sans-serif;font-size:.55rem;font-weight:700;
  letter-spacing:.2em;text-transform:uppercase;
  color:rgba(123,95,255,.5);margin-top:2px;
}
.profil-sidebar-coins{
  display:flex;align-items:center;gap:5px;margin-top:14px;
  padding:6px 14px;
  background:rgba(220,170,40,.06);border:1px solid rgba(220,170,40,.18);border-radius:5px;
  font-family:'Barlow Condensed',sans-serif;font-size:.85rem;font-weight:800;
  color:rgba(255,198,70,.92);letter-spacing:.05em;
}
.profil-sidebar-coins-icon{font-size:.9rem;}

.profil-sidebar-stats{
  display:flex;gap:20px;margin-top:18px;
}
.profil-sidebar-stat{
  display:flex;flex-direction:column;align-items:center;gap:2px;
}
.profil-sidebar-stat-val{
  font-family:'Barlow Condensed',sans-serif;font-size:1.1rem;font-weight:900;
  color:rgba(200,170,255,.85);
}
.profil-sidebar-stat-lbl{
  font-family:'Barlow Condensed',sans-serif;font-size:.42rem;font-weight:700;
  letter-spacing:.16em;text-transform:uppercase;color:rgba(150,112,205,.32);
}

.profil-inv-btn{
  margin-top:20px;width:100%;
  padding:10px 14px;
  background:linear-gradient(135deg,rgba(123,95,255,.15),rgba(80,40,180,.1));
  border:1px solid rgba(123,95,255,.25);border-radius:6px;
  color:rgba(200,170,255,.85);
  font-family:'Barlow Condensed',sans-serif;font-size:.75rem;font-weight:700;
  letter-spacing:.1em;text-transform:uppercase;
  cursor:pointer;transition:all .25s;
}
.profil-inv-btn:hover{
  background:linear-gradient(135deg,rgba(123,95,255,.35),rgba(80,40,180,.25));
  border-color:rgba(123,95,255,.5);color:#fff;
  transform:translateY(-1px);
  box-shadow:0 4px 12px rgba(123,95,255,.2);
}

/* ── MAIN (Tabs + Content) ── */
.profil-main{
  flex:1;display:flex;flex-direction:column;min-width:0;overflow-y:auto;
  padding:0;
}

/* Tabs */
.profil-tabs{
  flex-shrink:0;display:flex;
  border-bottom:1px solid rgba(123,95,255,.12);
  background:rgba(0,0,0,.15);
}
.profil-tab{
  flex:1;padding:11px 12px;
  background:none;border:none;
  color:rgba(255,255,255,.3);
  font-family:'Barlow Condensed',sans-serif;font-size:.72rem;font-weight:700;
  letter-spacing:.12em;text-transform:uppercase;
  cursor:pointer;
  border-bottom:2px solid transparent;
  transition:all .2s;margin-bottom:-1px;
}
.profil-tab:hover{color:rgba(255,255,255,.6);background:rgba(123,95,255,.04);}
.profil-tab.active{color:rgba(123,95,255,1);border-bottom-color:rgba(123,95,255,.9);background:rgba(123,95,255,.05);}

/* Tab Content */
.profil-tab-content{
  display:none;padding:22px 24px;
}
.profil-tab-content.active{display:block;}

.profil-section-title{
  font-family:'Barlow Condensed',sans-serif;font-size:.65rem;font-weight:800;
  letter-spacing:.2em;text-transform:uppercase;
  color:rgba(123,95,255,.45);
  margin-bottom:16px;
  padding-bottom:8px;
  border-bottom:1px solid rgba(255,255,255,.04);
}

/* ── FORM FIELDS ── */
.profil-field{margin-bottom:18px;}
.profil-field label{
  display:block;
  font-family:'Barlow',sans-serif;font-size:.65rem;font-weight:600;
  letter-spacing:.12em;text-transform:uppercase;
  color:rgba(200,200,230,.45);
  margin-bottom:6px;
}
.profil-field input,
.profil-field textarea,
.profil-field select{
  width:100%;
  background:rgba(255,255,255,.03);
  border:1px solid rgba(123,95,255,.15);
  border-radius:6px;
  padding:10px 13px;
  color:#e0daf0;
  font-size:14px;
  font-family:'Barlow',sans-serif;
  outline:none;
  transition:border-color .25s,background .25s,box-shadow .25s;
  box-sizing:border-box;
  resize:vertical;
}
.profil-field input:focus,
.profil-field textarea:focus,
.profil-field select:focus{
  border-color:rgba(123,95,255,.5);
  background:rgba(123,95,255,.06);
  box-shadow:0 0 0 3px rgba(123,95,255,.08);
}
.profil-field select{
  cursor:pointer;
  -webkit-appearance:none;-moz-appearance:none;appearance:none;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%237B5FFF' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat:no-repeat;background-position:right 12px center;
  padding-right:32px;
}
.profil-field select option{
  background:#0f0d2a;color:#fff;
}
.profil-field-row{
  display:flex;gap:8px;
}
.profil-field-row input{flex:1;}
.profil-field-hint{
  font-family:'Barlow',sans-serif;font-size:.6rem;
  color:rgba(150,130,200,.3);margin-top:5px;letter-spacing:.03em;
}

/* Save Button */
.profil-save-btn{
  padding:9px 18px;
  background:linear-gradient(135deg,#7B5FFF,#6247d4);
  border:none;border-radius:6px;
  color:#fff;
  font-family:'Barlow Condensed',sans-serif;font-size:.72rem;font-weight:700;
  letter-spacing:.08em;text-transform:uppercase;
  cursor:pointer;transition:all .2s;
  white-space:nowrap;flex-shrink:0;
  box-shadow:0 2px 8px rgba(123,95,255,.25);
}
.profil-save-btn:hover{
  background:linear-gradient(135deg,#9a7fff,#7B5FFF);
  transform:translateY(-1px);
  box-shadow:0 4px 16px rgba(123,95,255,.35);
}
.profil-save-btn-full{width:100%;margin-top:8px;}
.profil-reset-btn{
  background:linear-gradient(135deg,rgba(255,80,80,.2),rgba(180,40,40,.15));
  border:1px solid rgba(255,80,80,.25);
  color:rgba(255,150,150,.8);
  margin-top:6px;
}
.profil-reset-btn:hover{
  background:linear-gradient(135deg,rgba(255,80,80,.35),rgba(180,40,40,.25));
  border-color:rgba(255,80,80,.45);color:#fff;
}

/* Status messages */
.profil-msg{
  text-align:center;font-size:12px;margin-top:12px;padding:8px;border-radius:4px;
  font-family:'Barlow',sans-serif;
  display:none;
}
.profil-msg.error{display:block;color:#ff6060;background:rgba(255,60,60,.1);border:1px solid rgba(255,60,60,.2);}
.profil-msg.success{display:block;color:#60ff90;background:rgba(60,255,100,.1);border:1px solid rgba(60,255,100,.2);}

/* Appearance preview */
.profil-appearance-preview{
  width:140px;height:140px;margin:0 auto 12px;
  border-radius:50%;overflow:hidden;
  border:2px solid rgba(123,95,255,.3);
  background:rgba(123,95,255,.06);
}
.profil-appearance-img{width:100%;height:100%;object-fit:cover;display:block;}

/* Danger zone */
.profil-danger-zone{
  padding:12px 14px;
  background:rgba(255,255,255,.02);
  border:1px solid rgba(255,255,255,.05);
  border-radius:5px;
}
.profil-danger-zone p{
  font-family:'Barlow',sans-serif;font-size:.72rem;
  color:rgba(200,200,230,.4);margin:0;
}

/* ── ADMIN: Profile View in Admin Panel ── */
.adm-profil-card{
  display:flex;align-items:center;gap:12px;
  padding:12px 14px;
  background:rgba(255,255,255,.03);
  border:1px solid rgba(255,255,255,.06);
  border-radius:6px;margin-bottom:10px;
}
.adm-profil-avatar{
  width:48px;height:48px;border-radius:50%;
  border:2px solid rgba(123,95,255,.3);
  object-fit:cover;flex-shrink:0;
  background:rgba(123,95,255,.08);
}
.adm-profil-info{flex:1;min-width:0;}
.adm-profil-name{
  font-family:'Barlow Condensed',sans-serif;font-size:.85rem;font-weight:800;
  color:rgba(222,192,255,.9);letter-spacing:.04em;
}
.adm-profil-meta{
  font-family:'Barlow',sans-serif;font-size:.6rem;
  color:rgba(150,130,200,.4);margin-top:2px;
}
.adm-profil-bio{
  font-family:'Barlow',sans-serif;font-size:.65rem;
  color:rgba(200,180,230,.5);margin-top:4px;
  font-style:italic;
}

/* ═══════════════════════════════════════════════════════
   EMBEDDED INVENTORY — Opens inside the tablet frame
═══════════════════════════════════════════════════════ */
.profil-inv-embed{
  position:absolute;inset:0;z-index:20;
  display:none;flex-direction:column;
  background:linear-gradient(160deg,#0f0d1a 0%,#131127 55%,#0f0d1a 100%);
  animation:profilOpen .3s cubic-bezier(.22,1.2,.36,1) forwards;
}
.profil-inv-embed.show{display:flex;}
.profil-inv-embed .inv-panel{
  width:100%;max-height:none;height:100%;
  border:none;border-radius:0;
  box-shadow:none;
  animation:none;
  background:transparent;
}
.profil-inv-embed .inv-panel::before{display:none;}
.profil-inv-embed .inv-header{
  background:rgba(0,0,0,.2);
  border-bottom:1px solid rgba(123,95,255,.12);
}
.profil-inv-embed .inv-header::after{
  background:linear-gradient(90deg,transparent,rgba(123,95,255,.4) 30%,rgba(123,95,255,.4) 70%,transparent);
}
.profil-inv-embed .inv-stats-bar{
  background:rgba(0,0,0,.15);
  border-bottom:1px solid rgba(123,95,255,.08);
}
.profil-inv-embed .inv-char-panel{
  background:rgba(0,0,0,.1);
  border-right:1px solid rgba(123,95,255,.08);
}
.profil-inv-embed .inv-bag-panel{
  background:transparent;
}
.profil-inv-embed .inv-filters{
  background:rgba(0,0,0,.1);
  border-bottom:1px solid rgba(123,95,255,.08);
}
.profil-inv-embed .inv-xbtn{
  display:flex;
}

/* ── RESPONSIVE ── */
@media(max-width:700px){
  .tablet-frame{
    width:98vw;
    max-height:96vh;
    border-radius:18px;
  }
  .tablet-bezel-top{padding:8px 0 6px;}
  .tablet-bezel-bottom{padding:6px 0 8px;}
  .tablet-home-btn{width:24px;height:24px;}
  .tablet-screen{margin:0 8px;}
  .profil-body{flex-direction:column;}
  .profil-sidebar{
    width:100%;
    flex-direction:row;flex-wrap:wrap;justify-content:center;
    padding:16px;gap:12px;
    border-right:none;border-bottom:1px solid rgba(255,255,255,.05);
  }
  .profil-avatar-wrap{width:70px;height:70px;}
  .profil-sidebar-stats{margin-top:0;}
  .profil-inv-btn{width:auto;margin-top:0;}
  .profil-main{min-height:300px;}
  .profil-tab-content{padding:16px;}
}
