/* ============================================================
   marketplace.css — Estilos del Marketplace
   Guardar en: /css/marketplace.css
   Importar en trades.html: <link rel="stylesheet" href="./css/marketplace.css"/>
   ============================================================ */

/* ── Board (contenedor principal) ──────────────────────── */
.mp-board {
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.mp-board-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .9rem 1.1rem;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
}

.mp-board-title {
  font-family: var(--font-d);
  font-size: .88rem;
  color: var(--gold);
  letter-spacing: .05em;
}

.mp-board-sub {
  font-size: .68rem;
  color: var(--muted);
  margin-top: 2px;
}

.mp-post-toggle {
  font-size: .75rem;
  padding: .35rem .9rem;
  border-radius: 20px;
  border: 1px solid rgba(245,200,66,.4);
  background: rgba(245,200,66,.08);
  color: var(--gold);
  cursor: pointer;
  font-family: var(--font-u);
  font-weight: 700;
  letter-spacing: .04em;
  transition: background var(--transition);
  white-space: nowrap;
}
.mp-post-toggle:hover { background: rgba(245,200,66,.16); }

/* ── Formulario de publicación ──────────────────────────── */
.mp-post-form {
  display: flex;
  flex-direction: column;
  gap: .7rem;
  padding: .9rem 1.1rem;
  border-bottom: 1px solid var(--border);
  background: rgba(245,200,66,.03);
}

.mp-toggle-row {
  display: flex;
  gap: .4rem;
}

.mp-topt {
  flex: 1;
  text-align: center;
  padding: .4rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: .78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  opacity: .5;
  color: var(--muted);
}
.mp-topt.selected {
  opacity: 1;
  border-color: rgba(245,200,66,.5);
  background: rgba(245,200,66,.1);
  color: var(--gold);
}

/* ── Inputs ─────────────────────────────────────────────── */
.mp-input {
  width: 100%;
  padding: .5rem .75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.04);
  color: var(--text);
  font-family: var(--font-u);
  font-size: .85rem;
  outline: none;
  transition: border-color var(--transition);
  box-sizing: border-box;
}
.mp-input:focus { border-color: rgba(26,79,255,.5); }
.mp-input::placeholder { color: var(--muted); }
.mp-qty { width: 70px; }

.mp-field label {
  display: block;
  font-size: .68rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: .3rem;
  font-weight: 700;
}
.mp-field-row {
  display: flex;
  align-items: center;
  gap: .6rem;
}

/* ── Autocompletado ─────────────────────────────────────── */
.mp-autocomplete {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  z-index: 500;
  box-shadow: var(--shadow-md);
  max-height: 220px;
  overflow-y: auto;
}
.mp-ac-item {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .5rem .85rem;
  cursor: pointer;
  transition: background var(--transition);
  border-bottom: 1px solid rgba(255,255,255,.04);
}
.mp-ac-item:last-child { border-bottom: none; }
.mp-ac-item:hover { background: rgba(255,255,255,.06); }

.mp-ac-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.mp-ac-name {
  flex: 1;
  font-size: .82rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mp-ac-id {
  font-size: .7rem;
  color: var(--muted);
  font-family: 'Courier New', monospace;
  flex-shrink: 0;
}
.mp-ac-rarity {
  font-size: .68rem;
  font-weight: 800;
  flex-shrink: 0;
  letter-spacing: .05em;
}

/* ── Carta seleccionada ─────────────────────────────────── */
.mp-selected-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin-top: .35rem;
  padding: .4rem .75rem;
  background: rgba(245,200,66,.07);
  border: 1px solid rgba(245,200,66,.25);
  border-radius: 8px;
  font-size: .8rem;
  font-weight: 600;
  color: var(--gold);
}
.mp-sel-clear {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: .8rem;
  padding: 0 2px;
  flex-shrink: 0;
  transition: color var(--transition);
}
.mp-sel-clear:hover { color: var(--red); }

/* ── Submit ─────────────────────────────────────────────── */
.mp-submit {
  padding: .6rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(245,200,66,.4);
  background: rgba(245,200,66,.1);
  color: var(--gold);
  font-family: var(--font-u);
  font-size: .82rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: .04em;
  transition: all var(--transition);
  width: 100%;
}
.mp-submit:hover:not(:disabled) { background: rgba(245,200,66,.2); }
.mp-submit:disabled { opacity: .5; cursor: not-allowed; }

/* ── Feedback ───────────────────────────────────────────── */
.mp-feedback {
  font-size: .76rem;
  min-height: 1.1rem;
  text-align: center;
}
.mp-fb-ok  { color: var(--r-color); }
.mp-fb-err { color: var(--red); }

/* ── Lista de ofertas ───────────────────────────────────── */
#mp-offers-list {
  display: flex;
  flex-direction: column;
}

.mp-offer-row {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .6rem 1.1rem;
  border-bottom: 1px solid rgba(255,255,255,.04);
  transition: background var(--transition);
}
.mp-offer-row:last-child { border-bottom: none; }
.mp-offer-row:hover { background: rgba(255,255,255,.025); }

