/* ============================================================
   Kugane Fried Chocobo — dark theme
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

:root {
  --bg:      #1a1a2e;
  --surface: #16213e;
  --accent:  #e94560;
  --text:    #e0e0e0;
  --muted:   #888;
  --radius:  8px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, sans-serif;
  min-height: 100vh;
}

/* ---- Header ---- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .75rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid #2a2a4a;
  flex-wrap: wrap;
  gap: .5rem;
}
.site-title {
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.1rem;
}
.user-nav {
  display: flex;
  align-items: center;
  gap: .75rem;
}
.nav-identity {
  display: contents;
}
.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.4rem;
  cursor: pointer;
  padding: .2rem .4rem;
  line-height: 1;
  margin-left: auto;
}
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
}
.username { font-size: .9rem; }

@media (max-width: 680px) {
  .nav-toggle { display: block; }
  .user-nav {
    display: none;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    padding: .5rem 0 .25rem;
    gap: .4rem;
    border-top: 1px solid #2a2a4a;
  }
  .user-nav.open { display: flex; }
  .nav-identity {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: .25rem;
  }
  .user-nav .btn { width: 100%; text-align: left; }
}

/* ---- Buttons ---- */
.btn {
  display: inline-block;
  padding: .45rem 1rem;
  border-radius: var(--radius);
  text-decoration: none;
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  background: #2a2a4a;
  color: var(--text);
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover {
  background: #353560;
  border-color: #4a4a7a;
}
.btn-primary { background: var(--accent); color: #fff; border-color: transparent; }
.btn-primary:hover { background: #c73652; border-color: transparent; }
.btn-discord { background: #5865f2; color: #fff; border-color: transparent; }
.btn-discord:hover { background: #4752c4; border-color: transparent; }
.btn-sm      { padding: .3rem .7rem; font-size: .8rem; }
.btn-muted   { background: transparent; color: var(--muted); border-color: #3a3a5a; }
.btn-muted:hover { background: #2a2a4a; color: var(--text); border-color: #4a4a7a; }
.btn-pride   { background: #9b59b6; color: #fff; border-color: transparent; }
.btn-pride:hover { background: #7d3d99; border-color: transparent; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---- Hero / landing ---- */
.hero {
  text-align: center;
  padding: 6rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}
.hero h1 { font-size: 2.5rem; }
.hero p   { color: var(--muted); }

/* ---- Collection header ---- */
.collection-header {
  padding: 1.5rem 1.5rem .5rem;
}
.collection-header h2 { font-size: 1.6rem; }
.stats { color: var(--muted); font-size: .875rem; margin-top: .25rem; }

/* ---- Collection controls ---- */
.collection-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .75rem 1.25rem;
  padding: .5rem 1.5rem 1rem;
}
.control-group {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .825rem;
  color: var(--muted);
}
.control-select {
  font-size: .825rem;
  padding: .25rem .5rem;
  border-radius: 4px;
  background: #2a2a4a;
  color: var(--text);
  border: 1px solid #444;
}
.page-count-label {
  font-size: .775rem;
  color: var(--muted);
  margin-left: auto;
}

/* ---- Pagination ---- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1.5rem;
}
.page-info {
  font-size: .875rem;
  color: var(--muted);
  min-width: 8rem;
  text-align: center;
}

/* ---- Card grid ---- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  padding: 1rem 1.5rem 3rem;
}

.card-tile {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  border: 2px solid var(--border-color, #555);
  transition: transform .15s;
}
.card-tile:hover { transform: translateY(-3px); }

/* ---- Card image area ---- */
.card-img-wrap { position: relative; }
.card-img      { width: 100%; display: block; }

.badge {
  position: absolute;
  font-size: .65rem;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 4px;
  background: rgba(0,0,0,.75);
  color: #fff;
}
.badge-count { bottom: 6px; right: 6px; }
.badge-shiny { top: 6px; left: 6px; background: #f0a500; color: #000; }
.badge-pride { top: 6px; right: 6px; background: rgba(0,0,0,.6); }

/* ---- Card info ---- */
.card-info { padding: .6rem .75rem .8rem; }
.card-title {
  font-size: .78rem;
  font-weight: 600;
  margin-bottom: .25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-meta { font-size: .7rem; color: var(--muted); }

.tier { font-weight: 700; }
.tier-common    { color: #ffffff; }
.tier-uncommon  { color: #1eff00; }
.tier-rare      { color: #0070dd; }
.tier-epic      { color: #a335ee; }
.tier-legendary { color: #ff8000; }

/* ---- Pride controls ---- */
.pride-controls {
  margin-top: .6rem;
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  align-items: center;
}
.flag-select {
  flex: 1;
  font-size: .75rem;
  padding: .2rem .4rem;
  border-radius: 4px;
  background: #2a2a4a;
  color: var(--text);
  border: 1px solid #444;
  min-width: 0;
}
.swap-status        { font-size: .7rem; width: 100%; min-height: 1em; }
.swap-status.success { color: #1eff00; }
.swap-status.error   { color: var(--accent); }

/* ---- Modal ---- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}
.modal-backdrop[hidden] { display: none; }

.modal-box {
  background: var(--surface);
  border-radius: var(--radius);
  max-width: 420px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 8px 32px rgba(0,0,0,.6);
}

.modal-close {
  position: absolute;
  top: .6rem;
  right: .75rem;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  z-index: 1;
}
.modal-close:hover { color: var(--text); }

.modal-body {
  display: flex;
  flex-direction: column;
}

.modal-img-wrap { width: 100%; }
.modal-img {
  width: 100%;
  display: block;
  border-radius: var(--radius) var(--radius) 0 0;
}

.modal-details {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  padding: 1rem 1.1rem 1.25rem;
}

.modal-card-title {
  font-size: 1.1rem;
  font-weight: 700;
  word-break: break-word;
}
.modal-meta { font-size: .875rem; color: var(--muted); }
.modal-field { font-size: .825rem; color: var(--muted); }
.modal-field[hidden] { display: none; }
.modal-shiny-label { font-size: .825rem; color: #f0a500; }

/* ---- Dex nav ---- */
.dex-nav {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .5rem 1.5rem .75rem;
  border-bottom: 1px solid #2a2a4a;
  margin-bottom: .25rem;
}

.dex-class-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  flex: 1;
}

.dex-tab {
  font-size: .78rem;
  font-weight: 600;
  padding: .25rem .65rem;
  border-radius: 99px;
  border: 1px solid #3a3a5a;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.dex-tab:hover {
  background: #2a2a4a;
  color: var(--text);
}
.dex-tab-active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ---- Dex ---- */
.dex-progress-bar {
  height: 6px;
  background: #2a2a4a;
  border-radius: 3px;
  margin-top: .5rem;
  max-width: 320px;
}
.dex-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width .3s;
}


.dex-section {
  padding: .75rem 1.5rem 1.5rem;
  border-top: 1px solid #2a2a4a;
}
.dex-section-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: .75rem;
  flex-wrap: wrap;
}
.dex-class-name {
  font-size: 1.1rem;
  font-weight: 700;
}
.dex-class-count {
  font-size: .825rem;
  color: var(--muted);
}
.dex-mini-bar {
  flex: 1;
  max-width: 160px;
  height: 4px;
  background: #2a2a4a;
  border-radius: 2px;
}
.dex-mini-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
}

.dex-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: .6rem;
}

.dex-tile {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid #2a2a4a;
  transition: transform .15s;
}
.dex-tile:hover { transform: translateY(-2px); }
.dex-img-missing {
  filter: grayscale(100%) brightness(0.4);
}
.dex-img-wrap { position: relative; }
.dex-img {
  width: 100%;
  display: block;
}
.dex-badge-count { bottom: 4px; right: 4px; font-size: .6rem; }
.dex-badge-shiny { top: 4px; left: 4px; font-size: .6rem; }
.dex-tile-footer {
  padding: 4px 6px 6px;
}
.dex-entry-name {
  font-size: .7rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}
.dex-color {
  font-size: .65rem;
  font-weight: 700;
}

/* ---- Members ---- */
.members-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-auto-flow: row;
  gap: .75rem;
  padding: 1rem 1.5rem 3rem;
}
@media (min-width: 900px) {
  .members-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1200px) {
  .members-grid { grid-template-columns: repeat(4, 1fr); }
}

.member-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 1rem;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid #2a2a4a;
  padding: .9rem 1rem;
  text-decoration: none;
  color: var(--text);
  transition: transform .15s, border-color .15s, box-shadow .15s;
  position: relative;
  overflow: hidden;
}
.member-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent);
  opacity: 0;
  transition: opacity .15s;
}
.member-card:hover {
  transform: translateX(3px);
  border-color: #3a3a5a;
  box-shadow: 0 4px 16px rgba(0,0,0,.35);
}
.member-card:hover::before {
  opacity: 1;
}

.member-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid #2a2a4a;
  transition: border-color .15s;
}
.member-card:hover .member-avatar {
  border-color: var(--accent);
}

.member-info {
  min-width: 0;
  flex: 1;
}
.member-name {
  font-weight: 700;
  font-size: .95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: .3rem;
}
.member-stats {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  margin-bottom: .3rem;
}
.member-stat-pill {
  font-size: .7rem;
  font-weight: 600;
  background: #2a2a4a;
  border-radius: 99px;
  padding: 2px 8px;
  color: var(--text);
}
.member-last-pull {
  font-size: .7rem;
  color: var(--muted);
}

.member-arrow {
  font-size: 1rem;
  color: var(--muted);
  flex-shrink: 0;
  transition: color .15s, transform .15s;
}
.member-card:hover .member-arrow {
  color: var(--accent);
  transform: translateX(3px);
}

.member-unknown {
  position: absolute;
  top: .4rem;
  right: .5rem;
  font-size: .65rem;
  color: var(--muted);
  background: #2a2a4a;
  border-radius: 50%;
  width: 15px;
  height: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---- Trade badge (nav) ---- */
.trade-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  border-radius: 99px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  margin-left: 3px;
  vertical-align: middle;
}
.trade-badge-inline {
  background: var(--accent);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  border-radius: 99px;
  padding: 1px 6px;
  margin-left: 4px;
}

/* ---- Propose Trade button ---- */
.btn-trade {
  background: #2a6a4a;
  color: #fff;
  border-color: transparent;
}
.btn-trade:hover { background: #1e5039; }

/* ---- Trade builder ---- */
.trade-builder {
  padding: 0 1.5rem 3rem;
}

.trade-partner-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  vertical-align: middle;
  margin: 0 3px;
}
.trade-arrow-label { font-size: 1rem; }

.trade-tray {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid #2a2a4a;
  border-radius: var(--radius);
  padding: .875rem 1rem;
  margin-bottom: .75rem;
}
.trade-tray-side {
  flex: 1;
  min-width: 0;
}
.tray-label {
  font-size: .75rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: .4rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.tray-cards {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  min-height: 48px;
}
.tray-thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 4px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color .15s;
}
.tray-thumb:hover { border-color: var(--accent); }
.tray-thumb-sm { width: 36px; height: 36px; }
.tray-empty { font-size: .75rem; color: var(--muted); margin-top: .25rem; }

.trade-tray-divider {
  font-size: 1.4rem;
  color: var(--muted);
  padding-top: 1.5rem;
  flex-shrink: 0;
}

.trade-note-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.trade-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}
@media (max-width: 700px) {
  .trade-columns { grid-template-columns: 1fr; }
}
.trade-col-title {
  font-size: .95rem;
  font-weight: 700;
  margin-bottom: .5rem;
}
.trade-search {
  width: 100%;
  margin-bottom: .5rem;
}
.trade-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: .4rem;
  max-height: 560px;
  overflow-y: auto;
  padding-right: .25rem;
}
.trade-card-tile {
  background: var(--surface);
  border: 2px solid var(--border-color, #444);
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  transition: transform .1s, box-shadow .1s;
}
.trade-card-tile:hover { transform: translateY(-2px); }
.trade-card-selected {
  box-shadow: 0 0 0 3px var(--accent);
  transform: translateY(-2px);
}
.trade-card-img { width: 100%; display: block; }
.trade-card-label {
  font-size: .6rem;
  font-weight: 600;
  padding: 2px 4px 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- Trades hub ---- */
.trades-tabs {
  display: flex;
  gap: .5rem;
  padding: .5rem 1.5rem .75rem;
  border-bottom: 1px solid #2a2a4a;
}
.trades-tab {
  font-size: .85rem;
  font-weight: 600;
  padding: .35rem .85rem;
  border-radius: 99px;
  border: 1px solid #3a3a5a;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.trades-tab:hover { background: #2a2a4a; color: var(--text); }
.trades-tab-active { background: var(--accent); color: #fff; border-color: var(--accent); }

.trades-panel { padding: 1rem 1.5rem 3rem; }

.trade-card {
  background: var(--surface);
  border: 1px solid #2a2a4a;
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: .75rem;
}
.trade-card-history { opacity: .8; }
.trade-card-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
  margin-bottom: .5rem;
}
.trade-from { font-size: .9rem; }
.trade-date { font-size: .75rem; margin-left: auto; }
.trade-note {
  font-size: .8rem;
  color: var(--muted);
  font-style: italic;
  margin-bottom: .5rem;
}
.trade-card-rows { display: flex; flex-direction: column; gap: .5rem; margin-bottom: .75rem; }
.trade-card-row { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.trade-row-label {
  font-size: .72rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  min-width: 70px;
}
.trade-thumbs { display: flex; flex-wrap: wrap; gap: .3rem; }
.trade-actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }

.trade-status {
  font-size: .72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
}
.trade-status-accepted  { background: #1a4a2a; color: #1eff00; }
.trade-status-declined  { background: #4a1a1a; color: var(--accent); }
.trade-status-cancelled { background: #2a2a2a; color: var(--muted); }
.trade-status-countered { background: #2a2a4a; color: #aaaaff; }

/* ---- Settings ---- */
.settings-box {
  max-width: 480px;
  margin: 1rem 1.5rem;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid #2a2a4a;
  padding: 1.25rem 1.5rem;
}
.settings-section-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: .5rem;
}
.settings-hint {
  font-size: .825rem;
  color: var(--muted);
  margin-bottom: 1rem;
}
.settings-form {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem;
}
.settings-input {
  flex: 1;
  min-width: 0;
  font-size: .875rem;
  padding: .4rem .65rem;
  border-radius: 4px;
  background: #2a2a4a;
  color: var(--text);
  border: 1px solid #444;
}

/* ---- Bazaar ---- */
.bazaar-grid {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1rem 1.5rem;
}

.bazaar-shop {
  background: var(--surface);
  border: 1px solid #2a2a4a;
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
}

.bazaar-shop-header {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: .75rem;
}

.bazaar-shop-name {
  font-weight: 600;
  font-size: .95rem;
}

.bazaar-slot-count {
  font-size: .75rem;
  margin-left: auto;
}

.bazaar-listings {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
}

.bazaar-listing {
  background: var(--bg);
  border: 2px solid var(--border-color, #444);
  border-radius: var(--radius);
  padding: .5rem;
  width: 110px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .3rem;
}

.bazaar-listing-img {
  width: 90px;
  height: 90px;
  object-fit: cover;
  border-radius: 4px;
}

.bazaar-listing-name {
  font-size: .68rem;
  text-align: center;
  line-height: 1.2;
  font-weight: 600;
}

.bazaar-listing-price {
  font-size: .75rem;
  color: #f0a500;
  font-weight: 700;
}

.bazaar-listing .bazaar-listing-price {
  margin-top: auto;
}

/* Bazaar modal section */
.bazaar-modal-section {
  margin-top: .75rem;
  padding-top: .75rem;
  border-top: 1px solid #2a2a4a;
}

.bazaar-price-row {
  display: flex;
  gap: .5rem;
  align-items: center;
  flex-wrap: wrap;
}

.bazaar-price-input {
  width: 120px;
  padding: .35rem .5rem;
  font-size: .82rem;
}

.bazaar-listed-label {
  font-size: .8rem;
  margin-bottom: .4rem;
}

.badge-listed { bottom: 6px; left: 6px; background: #1a3a1a; color: #1eff00; }

/* ---- Empty / error ---- */
.empty-state {
  padding: 3rem;
  text-align: center;
  color: var(--muted);
}
