/* ============================================================
   Giełda — podstrona VixenLand (bazuje na palecie z global.css)
   ============================================================ */

/* --- Hero (#header nie dostaje paddingu z global.css, więc ustawiamy sami) --- */
#header {
  min-height: 44vh;
  display: flex;
  align-items: center;
  padding: 50px 150px;
  background: url('../../images/section2.jpg') center / cover no-repeat;
}
#header .content {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
#header .info .minecraft-server-ip {
  color: var(--main-color);
  font-family: var(--display-font);
  font-weight: 700;
  letter-spacing: 1px;
}
#header .info .title {
  color: var(--white-color);
  font-size: clamp(38px, 6vw, 62px);
  font-weight: 700;
  line-height: 1.05;
}
#header .info .title span { color: var(--main-color); }
#header .description {
  color: var(--description-color);
  font-size: 18px;
  line-height: 1.6;
  max-width: 640px;
}

/* --- Sekcja giełdy --- */
#gielda .content { padding-top: 56px; }

/* Pasek narzędzi: szukajka + kategorie */
.gielda-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.gielda-search {
  position: relative;
  flex: 1 1 260px;
  max-width: 360px;
}
.gielda-search i {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--description-color);
  opacity: 0.55;
  pointer-events: none;
}
.gielda-search input {
  width: 100%;
  padding: 12px 16px 12px 42px;
  border-radius: 999px;
  border: 1px solid rgba(247, 170, 169, 0.18);
  background: var(--stats-background);
  color: var(--white-color);
  font-family: var(--main-font);
  font-size: 15px;
  outline: none;
  transition: 0.2s;
}
.gielda-search input::placeholder { color: var(--description-color); opacity: 0.5; }
.gielda-search input:focus { border-color: var(--main-color); }

.gielda-cats { display: flex; flex-wrap: wrap; gap: 10px; }
.gielda-chip {
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  border: 1px solid rgba(247, 170, 169, 0.18);
  background: transparent;
  color: var(--description-color);
  font-family: var(--display-font);
  font-weight: 600;
  font-size: 14px;
  transition: 0.2s;
}
.gielda-chip:hover { color: var(--white-color); border-color: rgba(228, 59, 107, 0.5); }
.gielda-chip.active {
  color: var(--white-color);
  background: rgba(228, 59, 107, 0.15);
  border-color: var(--main-color);
}

.gielda-meta {
  color: var(--description-color);
  opacity: 0.7;
  font-size: 14px;
  margin-bottom: 18px;
}

/* Siatka kart */
.gielda-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: 18px;
}

.market-card {
  background: linear-gradient(160deg, rgba(247, 170, 169, 0.08), rgba(247, 170, 169, 0.03));
  border: 1px solid rgba(247, 170, 169, 0.14);
  border-radius: 18px;
  padding: 18px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.market-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.28);
  border-color: rgba(228, 59, 107, 0.4);
}

.mc-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.mc-icon {
  width: 44px; height: 44px;
  object-fit: contain;
  image-rendering: -moz-crisp-edges;
  image-rendering: pixelated;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(247, 170, 169, 0.14);
  border-radius: 12px;
  padding: 6px;
  flex-shrink: 0;
}
.mc-icon-fallback {
  display: flex; align-items: center; justify-content: center;
  color: var(--description-color); font-size: 20px; padding: 0;
}
.mc-name h3 { color: var(--white-color); font-size: 17px; font-weight: 700; line-height: 1.2; }
.mc-name .mc-cat {
  color: var(--main-color);
  font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px;
}

