/* =========================
   STATS BAR
   ========================= */
.stats-bar{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(150px, 1fr));
  gap:15px;
  margin:30px 0;
}
.stat-box{
  background:rgba(0,0,0,0.7);
  border:2px solid var(--primary);
  padding:15px;
  text-align:center;
  border-radius:5px;
}
.stat-label{
  font-size:0.8rem;
  color:#888;
  text-transform:uppercase;
}
.stat-value{
  font-size:1.8rem;
  color:var(--primary);
  font-weight:900;
}

/* =========================
   QUEST LISTS / CATEGORIES
   ========================= */
.quest-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(300px, 1fr));
  gap:20px;
  margin:30px 0;
}
.quest-category{
  background:rgba(0,0,0,0.8);
  border:2px solid var(--dark-gold);
  border-radius:10px;
  padding:20px;
}
.category-header{
  display:flex;
  align-items:center;
  gap:10px;
  margin-bottom:15px;
  padding-bottom:10px;
  border-bottom:2px solid var(--dark-gold);
}
.category-icon{ font-size:1.5rem; }
.category-title{ font-size:1.3rem; color:var(--gold); }

.quest-list{
  display:flex;
  flex-direction:column;
  gap:10px;
}
.quest-item{
  background:rgba(255,255,255,0.05);
  border:1px solid #444;
  padding:12px;
  border-radius:5px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  cursor:pointer;
  transition:all 0.3s;
}
.quest-item:hover{
  background:rgba(255,215,0,0.1);
  border-color:var(--gold);
  transform:translateX(5px);
}
.quest-info{
  flex:1;
  display:flex;
  align-items:center;
  gap:10px;
  min-width:0;
}
.quest-img{
  width:40px;
  height:40px;
  border-radius:5px;
  object-fit:cover;
  border:1px solid var(--dark-gold);
}
.quest-name{ font-weight:700; color:var(--parchment); }
.quest-desc{ font-size:0.8rem; color:#888; margin-top:2px; }
.quest-xp{
  background:var(--gold);
  color:#000;
  padding:4px 8px;
  border-radius:3px;
  font-weight:700;
  font-size:0.8rem;
}
.quest-complete{
  opacity:0.5;
  border-color:var(--gold);
}
.quest-complete .quest-name{
  text-decoration:line-through;
  color:var(--gold);
}

/* =========================
   PROGRESS BARS
   ========================= */
.xp-bar-container{
  width:100%;
  height:30px;
  background:#1a1a1a;
  border:2px solid var(--gold);
  border-radius:15px;
  overflow:hidden;
  margin:10px 0;
  position:relative;
}
.xp-bar-fill{
  height:100%;
  background:linear-gradient(90deg, var(--dark-gold) 0%, var(--gold) 50%, var(--dark-gold) 100%);
  transition:width 0.5s ease;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:900;
  color:#000;
  font-size:0.9rem;
}

/* =========================
   FORMS
   ========================= */
.form-container{
  max-width:600px;
  margin:0 auto;
  background:rgba(0,0,0,0.8);
  border:2px solid var(--gold);
  padding:30px;
  border-radius:10px;
}
.form-group{ margin-bottom:20px; }
.form-label{
  display:block;
  color:var(--gold);
  margin-bottom:5px;
  font-weight:700;
}
.form-input, .form-select, .form-textarea{
  width:100%;
  padding:10px;
  background:#1a1a1a;
  border:1px solid #444;
  color:var(--parchment);
  font-family:'Cinzel', serif;
  border-radius:5px;
}
.form-input:focus, .form-select:focus, .form-textarea:focus{
  outline:none;
  border-color:var(--gold);
}
.file-input-wrapper{ position:relative; overflow:hidden; display:inline-block; width:100%; }
.file-input-wrapper input[type=file]{ position:absolute; left:-9999px; }
.file-input-label{
  display:block;
  padding:10px;
  background:#2a2a2a;
  border:2px dashed var(--dark-gold);
  border-radius:5px;
  text-align:center;
  cursor:pointer;
  transition:all 0.3s;
}
.file-input-label:hover{
  border-color:var(--gold);
  background:rgba(255,215,0,0.1);
}
.image-preview{
  max-width:200px;
  max-height:200px;
  margin-top:10px;
  border:2px solid var(--gold);
  border-radius:5px;
  display:none;
}
.btn-submit{
  width:100%;
  padding:15px;
  background:linear-gradient(135deg, var(--gold) 0%, var(--dark-gold) 100%);
  border:none;
  color:#000;
  font-family:'Cinzel', serif;
  font-weight:900;
  font-size:1.1rem;
  cursor:pointer;
  border-radius:5px;
  transition:all 0.3s;
}
.btn-submit:hover{
  transform:translateY(-2px);
  box-shadow:0 5px 15px rgba(255,215,0,0.4);
}

/* =========================
   INVENTORY GRID
   ========================= */
.inventory-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill, minmax(100px, 1fr));
  gap:15px;
  padding:20px;
  background:rgba(0,0,0,0.8);
  border:3px solid var(--dark-gold);
  border-radius:10px;
}
.inventory-slot{
  aspect-ratio:1;
  background:linear-gradient(135deg,#2a2a2a 0%,#1a1a1a 100%);
  border:2px solid #444;
  border-radius:5px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  position:relative;
  transition:all 0.3s;
  overflow:hidden;
}
.inventory-slot img{
  width:64px;
  height:64px;
  object-fit:cover;
  border-radius:3px;
}
.inventory-slot:hover{
  border-color:var(--gold);
  transform:scale(1.05);
  box-shadow:0 0 10px rgba(255,215,0,0.3);
}
.inventory-slot.rarity-common{ border-color:#9e9e9e; }
.inventory-slot.rarity-uncommon{ border-color:#4caf50; }
.inventory-slot.rarity-rare{ border-color:#2196f3; }
.inventory-slot.rarity-epic{ border-color:#9c27b0; }
.inventory-slot.rarity-legendary{ border-color:#ff9800; box-shadow:0 0 10px rgba(255,152,0,0.3); }
.item-quantity{
  position:absolute;
  bottom:2px;
  right:2px;
  background:#000;
  color:#fff;
  padding:2px 6px;
  font-size:0.8rem;
  border-radius:3px;
  font-family:Arial, sans-serif;
  font-weight:bold;
}

/* =========================
   TOOLTIP
   ========================= */
.item-tooltip{
  position:fixed;
  background:rgba(0,0,0,0.95);
  border:2px solid var(--gold);
  padding:15px;
  border-radius:5px;
  max-width:300px;
  z-index:1000;
  pointer-events:none;
  display:none;
  box-shadow:0 10px 30px rgba(0,0,0,0.8);
}
.tooltip-title{
  color:var(--gold);
  font-size:1.1rem;
  font-weight:700;
  margin-bottom:5px;
}
.tooltip-subtitle{
  color:#888;
  font-size:0.9rem;
  font-style:italic;
  margin-bottom:10px;
}
.tooltip-stat{
  color:#4caf50;
  font-size:0.9rem;
  margin:2px 0;
}
.tooltip-desc{
  color:#ccc;
  font-size:0.85rem;
  margin-top:10px;
  padding-top:10px;
  border-top:1px solid #444;
}

/* =========================
   CALENDAR (FIX: CLAMP CHAMPION IMAGES)
   ========================= */
.calendar-grid{
  display:grid;
  grid-template-columns:repeat(7, 1fr);
  gap:6px;
  margin:20px 0;
}

.calendar-header{
  text-align:center;
  padding:10px;
  background:rgba(255,215,0,0.2);
  border:1px solid var(--gold);
  font-weight:700;
  color:var(--gold);
}

.calendar-day{
  aspect-ratio:1;
  background:rgba(0,0,0,0.6);
  border:1px solid #444;
  padding:6px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  transition:all 0.3s;
  position:relative;
  overflow:hidden; /* critical: prevents huge images blowing out */
}

.calendar-day:hover{
  border-color:var(--gold);
  background:rgba(255,215,0,0.08);
}

.calendar-day.today{
  border:2px solid var(--gold);
  background:rgba(255,215,0,0.15);
}

.calendar-day.completed{
  background:rgba(76,175,80,0.18);
  border-color:#4caf50;
}

.day-number{
  font-size:0.85rem;
  font-weight:800;
  margin-bottom:4px;
}

/* ✅ The “champion icon” inside the calendar day */
.day-champion{
  width:32px;
  height:32px;
  border-radius:50%;
  object-fit:cover;
  border:1px solid var(--dark-gold);
}

/* ✅ Hard clamp ANY image inside a calendar cell (prevents poster-size images) */
.calendar-day img{
  width:32px !important;
  height:32px !important;
  max-width:32px !important;
  max-height:32px !important;
  object-fit:cover !important;
  border-radius:50% !important;
  display:block !important;
}

/* Responsive calendar */
@media (max-width:768px){
  .calendar-grid{ gap:3px; }
  .calendar-day{ padding:4px; }
  .day-number{ font-size:0.75rem; }
  .day-champion{
    width:26px;
    height:26px;
  }
  .calendar-day img{
    width:26px !important;
    height:26px !important;
    max-width:26px !important;
    max-height:26px !important;
  }
}

/* =========================
   CHAMPION LADDER (FILL WIDTH, LEVEL + XP SEPARATE)
   ========================= */
.ladder-container{
  background:rgba(0,0,0,0.8);
  border:3px solid var(--gold);
  border-radius:10px;
  overflow:hidden;
}
.ladder-header{
  background:linear-gradient(90deg,transparent 0%, rgba(255,215,0,0.2) 50%, transparent 100%);
  padding:20px;
  text-align:center;
  border-bottom:2px solid var(--gold);
}
.ladder-row{
  display:grid;
  grid-template-columns:60px minmax(260px, 420px) 1fr 1fr;
  align-items:center;
  padding:14px 16px;
  border-bottom:1px solid #333;
  transition:all 0.3s;
  column-gap:16px;
}
.ladder-row:hover{ background:rgba(255,215,0,0.05); }
.ladder-rank{
  font-size:1.35rem;
  font-weight:900;
  color:var(--gold);
  text-align:center;
}
.ladder-champion{
  display:flex;
  align-items:center;
  gap:14px;
  min-width:0;
}
.ladder-avatar{
  width:46px;
  height:70px;
  border:2px solid var(--primary);
  border-radius:6px;
  overflow:hidden;
  flex:0 0 auto;
}
.ladder-avatar img{
  width:100%;
  height:100%;
  object-fit:cover;
}
.ladder-info h3{
  color:var(--parchment);
  margin:0;
  line-height:1.05;
  font-size:1.1rem;
  letter-spacing:0.3px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.ladder-info p{
  margin:4px 0 0;
  font-size:0.78rem;
  color:#888;
  line-height:1.05;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.ladder-stat{
  justify-self:stretch;
  text-align:center;
  line-height:1.05;
}
.ladder-stat-value{
  font-size:1.25rem;
  color:var(--gold);
  font-weight:900;
  margin:0;
}
.ladder-stat-label{
  font-size:0.62rem;
  color:#666;
  text-transform:uppercase;
  margin-top:4px;
}
@media (max-width:768px){
  .quest-grid{ grid-template-columns:1fr; }
  .ladder-row{
    grid-template-columns:46px minmax(180px,1fr) 90px 90px;
    padding:12px 12px;
    column-gap:10px;
  }
  .ladder-avatar{ width:38px; height:56px; }
  .ladder-stat{ text-align:right; justify-self:end; }
  .ladder-stat-value{ font-size:1.1rem; }
  .ladder-stat-label{ font-size:0.58rem; }
}

/* =========================
   CHAMPION CARDS
   ========================= */
.champion-card{
  background:rgba(0,0,0,0.8);
  border:2px solid var(--dark-gold);
  border-radius:10px;
  padding:20px;
  text-align:center;
  transition:all 0.3s;
}
.champion-card:hover{
  transform:translateY(-5px);
  box-shadow:0 10px 30px rgba(0,0,0,0.5);
}
.champion-card-img{
  width:100%;
  height:200px;
  object-fit:cover;
  border-radius:5px;
  margin-bottom:15px;
  border:2px solid var(--primary);
}

/* =========================
   BADGES (BOUNTY ACHIEVEMENTS)
   ========================= */
.badge-section{
  margin-top:14px;
  padding-top:12px;
  border-top:1px solid rgba(255,255,255,0.08);
  text-align:left;
}
.badge-title{
  font-size:0.85rem;
  font-weight:900;
  color:var(--gold);
  text-transform:uppercase;
  letter-spacing:1px;
  margin-bottom:8px;
}
.badge-empty{ color:#888; font-size:0.85rem; }
.badge-strip{ display:flex; flex-wrap:wrap; gap:10px; }
.badge{
  width:42px;
  height:42px;
  border-radius:8px;
  border:2px solid rgba(255,215,0,0.35);
  background:rgba(0,0,0,0.6);
  position:relative;
  cursor:pointer;
  outline:none;
}
.badge img{
  width:100%;
  height:100%;
  object-fit:cover;
  border-radius:6px;
  display:block;
}
.badge-fallback{
  width:100%;
  height:100%;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:1.2rem;
  border-radius:6px;
  background:#111;
  color:var(--gold);
}
.badge-popover{
  display:none;
  position:absolute;
  left:50%;
  transform:translateX(-50%);
  bottom:52px;
  width:260px;
  z-index:2000;
  background:rgba(0,0,0,0.95);
  border:2px solid var(--gold);
  border-radius:10px;
  padding:12px;
  box-shadow:0 12px 30px rgba(0,0,0,0.8);
}
.badge:hover .badge-popover,
.badge:focus .badge-popover{
  display:block;
}
.badge-popover-title{
  color:var(--gold);
  font-weight:900;
  margin-bottom:8px;
}
.badge-popover-img{
  width:100%;
  max-height:140px;
  object-fit:cover;
  border-radius:8px;
  border:1px solid rgba(255,215,0,0.3);
  margin-bottom:10px;
}
.badge-popover-meta{
  display:flex;
  justify-content:space-between;
  gap:10px;
  font-size:0.8rem;
  color:#ddd;
  margin-bottom:8px;
}
.badge-popover-desc{
  font-size:0.85rem;
  color:#bbb;
  line-height:1.35;
  border-top:1px solid rgba(255,255,255,0.08);
  padding-top:8px;
}
@media (max-width:768px){
  .badge-popover{
    width:230px;
    left:0;
    transform:none;
  }
}

/* =========================================================
   DASHBOARD HERO IMAGE FIX (keeps dashboard poster sane)
   ========================================================= */
.container .hero-section img,
.container .champion-portrait img,
.container .hero-section .champion-portrait img{
  width: 240px !important;
  max-width: 240px !important;
  height: 340px !important;
  max-height: 340px !important;
  display:block !important;
  margin: 0 auto 12px !important;
  object-fit: contain !important;
}
.container .champion-portrait,
.container .hero-section .champion-portrait{
  width: 240px !important;
  max-width: 240px !important;
  height: 340px !important;
  max-height: 340px !important;
  margin: 0 auto 12px !important;
  border: 3px solid var(--primary);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 0 24px rgba(0,0,0,0.7);
}
@media (max-width:768px){
  .container .hero-section img,
  .container .champion-portrait img,
  .container .hero-section .champion-portrait img{
    width: 190px !important;
    max-width: 190px !important;
    height: 270px !important;
    max-height: 270px !important;
  }
  .container .champion-portrait,
  .container .hero-section .champion-portrait{
    width: 190px !important;
    max-width: 190px !important;
    height: 270px !important;
    max-height: 270px !important;
  }
}