/* ===============================
   Theme Variables (DARK UI)
================================ */
:root{
  --bg:#0b0d12;
  --panel:#121621;
  --panel-2:#171c29;
  --panel-3:#0f1320;
  --line:#252c3f;
  --ink:#e8ecf6;
  --muted:#a9b0c3;

  --accent:#f0c400;
  --accent-dark:#5bbd7a;
  --focus:#6aa9ff;

  --radius:12px;
  --font: Arial, Helvetica, sans-serif;
}

/* ===============================
   Base Reset
================================ */
*{ box-sizing:border-box; }
html, body{ height:100%; }

body{
  margin:0;
  font:12px/1.35 var(--font);
  background: radial-gradient(1200px 600px at 50% 0%, #0f1320 0%, var(--bg) 55%, #07080c 100%);
  color:var(--ink);
}

a{ color:var(--ink); text-decoration:none; }
a:hover{ text-decoration:underline; }

.sr-only{
  position:absolute; width:1px; height:1px; padding:0; margin:-1px;
  overflow:hidden; clip:rect(0,0,0,0); border:0;
}

.divider{
  display:inline-block;
  width:1px;
  height:10px;
  background:rgba(255,255,255,0.18);
  margin:0 10px;
  vertical-align:middle;
}

.hidden{ display:none; }
.muted{ color:var(--muted); }

/* ===============================
   Buttons
================================ */
.btn{
  border:1px solid var(--line);
  background:linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
  padding:7px 12px;
  border-radius:12px;
  cursor:pointer;
  font:inherit;
  color:var(--ink);
}

.btn:hover{
  border-color:rgba(255,255,255,0.22);
  background:linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0.03));
}

.btn:focus{
  outline:2px solid rgba(106,169,255,0.45);
  outline-offset:2px;
}

.btn--primary{
  background:linear-gradient(180deg, rgba(91,189,122,0.95), rgba(72,160,102,0.95));
  border-color:rgba(91,189,122,0.75);
  color:#06110a;
  font-weight:bold;
}

.btn--secondary{
  background:linear-gradient(180deg, rgba(240,196,0,1), rgba(201,165,0,1));
  border-color:rgba(240,196,0,0.65);
  color:#141100;
  font-weight:bold;
}

.btn--ghost{
  background:transparent;
  border-color:transparent;
  color:var(--accent-dark);
  font-weight:bold;
}

.btn--ghost:hover{
  background:rgba(91,189,122,0.10);
  border-color:rgba(91,189,122,0.18);
}

/* ===============================
   Masthead
================================ */
.masthead{
  position:sticky;
  top:0;
  z-index:1000;
  background:rgba(18,22,33,0.85);
  backdrop-filter: blur(10px);
  border-bottom:1px solid rgba(240,196,0,0.35);
  box-shadow:0 10px 30px rgba(0,0,0,0.35);
}

.masthead__row{
  max-width:1300px;
  margin:0 auto;
  padding:8px 14px;
}

.masthead__row--top{
  display:flex;
  justify-content:center;
  padding-bottom:4px;
}

.masthead__utility .link.muted{ color:var(--muted); }
.masthead__utility .link.muted:hover{ color:var(--ink); }

.masthead__utility--notice{
  color:var(--muted);
  font-weight:600;
  text-align:center;
}

.masthead__utility--notice .link{
  color:var(--accent);
  font-weight:800;
  margin-left:8px;
}

.masthead__notice{
  text-align:center;
  font-weight:800;
  font-size:12px;
  color:#141100;
  background:linear-gradient(180deg, rgba(240,196,0,0.98), rgba(201,165,0,0.98));
  border-top:1px solid rgba(255,255,255,0.10);
  border-bottom:1px solid rgba(0,0,0,0.30);
  padding:7px 12px;
}

/* FIX: add a 4th column for stats */
.masthead__row--main{
  display:grid;
  grid-template-columns:360px auto 1fr auto; /* brand | stats | search | nav */
  gap:12px;
  align-items:center;
}

.brand{
  display:flex;
  align-items:baseline;
  gap:2px;
  font-weight:900;
  letter-spacing:0.2px;
  position:relative;
  left:-620px;
}

.brandwrap{
  display:flex;
  align-items:center;
  gap:22px;
  white-space:nowrap;
}

.link--discord{
  color:var(--accent);
  font-weight:800;
  white-space:nowrap;
}

.link--discord:hover{
  color:var(--ink);
}