.mc-prices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.mc-price {
  border-radius: 12px; padding: 10px 12px;
  display: flex; flex-direction: column; gap: 2px;
}
.mc-price span { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; opacity: 0.85; }
.mc-price b { font-size: 17px; font-weight: 800; font-family: var(--display-font); }
.mc-price.buy { background: rgba(178, 68, 74, 0.12); border: 1px solid rgba(178, 68, 74, 0.22); }
.mc-price.buy span { color: var(--warning-color); }
.mc-price.buy b { color: #F2A0A0; }
.mc-price.sell { background: rgba(255, 159, 146, 0.10); border: 1px solid rgba(255, 159, 146, 0.22); }
.mc-price.sell span, .mc-price.sell b { color: var(--green-color); }

.mc-stock-bar {
  height: 8px; border-radius: 999px;
  background: rgba(0, 0, 0, 0.28);
  overflow: hidden; margin-bottom: 6px;
}
.mc-stock-bar span { display: block; height: 100%; border-radius: 999px; background: var(--main-color); transition: width 0.5s ease; }
.mc-stock.st-low  .mc-stock-bar span { background: var(--red-color); }
.mc-stock.st-high .mc-stock-bar span { background: var(--green-color); }
.mc-stock-label { font-size: 12px; color: var(--description-color); opacity: 0.75; }

/* Skeleton (ładowanie) */
.market-card.skeleton { pointer-events: none; }
.market-card.skeleton .sk {
  background: rgba(247, 170, 169, 0.08);
  border-radius: 8px;
  animation: skPulse 1.2s ease-in-out infinite;
}
@keyframes skPulse { 0%,100% { opacity: 0.5; } 50% { opacity: 1; } }

/* Stany */
.gielda-empty { grid-column: 1 / -1; text-align: center; padding: 40px; color: var(--description-color); opacity: 0.7; }
.gielda-state { text-align: center; padding: 60px 20px; }
.gielda-state i { font-size: 40px; color: var(--red-color); opacity: 0.75; }
.gielda-state p { margin-top: 14px; font-size: 16px; color: var(--white-color); }
.gielda-state small { display: block; margin-top: 6px; color: var(--description-color); opacity: 0.6; font-family: monospace; }

/* Responsive */
@media screen and (max-width: 1625px) {
  #header { padding: 50px 90px; }
}
@media screen and (max-width: 819px) {
  #header { padding: 40px 30px; min-height: 32vh; }
  .gielda-toolbar { flex-direction: column; align-items: stretch; }
  /* w kolumnie flex-basis:260px stawał się WYSOKOŚCIĄ → pole rosło w pionie,
     a ikona (top:50%) wisiała w pustce. Reset flexa naprawia layout. */
  .gielda-search { max-width: none; flex: 0 0 auto; }
  .gielda-sort { width: 100%; }
}

/* ============================================================
   PANEL OPERATORA (admin) — logowanie / dodawanie / edycja
   ============================================================ */

/* Przyciski edycji/usuwania na karcie (widoczne w trybie operatora) */
.market-card { position: relative; }
.mc-admin {
  position: absolute; top: 12px; right: 12px;
  display: flex; gap: 6px; opacity: 0; transition: opacity 0.2s;
}
.market-card.is-admin:hover .mc-admin { opacity: 1; }
.mc-abtn {
  width: 30px; height: 30px; border-radius: 9px; cursor: pointer;
  border: 1px solid rgba(247, 170, 169, 0.2);
  background: rgba(35, 26, 29, 0.85); color: var(--description-color);
  display: flex; align-items: center; justify-content: center; font-size: 12px;
  transition: 0.15s;
}
.mc-abtn.edit:hover { color: var(--white-color); border-color: var(--main-color); background: rgba(228, 59, 107, 0.2); }
.mc-abtn.del:hover  { color: #fff; border-color: var(--red-color); background: rgba(178, 68, 74, 0.35); }

/* Pływający pasek operatora */
#gld-adminbar {
  position: fixed; right: 20px; bottom: 20px; z-index: 950;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 16px;
  background: rgba(20, 12, 15, 0.92); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border: 1px solid rgba(228, 59, 107, 0.3);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.45);
}
.gld-badge {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--main-color); font-family: var(--display-font); font-weight: 600;
  font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px;
}