.mp-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: rgba(26,79,255,.18);
  color: #60a5fa;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .7rem;
  font-weight: 800;
  flex-shrink: 0;
  letter-spacing: .02em;
}

.mp-offer-body { flex: 1; min-width: 0; }
.mp-offer-user {
  font-size: .67rem;
  color: var(--muted);
  margin-bottom: 1px;
}
.mp-offer-card {
  font-size: .84rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: .45rem;
}
.mp-offer-id {
  font-size: .66rem;
  color: var(--muted);
  font-family: 'Courier New', monospace;
  font-weight: 400;
  flex-shrink: 0;
}

.mp-badge {
  font-size: .67rem;
  padding: .18rem .55rem;
  border-radius: 8px;
  font-weight: 800;
  flex-shrink: 0;
  letter-spacing: .04em;
}
.mp-badge-seek  { background: rgba(96,165,250,.15); color: #60a5fa; }
.mp-badge-offer { background: rgba(52,211,153,.15); color: #34d399; }

.mp-btn {
  font-size: .72rem;
  padding: .3rem .7rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--transition);
  font-family: var(--font-u);
}
.mp-btn:hover { background: rgba(255,255,255,.07); }
.mp-btn-del { opacity: .35; }
.mp-btn-del:hover { opacity: 1; border-color: rgba(248,113,113,.5); color: #f87171; }
.mp-btn-resp { border-color: rgba(245,200,66,.3); color: var(--gold); }
.mp-btn-resp:hover { background: rgba(245,200,66,.08); border-color: rgba(245,200,66,.55); }

.mp-empty {
  padding: 1.5rem;
  text-align: center;
  font-size: .8rem;
  color: var(--muted);
}

/* ── Overlay / Panel de respuesta ───────────────────────── */
.mp-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.75);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(8px);
  animation: fade-in .2s ease;
}

.mp-panel {
  width: 100%;
  max-width: 440px;
  background: var(--bg-2);
  border: 1px solid rgba(245,200,66,.25);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  animation: panel-in .3s cubic-bezier(0.34,1.3,0.64,1);
  max-height: 90vh;
  overflow-y: auto;
}
@keyframes panel-in {
  from { opacity: 0; transform: scale(.92) translateY(14px); }
  to   { opacity: 1; transform: scale(1)   translateY(0); }
}

.mp-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1.1rem 1.2rem;
  border-bottom: 1px solid var(--border);
  background: rgba(245,200,66,.04);
}
.mp-panel-title {
  font-family: var(--font-d);
  font-size: .9rem;
  color: var(--gold);
}
.mp-panel-sub {
  font-size: .75rem;
  color: var(--muted);
  margin-top: .2rem;
  line-height: 1.4;
}

.mp-close {
  background: rgba(255,255,255,.06);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  width: 28px; height: 28px;
  cursor: pointer;
  font-size: .85rem;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.mp-close:hover { border-color: var(--red); color: var(--red); }

.mp-panel-body {
  display: flex;
  flex-direction: column;
  gap: .9rem;
  padding: 1.1rem 1.2rem 1.3rem;
}

.mp-prefilled {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  font-size: .85rem;
  font-weight: 600;
  padding: .45rem .8rem;
  background: rgba(245,200,66,.07);
  border: 1px solid rgba(245,200,66,.2);
  border-radius: 10px;
  color: var(--text);
}
.mp-prefilled-id {
  font-size: .7rem;
  color: var(--muted);
  font-family: 'Courier New', monospace;
  font-weight: 400;
}

/* ── Miniatura de carta en filas del marketplace ────────── */
.mp-offer-img {
  width: 32px;
  height: 44px;
  object-fit: cover;
  border-radius: 5px;
  border: 1.5px solid;
  flex-shrink: 0;
  transition: transform var(--transition);
}
.mp-offer-img:hover { transform: scale(1.08); }
.mp-offer-no-img {
  width: 32px;
  height: 44px;
  border-radius: 5px;
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  color: var(--muted);
  flex-shrink: 0;
  background: rgba(0,0,0,.3);
}

/* ============================================================
   PANEL DE INTERCAMBIOS (columna "Mis intercambios")
   ============================================================ */

.tr-panel {
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.tr-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .9rem 1.1rem;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,.03);
}

.tr-panel-title {
  font-family: var(--font-d);
  font-size: .88rem;
  color: var(--gold);
  letter-spacing: .05em;
}

.tr-new-btn {
  font-size: .75rem;
  padding: .35rem .9rem;
  border-radius: 20px;
  border: 1px solid rgba(245,200,66,.4);
  background: rgba(245,200,66,.08);
  color: var(--gold);
  cursor: pointer;
  font-family: var(--font-u);
  font-weight: 700;
  letter-spacing: .04em;
  transition: background var(--transition);
  white-space: nowrap;
}
.tr-new-btn:hover { background: rgba(245,200,66,.18); }

.tr-body { display: flex; flex-direction: column; }