.brand__mark{ color:var(--accent-dark); }
.brand__dot{ color:var(--accent); }
.brand__text{ color:var(--ink); font-weight:600; }

/* ===============================
   Search
================================ */
.search{
  position:relative;
  width:min(620px, 100%);
  justify-self:center;
}

.search__input{
  width:100%;
  padding:9px 40px 9px 10px;
  border:1px solid var(--line);
  border-radius:12px;
  font-size:13px;
  background:var(--panel-3);
  color:var(--ink);
}

.search__input::placeholder{ color:rgba(233,236,246,0.45); }

.search__btn{
  position:absolute;
  right:10px;
  top:50%;
  transform:translateY(-50%);
  background:none;
  border:0;
  cursor:pointer;
  color:rgba(233,236,246,0.75);
}

.search__btn:hover{ color:var(--ink); }

/* ===============================
   Masthead Nav
================================ */
.masthead__nav{ display:flex; gap:18px; }

.navlink{
  font-weight:700;
  color:var(--accent-dark);
}

.navlink:hover{ color:var(--ink); }

.navlink--login{
  margin-left:28px;
  color:var(--muted);
}

/* ===============================
   Masthead Stats (HEADER CARDS)
================================ */
.masthead__stats{
  display:flex;
  gap:12px;
  align-items:center;
  justify-content:flex-end;
}

.masthead__statcard{
  min-width:160px;
  padding:10px 12px;
  border-radius:14px;
  background: linear-gradient(180deg, rgba(22, 28, 40, 0.95), rgba(14, 18, 28, 0.95));
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 12px 28px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.05);
  backdrop-filter: blur(10px);
}

.masthead__statlabel{
  font-size:11px;
  color:rgba(233,236,246,0.65);
  margin-bottom:6px;
  font-weight:800;
  letter-spacing:0.2px;
}

.masthead__statvalue{
  font-weight:900;
  font-size:22px;
  letter-spacing:0.2px;
  line-height:1;
}

/* Responsive: hide header stats on smaller screens */
@media (max-width: 980px){
  .masthead__row--main{
    grid-template-columns:auto 1fr; /* brand | search (stats hidden) */
  }
  /* hide stats on smaller screens to reduce clutter */
  .masthead__stats{
    display:none;
  }
  .brandwrap{
    gap:12px;
  }
  .brand{
    left:0;
  }
}

/* ===============================
   Layout (3 columns)
   left | main | right
================================ */
.layout{
  width:100%;
  max-width:none;
  margin:18px 0 0;
  padding:0 18px;

  display:grid;
  grid-template-columns:260px minmax(0, 1fr) 260px;
  gap:18px;

  min-height:calc(100vh - 170px);
  align-items:start;
}

.layout.layout--2col{
  grid-template-columns:minmax(0, 1fr) 260px;
}

.layout.layout--full{
  grid-template-columns:minmax(0, 1fr);
  max-width:980px;
  margin:18px auto 0;
  padding:0 18px;
}

/* ===============================
   Sidebar (left)
================================ */
.sidebar{
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:var(--radius);
  box-shadow:0 18px 50px rgba(0,0,0,0.35);
  overflow:hidden;

  position:sticky;
  top:110px;
  height:fit-content;
}

.sidebar:empty{
  background:transparent;
  border:0;
  box-shadow:none;
}

.sidebar__title{
  padding:10px 12px;
  font-weight:900;
  color:rgba(233,236,246,0.85);
  border-bottom:1px solid rgba(91,189,122,0.25);
  background:linear-gradient(180deg, rgba(255,255,255,0.04), transparent);
}

.sidebar__nav{ display:flex; flex-direction:column; padding:6px; }

.sidebar__link{
  padding:10px 10px;
  border-radius:10px;
  border:1px solid transparent;
  color:rgba(233,236,246,0.85);
}

.sidebar__link:hover{
  background:rgba(255,255,255,0.05);
  border-color:rgba(255,255,255,0.08);
  text-decoration:none;
}

.sidebar__link.is-active{
  background:rgba(240,196,0,0.14);
  border-color:rgba(240,196,0,0.25);
  color:var(--ink);
  font-weight:900;
}

/* ===============================
   Content (center)
================================ */
.content{
  width:100%;
  max-width:none;
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:var(--radius);
  padding:14px;
  box-shadow:0 18px 50px rgba(0,0,0,0.35);
  overflow:hidden;
}

.content__bar{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  margin-bottom:10px;
}