/* Przyciski generyczne */
.gld-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px; border-radius: 12px; cursor: pointer;
  font-family: var(--display-font); font-weight: 600; font-size: 14px;
  border: 1px solid transparent; transition: 0.15s; white-space: nowrap;
}
.gld-btn.primary { background: linear-gradient(135deg, var(--main-color), var(--main-color-2)); color: #fff; }
.gld-btn.primary:hover { filter: brightness(1.1); }
.gld-btn.ghost { background: rgba(217, 205, 208, 0.08); border-color: rgba(247, 170, 169, 0.2); color: var(--description-color); }
.gld-btn.ghost:hover { color: var(--white-color); border-color: rgba(247, 170, 169, 0.4); }
.gld-btn.danger { background: rgba(178, 68, 74, 0.18); border-color: rgba(178, 68, 74, 0.4); color: var(--warning-color); }
.gld-btn.danger:hover { background: var(--red-color); color: #fff; }
.gld-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Modal */
.gld-modal {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background: rgba(10, 6, 8, 0.72); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.gld-modal-box {
  width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto;
  background: #201519; border: 1px solid rgba(247, 170, 169, 0.14);
  border-radius: 20px; padding: 24px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}
.gld-modal-box h3 {
  color: var(--white-color); font-family: var(--display-font);
  font-size: 20px; display: flex; align-items: center; gap: 10px; margin-bottom: 6px;
}
.gld-modal-box h3 i { color: var(--main-color); }
.gld-sub { color: var(--description-color); opacity: 0.7; font-size: 14px; margin-bottom: 18px; }

.gld-form { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.gld-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.gld-form > .gld-row:nth-of-type(1) { grid-template-columns: 1fr 1fr; }
.gld-form label, .gld-modal-box > label {
  display: flex; flex-direction: column; gap: 5px;
  font-size: 12px; font-weight: 600; color: var(--description-color);
  text-transform: uppercase; letter-spacing: 0.4px;
}
.gld-form label small { text-transform: none; opacity: 0.5; font-weight: 400; letter-spacing: 0; }
.gld-inp {
  width: 100%; padding: 10px 12px; border-radius: 10px;
  border: 1px solid rgba(247, 170, 169, 0.18); background: rgba(0, 0, 0, 0.28);
  color: var(--white-color); font-family: var(--main-font); font-size: 14px; outline: none;
  transition: 0.15s;
}
.gld-inp:focus { border-color: var(--main-color); }
.gld-inp[readonly] { opacity: 0.6; cursor: not-allowed; }

.gld-actions { display: flex; align-items: center; gap: 10px; margin-top: 18px; }
.gld-spacer { flex: 1; }
.gld-err {
  margin-top: 12px; padding: 10px 12px; border-radius: 10px;
  background: rgba(178, 68, 74, 0.12); border: 1px solid rgba(178, 68, 74, 0.3);
  color: var(--warning-color); font-size: 13px;
}

/* Toast */
.gld-toast {
  position: fixed; left: 50%; bottom: 26px;
  transform: translate(-50%, 20px);
  z-index: 1100; padding: 12px 20px; border-radius: 12px;
  font-family: var(--display-font); font-weight: 600; font-size: 14px; color: #fff;
  opacity: 0; transition: opacity 0.3s ease, transform 0.3s ease;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.45);
}
.gld-toast.show { opacity: 1; transform: translate(-50%, 0); }
.gld-toast.ok  { background: linear-gradient(135deg, #d98a6e, var(--green-color)); color: #201519; }
.gld-toast.err { background: var(--red-color); }

@media screen and (max-width: 620px) {
  .gld-row, .gld-form > .gld-row:nth-of-type(1) { grid-template-columns: 1fr; }
  #gld-adminbar { right: 12px; left: 12px; bottom: 12px; justify-content: center; }
}

/* ── Karty statystyk (góra giełdy) ── */
.gielda-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}
.gld-stat {
  display: flex; align-items: center; gap: 13px;
  padding: 16px 18px; border-radius: 16px;
  background: rgba(247, 170, 169, 0.05);
  border: 1px solid rgba(247, 170, 169, 0.12);
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.gld-stat:hover { transform: translateY(-3px); border-color: rgba(228, 59, 107, 0.35); }
.gld-stat-ic {
  width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(228, 59, 107, 0.12); color: var(--main-color); font-size: 18px;
}
.gld-stat-t span {
  display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--description-color); opacity: 0.7; margin-bottom: 2px;
}
.gld-stat-t b { font-family: var(--display-font); font-size: 20px; color: var(--white-color); line-height: 1; }

/* ── Wskaźnik odchylenia ceny od bazowej ── */
.mc-bal {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; margin-bottom: 12px;
}
.mc-bal.up   { color: #F2A0A0; }            /* drożej niż bazowa */
.mc-bal.down { color: var(--green-color); } /* taniej — okazja */
.mc-bal.flat { color: var(--description-color); opacity: 0.55; }

/* ── Sortowanie + pasek meta/LIVE ── */
.gielda-sort {
  padding: 9px 14px; border-radius: 999px; cursor: pointer;
  -webkit-appearance: none; appearance: none;
  border: 1px solid rgba(247,170,169,0.18); background: var(--stats-background);
  color: var(--description-color); font-family: var(--display-font); font-weight: 600; font-size: 14px; outline: none;
}
.gielda-sort:focus { border-color: var(--main-color); color: var(--white-color); }
.gielda-sort option { background: #201519; color: var(--white-color); }
.gielda-metabar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.gielda-metabar .gielda-meta { margin-bottom: 0; }
.gielda-live { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; letter-spacing: 0.5px; color: var(--green-color); }
.gielda-live .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green-color); animation: gldLivePulse 1.6s infinite; }
@keyframes gldLivePulse { 0% { box-shadow: 0 0 0 0 rgba(255,159,146,0.6); } 70% { box-shadow: 0 0 0 8px rgba(255,159,146,0); } 100% { box-shadow: 0 0 0 0 rgba(255,159,146,0); } }

/* ── Animacja wejścia kart ── */
@keyframes gldCardIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* ── Sekcja "Jak działa giełda" ── */
#gielda-how .info { margin-bottom: 30px; }
.how-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; counter-reset: how; }
.how-card {
  position: relative; overflow: hidden;
  padding: 24px 22px; border-radius: 18px;
  background: linear-gradient(160deg, rgba(247,170,169,0.09), rgba(228,59,107,0.03));
  border: 1px solid rgba(247,170,169,0.14);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.how-card::after {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--main-color), var(--main-color-2)); opacity: 0.75;
}
.how-card::before {
  counter-increment: how; content: counter(how);
  position: absolute; top: 16px; right: 20px;
  font-family: var(--display-font); font-weight: 700; font-size: 36px;
  color: rgba(247,170,169,0.13); line-height: 1;
}
.how-card:hover { transform: translateY(-5px); border-color: rgba(228,59,107,0.4); box-shadow: 0 16px 38px rgba(0,0,0,0.32); }
.how-ic {
  width: 50px; height: 50px; border-radius: 14px; margin-bottom: 16px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(228,59,107,0.14); color: var(--main-color); font-size: 22px;
}
.how-card h3 { color: var(--white-color); font-family: var(--display-font); font-size: 18px; margin-bottom: 8px; }
.how-card p { color: var(--description-color); font-size: 14px; line-height: 1.55; opacity: 0.85; }

/* ── Item "za progresją" (zablokowany w VixenCore) — wyszarzony ── */
.market-card.is-gated .mc-head,
.market-card.is-gated .mc-prices,
.market-card.is-gated .mc-bal,
.market-card.is-gated .mc-stock { opacity: 0.4; filter: grayscale(0.9); }
.market-card.is-gated { border-color: rgba(178,68,74,0.25); }
.mc-lock {
  position: absolute; top: 12px; left: 12px; z-index: 3;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 999px;
  background: rgba(178,68,74,0.92); color: #fff;
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
}

/* iOS: pola formularza >=16px, by Safari nie przybliżał widoku przy kliknięciu */
@media (max-width: 819px) {
  .gielda-search input, .gielda-sort, .gld-inp { font-size: 16px; }
}