/* ── Secciones ──────────────────────────────────────────── */
.tr-section {
  padding: .7rem 1rem .75rem;
  border-bottom: 1px solid rgba(255,255,255,.05);
}
.tr-section:last-child { border-bottom: none; }

.tr-section-label {
  font-family: var(--font-d);
  font-size: .7rem;
  color: var(--gold);
  letter-spacing: .1em;
  text-transform: uppercase;
  margin-bottom: .6rem;
}

/* ── Trade card ─────────────────────────────────────────── */
.tr-card {
  background: rgba(255,255,255,.03);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: .75rem;
  margin-bottom: .55rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.tr-card:last-child { margin-bottom: 0; }
.tr-card:hover {
  border-color: rgba(255,255,255,.1);
  box-shadow: 0 4px 18px rgba(0,0,0,.3);
}

.tr-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: .6rem;
}
.tr-other-user {
  font-size: .76rem;
  color: var(--muted);
}
.tr-other-user strong { color: var(--text); font-weight: 700; }
.tr-date {
  font-size: .67rem;
  color: var(--muted);
}

/* ── Visualización del intercambio ──────────────────────── */
.tr-exchange {
  display: flex;
  align-items: center;
  gap: .45rem;
  background: rgba(0,0,0,.22);
  border-radius: 10px;
  padding: .55rem .5rem;
  margin-bottom: .6rem;
}

.tr-slot {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .18rem;
  min-width: 0;
}

.tr-img-wrap {
  width: 60px;
  height: 82px;
  border: 1.5px solid;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(0,0,0,.4);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform var(--transition);
}
.tr-img-wrap:hover { transform: scale(1.05); }
.tr-img-wrap img { width: 100%; height: 100%; object-fit: cover; }

.tr-no-img {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: var(--muted);
}

.tr-cname {
  font-size: .63rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.2;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 .1rem;
}
.tr-cqty {
  font-size: .6rem;
  color: var(--muted);
  background: rgba(255,255,255,.07);
  padding: .05rem .3rem;
  border-radius: 8px;
  font-weight: 600;
}
.tr-role {
  font-size: .58rem;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.tr-role.give    { color: #f87171; }
.tr-role.receive { color: #34d399; }

.tr-swap {
  font-size: 1.1rem;
  color: var(--muted);
  flex-shrink: 0;
}

/* ── Botones de acción ──────────────────────────────────── */
.tr-actions {
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
}
.tr-btn {
  flex: 1;
  min-width: 0;
  padding: .42rem .5rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  font-family: var(--font-u);
  font-size: .74rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}
.tr-btn-sm { flex: 0 0 auto; }
.tr-btn-accept {
  border-color: rgba(52,211,153,.5);
  color: #34d399;
  background: rgba(52,211,153,.07);
}
.tr-btn-accept:hover:not(:disabled) { background: rgba(52,211,153,.17); }
.tr-btn-reject, .tr-btn-cancel {
  border-color: rgba(248,113,113,.4);
  color: #f87171;
  background: rgba(248,113,113,.05);
}
.tr-btn-reject:hover:not(:disabled),
.tr-btn-cancel:hover:not(:disabled) { background: rgba(248,113,113,.13); }
.tr-btn-complete {
  border-color: rgba(245,200,66,.5);
  color: var(--gold);
  background: rgba(245,200,66,.07);
}
.tr-btn-complete:hover:not(:disabled) { background: rgba(245,200,66,.15); }
.tr-btn:disabled { opacity: .4; cursor: not-allowed; }

.tr-waiting-label {
  font-size: .72rem;
  color: var(--muted);
  padding: .25rem 0;
  font-style: italic;
}

/* ── Empty state ────────────────────────────────────────── */
.tr-empty {
  padding: 2.2rem 1.5rem;
  text-align: center;
  color: var(--muted);
}
.tr-empty-icon { font-size: 2.2rem; margin-bottom: .8rem; }
.tr-empty p { font-size: .83rem; margin-bottom: .4rem; line-height: 1.5; }
.tr-empty-hint { font-size: .76rem; opacity: .7; }
.tr-empty strong { color: var(--gold); }

/* ── Sección de recientes ───────────────────────────────── */
.tr-recent-item {
  display: flex;
  align-items: center;
  gap: .45rem;
  padding: .32rem 0;
  border-bottom: 1px solid rgba(255,255,255,.04);
  font-size: .74rem;
}
.tr-recent-item:last-child { border-bottom: none; }
.tr-recent-desc {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
}
.tr-recent-desc strong { color: var(--text); }
.tr-recent-date {
  font-size: .63rem;
  color: var(--muted);
  flex-shrink: 0;
}

/* ── Layout de la página trades ─────────────────────────── */
.trades-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
}
@media (max-width: 768px) {
  .trades-layout { grid-template-columns: 1fr; }
  .mp-panel { border-radius: 14px; max-width: 100%; }
  .mp-overlay { align-items: flex-end; padding: 0; }
  .mp-panel { border-radius: 18px 18px 0 0; }
}