.content__left{ display:flex; flex-direction:column; }
.content__actions{ display:flex; align-items:center; gap:10px; }
.results__filters{ display:flex; gap:8px; align-items:center; }

/* Utility to show/hide controls */
.hidden{ display:none !important; }

.content__title{
  font-weight:900;
  font-size:13px;
  color:rgba(233,236,246,0.9);
}

/* ===============================
   Tiles
================================ */
.tiles{
  display:grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap:12px;
  margin:10px 0 16px;
}

.tile{
  height:82px;
  display:flex;
  align-items:center;
  gap:12px;
  padding:12px;
  border-radius:var(--radius);
  background:linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
  border:1px solid var(--line);
  box-shadow:0 1px 0 rgba(255,255,255,0.03) inset;
  transition:transform .12s ease, border-color .12s ease, background .12s ease;
}

.tile__icon{
  width:44px;
  height:44px;
  display:grid;
  place-items:center;
  border-radius:14px;
  background:rgba(0,0,0,0.25);
  border:1px solid rgba(255,255,255,0.08);
  font-size:20px;
}

.tile__label{
  font-weight:900;
  color:rgba(233,236,246,0.9);
}

.tile:hover{
  transform:translateY(-1px);
  border-color:rgba(240,196,0,0.25);
  background:linear-gradient(180deg, rgba(240,196,0,0.10), rgba(255,255,255,0.03));
  text-decoration:none;
}

/* ===============================
   Results / Cards
================================ */
.results__header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  border-top:1px solid rgba(255,255,255,0.08);
  padding-top:12px;
  color:var(--muted);
}

/* === Home page item picker alignment (CENTERED OPTION) === */
#homePickerBar{
  max-width: 980px;
  margin-left: auto;
  margin-right: auto;
  justify-content: space-between;
  gap: 14px;
}

#homePickerBar .results__filters{
  display: flex;
  gap: 10px;
}

#homePickerBar select{
  min-width: 180px;
}
/* === end centered option === */

.results__list{
  display:flex;
  flex-direction:column;
  gap:10px;
  margin-top:12px;
}

#homePagination{
  justify-content:center;
  gap:12px;
  margin-top:14px;
  padding-top:4px;
}

#homePagination .btn{
  min-width:64px;
}

#homePageInfo{
  min-width:92px;
  text-align:center;
}

.card{
  display:grid;
  grid-template-columns:1fr 120px;
  gap:12px;
  align-items:center;
  padding:12px;
  border-radius:var(--radius);
  background:var(--panel-2);
  border:1px solid rgba(255,255,255,0.08);
}

.card__title{
  font-weight:700;
  color:rgba(233,236,246,0.95);
  font-size:12px;
  line-height:1.35;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.card__meta{
  color:var(--muted);
  margin-top:6px;
  font-size:12px;
  line-height:1.35;
}

.card__note{
  color:rgba(233,236,246,0.78);
  margin-top:6px;
  font-size:12px;
  line-height:1.35;
  overflow-wrap:anywhere;
}

.card__line-label{
  color:rgba(233,236,246,0.62);
  font-weight:700;
  font-size:0.9em;
  letter-spacing:0.1px;
}

.card__line-qty{
  color:rgba(233,236,246,0.86);
  font-weight:700;
}

.card__line-item{
  color:rgba(233,236,246,0.98);
  font-weight:900;
}

.card__line-category{
  color:rgba(233,236,246,0.58);
  font-weight:600;
  font-size:0.88em;
}

.card__tags{
  margin-top:8px;
  display:flex;
  gap:6px;
  flex-wrap:wrap;
}

.tag{
  font-size:11px;
  padding:3px 8px;
  border-radius:999px;
  background:rgba(0,0,0,0.22);
  border:1px solid rgba(255,255,255,0.08);
  color:rgba(233,236,246,0.78);
}

.tag--offer{
  background:rgba(240,196,0,0.18);
  border-color:rgba(240,196,0,0.35);
  color:rgba(255,225,112,0.98);
}

.card__cta{
  display:flex;
  justify-content:flex-end;
}

.profile-card{
  display:block;
  align-items:stretch;
  grid-template-columns:1fr;
  padding:16px;
}

.profile-card .card__header{
  margin-bottom:10px;
}

.profile-card .card__body{
  min-width:0;
}

body[data-page="profile"] #slot-main > .card{
  display:block;
  grid-template-columns:1fr;
  align-items:stretch;
}

.offer-locker{
  display:grid;
  gap:8px;
  margin-top:10px;
  padding:10px;
  border:1px solid rgba(255,255,255,0.1);
  border-radius:10px;
  background:rgba(0,0,0,0.14);
}

.offer-locker label{
  display:flex;
  flex-direction:column;
  gap:6px;
}

.offer-locker .select,
.offer-locker .offer-item-qty{
  max-width:300px;
}

/* Select (sort dropdown) */
.select{
  background:var(--panel-3);
  border:1px solid var(--line);
  color:var(--ink);
  border-radius:10px;
  padding:6px 10px;
}

/* ===============================
   Right Ad Rail
================================ */
.adrail{
  position:sticky;
  top:110px;
  height:fit-content;
}

.adrail:empty{
  background:transparent;
  border:0;
  box-shadow:none;
}

.adrail__card{
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:var(--radius);
  box-shadow:0 18px 50px rgba(0,0,0,0.35);
  overflow:hidden;
}

.adrail__title{
  padding:10px 12px;
  font-weight:900;
  color:rgba(233,236,246,0.85);
  border-bottom:1px solid rgba(240,196,0,0.20);
  background:linear-gradient(180deg, rgba(255,255,255,0.04), transparent);
}

.adrail__body{
  padding:12px;
}

.adrail__badge{
  display:inline-block;
  font-size:11px;
  padding:3px 8px;
  border-radius:999px;
  background:rgba(240,196,0,0.12);
  border:1px solid rgba(240,196,0,0.22);
  color:rgba(233,236,246,0.85);
  margin-bottom:10px;
}

.adrail__headline{
  font-weight:900;
  font-size:13px;
  margin-bottom:6px;
}

.adrail__text{
  color:var(--muted);
  line-height:1.45;
  margin-bottom:12px;
}

.adrail__cta{
  width:100%;
  text-align:center;
}

/* ===============================
   Browse Overlay / Panel
================================ */
.overlay{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,0.65);
  z-index:2000;
}

.browse{
  position:fixed;
  top:0;
  left:0;
  width:380px;
  height:100vh;
  background:var(--panel);
  border-right:1px solid var(--line);
  z-index:2100;
  padding:14px;
}

.browse__head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  border-bottom:1px solid rgba(255,255,255,0.08);
  padding-bottom:10px;
}

.browse__title{
  font-weight:900;
  color:rgba(233,236,246,0.9);
}

.browse__nav{
  display:flex;
  flex-direction:column;
  margin-top:10px;
}

.browse__link{
  padding:10px 10px;
  border:1px solid rgba(255,255,255,0.08);
  margin-top:8px;
  border-radius:12px;
  background:rgba(255,255,255,0.03);
  color:rgba(233,236,246,0.85);
}

.browse__link:hover{
  background:rgba(91,189,122,0.12);
  border-color:rgba(91,189,122,0.22);
  text-decoration:none;
}

/* ===============================
   Footer
================================ */
.footer{
  width:100%;
  margin:14px 0 20px;
  padding:0 18px;
}

.footer__inner{
  max-width:1300px;
  margin:0 auto;
  padding:12px 14px;
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:var(--radius);
  display:flex;
  justify-content:space-between;
  box-shadow:0 18px 50px rgba(0,0,0,0.35);
}

.footer__left, .footer__right{
  display:flex;
  align-items:center;
  gap:10px;
}

/* ===============================
   Index Stats Chips (single source of truth)
================================ */
.stats-row{
  display:flex;
  gap:12px;
  margin-top:6px;
  padding-top:12px;
  border-top:1px solid rgba(255,255,255,0.08);
}

.stat-chip{
  min-width:160px;
  padding:10px 12px;
  border-radius:12px;
  background:var(--panel-2);
  border:1px solid rgba(255,255,255,0.08);
}

.stat-chip__label{
  font-size:11px;
  color:var(--muted);
  margin-bottom:6px;
  font-weight:700;
}

.stat-chip__value{
  font-weight:900;
  font-size:18px;
  letter-spacing:0.2px;
}

.tile.is-active{
  border-color: rgba(240,196,0,0.35);
  background: linear-gradient(180deg, rgba(240,196,0,0.12), rgba(255,255,255,0.03));
}

/* ===============================
   Performance Guardrails
================================ */
@media (max-width: 1200px) {
  .masthead {
    backdrop-filter: none;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.32);
  }
  .masthead__statcard {
    backdrop-filter: none;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.32);
  }
  .sidebar,
  .content,
  .adrail__card,
  .footer__inner {
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.3);
  }
}

@media (prefers-reduced-motion: reduce) {
  .tile {
    transition: none;
  }
}

/* ===============================
   Cookie Consent
================================ */
.cookie-banner {
  position: fixed;
  left: 18px;
  right: 18px;
  bottom: 18px;
  z-index: 4000;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(180deg, rgba(17, 23, 35, 0.98), rgba(12, 17, 28, 0.98));
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.45);
}

.cookie-banner__text {
  color: rgba(233, 236, 246, 0.92);
  line-height: 1.45;
}

.cookie-banner__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

@media (max-width: 760px) {
  .cookie-banner {
    left: 12px;
    right: 12px;
    bottom: 12px;
    flex-direction: column;
    align-items: flex-start;
  }
.cookie-banner__actions {
    width: 100%;
  }
}

/* ===============================
   Back To Top Button
================================ */
.to-top-btn {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 3200;
  min-width: 64px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4);
}

@media (max-width: 760px) {
.to-top-btn {
    right: 12px;
    bottom: 12px;
  }
}

/* ===============================
   Toasts
================================ */
.toast-host {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 3600;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  min-width: 220px;
  max-width: 360px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(11, 16, 26, 0.96);
  color: var(--ink);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
  transform: translateY(8px);
  opacity: 0;
  transition: transform 140ms ease, opacity 140ms ease;
}

.toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

.toast--success {
  border-color: rgba(91, 189, 122, 0.5);
}

.toast--error {
  border-color: rgba(224, 82, 82, 0.6);
}

.toast--warning {
  border-color: rgba(240, 196, 0, 0.65);
}

/* ===============================
   Confirm Dialog
================================ */
.confirm-overlay{
  position:fixed;
  inset:0;
  z-index:3200;
  display:grid;
  place-items:center;
  padding:18px;
  background:rgba(0,0,0,0.58);
}

.confirm-dialog{
  width:min(420px, 100%);
  background:linear-gradient(180deg, rgba(23,28,41,0.98), rgba(15,19,32,0.98));
  border:1px solid rgba(255,255,255,0.12);
  border-radius:14px;
  box-shadow:0 20px 45px rgba(0,0,0,0.5);
  padding:14px;
}

.confirm-dialog__title{
  font-weight:900;
  color:rgba(233,236,246,0.95);
  font-size:14px;
}

.confirm-dialog__message{
  margin-top:8px;
  color:rgba(233,236,246,0.85);
}

.confirm-dialog__actions{
  display:flex;
  justify-content:flex-end;
  gap:8px;
  margin-top:14px;
}

/* ===============================
   Listings Form Layout
================================ */
.listing-form {
  display: grid;
  grid-template-columns: 130px 300px 300px 170px 100px;
  gap: 8px;
  align-items: end;
  width: fit-content;
  max-width: 100%;
}

.listing-form > label,
.listing-form > #wantGold > label,
.listing-form > #wantItem > label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.listing-form > hr {
  grid-column: 1 / -1;
  width: 100%;
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  margin: 4px 0 0;
}

#wantTypeWrap {
  grid-column: 1 / 2;
}

#wantGold {
  grid-column: 2 / -1;
  max-width: 220px;
}

#wantItem {
  grid-column: 2 / -1;
  display: grid;
  grid-template-columns: 300px 300px 170px 100px;
  gap: 8px;
  align-items: end;
}

.listing-form > .btn[type="submit"] {
  width: fit-content;
}

.listing-form > .checkbox-inline {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}

.listing-form .select,
.listing-form input[type="number"] {
  padding: 5px 8px;
}

.listing-form textarea {
  resize: vertical;
  min-height: 56px;
  max-height: 140px;
  padding: 7px 8px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-3);
  color: var(--ink);
  font: inherit;
}

.listing-form input[type="number"] {
  max-width: 100px;
}

#wantItem #wantItemQty {
  max-width: 100px;
}

.listing-form > .listing-note-wrap {
  grid-column: 1 / -2;
}

.listing-note-count {
  align-self: flex-end;
}

@media (max-width: 900px) {
  .listing-form {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
    width: 100%;
    max-width: none;
  }

  #wantItem {
    grid-column: 1 / -1;
    grid-template-columns: 1fr;
  }

  #wantGold {
    grid-column: 1 / -1;
  }

  .listing-form input[type="number"],
  #wantItem #wantItemQty {
    max-width: none;
  }

  .listing-form > .listing-note-wrap {
    grid-column: 1 / -1;
  }
}
