/* ═══════════════════════════════════════════════════════
   MERCHANT SHOPS — Tüccar Dükkanları CSS v2
   Dükkan görselleri ön planda, envanter altta kompakt
   ═══════════════════════════════════════════════════════ */

/* ── Container ── */
.merchant-page {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: calc(100vh - 60px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Background Scene — FULL VISIBLE ── */
.merchant-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-size: cover;
  background-position: center 30%;
  background-repeat: no-repeat;
  transition: background-image 0.6s ease-in-out, opacity 0.6s ease-in-out;
}
.merchant-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.05) 0%,
    rgba(0, 0, 0, 0.10) 40%,
    rgba(0, 0, 0, 0.50) 75%,
    rgba(0, 0, 0, 0.85) 100%
  );
  pointer-events: none;
}

/* ── Top Shop Selector — floating over image ── */
.merchant-shop-bar {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  overflow-x: auto;
  scrollbar-width: none;
}
.merchant-shop-bar::-webkit-scrollbar { display: none; }

.merchant-shop-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid rgba(197, 160, 89, 0.2);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: rgba(255, 255, 255, 0.65);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.4px;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}
.merchant-shop-btn:hover {
  background: rgba(197, 160, 89, 0.12);
  border-color: rgba(197, 160, 89, 0.45);
  color: #fff;
  transform: translateY(-1px);
}
.merchant-shop-btn.active {
  background: linear-gradient(135deg, rgba(197, 160, 89, 0.2), rgba(197, 160, 89, 0.08));
  border-color: var(--gold, #c5a059);
  color: var(--gold, #c5a059);
  box-shadow: 0 0 15px rgba(197, 160, 89, 0.12);
}
.merchant-shop-btn .shop-icon { font-size: 15px; }

/* ── Shop Info Overlay (name badge over image) ── */
.merchant-shop-info {
  position: relative;
  z-index: 10;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 0 20px;
  pointer-events: none;
}
.merchant-shop-name-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 20px;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(197, 160, 89, 0.25);
  border-radius: 12px;
  width: fit-content;
  margin-bottom: 10px;
  pointer-events: auto;
}
.merchant-shop-name-badge .shop-badge-icon { font-size: 22px; }
.merchant-shop-name-badge .shop-badge-name {
  font-size: 18px;
  font-weight: 800;
  color: var(--gold, #c5a059);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
.merchant-shop-name-badge .shop-badge-sub {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.45);
  font-weight: 500;
  margin-left: -4px;
}

/* ── Refresh Timer Badge ── */
.merchant-refresh-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.5);
  width: fit-content;
  margin-bottom: 8px;
  pointer-events: auto;
}
.merchant-refresh-badge .timer-icon { font-size: 13px; }

/* ── Bottom Trade Bar ── */
.merchant-trade-bar {
  position: relative;
  z-index: 10;
  display: flex;
  gap: 10px;
  padding: 8px 14px 10px;
  background: rgba(5, 5, 12, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(197, 160, 89, 0.2);
  height: 200px;
  flex-shrink: 0;
}

/* ── Glass Panel (shared) ── */
.merchant-panel {
  display: flex;
  flex-direction: column;
  background: rgba(10, 10, 18, 0.5);
  border: 1px solid rgba(197, 160, 89, 0.15);
  border-radius: 12px;
  overflow: hidden;
  min-height: 0;
}
.merchant-panel.shop-panel { flex: 3; }
.merchant-panel.player-panel { flex: 2; }

.merchant-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 12px;
  border-bottom: 1px solid rgba(197, 160, 89, 0.1);
  background: rgba(0, 0, 0, 0.25);
  min-height: 28px;
}
.merchant-panel-header h3 {
  margin: 0;
  font-size: 11px;
  font-weight: 800;
  color: var(--gold, #c5a059);
  letter-spacing: 0.8px;
  text-transform: uppercase;
}
.merchant-panel-header .merchant-gold-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  color: #ffd700;
  background: rgba(255, 215, 0, 0.08);
  border: 1px solid rgba(255, 215, 0, 0.15);
  border-radius: 6px;
  padding: 2px 8px;
}

/* ── Player Selector (compact) ── */
.merchant-player-select {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.merchant-player-select select {
  flex: 1;
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: #1a1a24;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  outline: none;
}
.merchant-player-select select:focus {
  border-color: var(--gold, #c5a059);
}
.merchant-player-select select option {
  background: #1a1a24;
  color: #fff;
  padding: 6px 8px;
  font-weight: 600;
}

/* ── Price Slider (compact) ── */
.merchant-price-slider-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 10px;
  color: rgba(255, 255, 255, 0.5);
}
.merchant-price-slider-wrap label {
  white-space: nowrap;
  font-weight: 600;
  color: var(--gold, #c5a059);
  font-size: 10px;
}
.merchant-price-slider-wrap input[type="range"] {
  flex: 1;
  accent-color: var(--gold, #c5a059);
  cursor: pointer;
  height: 4px;
}
.merchant-price-slider-wrap .slider-val {
  font-weight: 700;
  color: #ffd700;
  min-width: 32px;
  text-align: center;
  font-size: 11px;
}

/* ── Item Grid (horizontal scroll) ── */
.merchant-items-grid {
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 6px 8px;
  display: flex;
  gap: 8px;
  align-items: stretch;
  scrollbar-width: auto;
  scrollbar-color: rgba(197, 160, 89, 0.5) rgba(0, 0, 0, 0.3);
}
.merchant-items-grid::-webkit-scrollbar { height: 8px; }
.merchant-items-grid::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 4px;
}
.merchant-items-grid::-webkit-scrollbar-thumb {
  background: rgba(197, 160, 89, 0.5);
  border-radius: 4px;
}
.merchant-items-grid::-webkit-scrollbar-thumb:hover {
  background: rgba(197, 160, 89, 0.8);
}

/* ── Item Card ── */
.merch-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(20, 20, 30, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 6px 6px 5px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  min-width: 95px;
  max-width: 110px;
  flex-shrink: 0;
}
.merch-item::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: 10px 10px 0 0;
  opacity: 0.8;
}
.merch-item[data-rarity="Sıradan (Common)"]::before { background: #888; }
.merch-item[data-rarity="Sıradışı (Uncommon)"]::before { background: #2ecc71; }
.merch-item[data-rarity="Nadir (Rare)"]::before { background: #3498db; }
.merch-item[data-rarity="Çok Nadir (Very Rare)"]::before { background: #9b59b6; }
.merch-item[data-rarity="Efsanevi (Legendary)"]::before { background: #f39c12; }
.merch-item[data-rarity="Büyüsüz"]::before { background: #555; }

.merch-item:hover {
  background: rgba(197, 160, 89, 0.1);
  border-color: rgba(197, 160, 89, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
}

.merch-item-img {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 3px;
}
.merch-item-img img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(1px 1px 2px rgba(0,0,0,0.5));
}
.merch-item-name {
  font-size: 10px;
  font-weight: 700;
  text-align: center;
  color: rgba(255, 255, 255, 0.9);
  min-height: 14px;
  max-height: 26px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  width: 100%;
  line-height: 1.3;
}
.merch-item-price {
  font-size: 10px;
  font-weight: 800;
  color: #ffd700;
  margin-top: 2px;
}
.merch-item-price.no-price {
  color: rgba(255, 255, 255, 0.3);
  font-style: italic;
  font-size: 9px;
}

/* ── Buy Button on Item ── */
.merch-buy-btn {
  margin-top: 3px;
  width: 100%;
  padding: 3px 4px;
  border: none;
  border-radius: 5px;
  background: rgba(46, 204, 113, 0.65);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}
.merch-buy-btn:hover {
  background: rgba(46, 204, 113, 0.95);
}
.merch-buy-btn:disabled {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.3);
  cursor: not-allowed;
}

/* ── Player Inventory Item (sell side) ── */
.merch-inv-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(20, 20, 30, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 5px 5px 4px;
  position: relative;
  transition: all 0.2s ease;
  cursor: pointer;
  min-width: 85px;
  max-width: 100px;
  flex-shrink: 0;
}
.merch-inv-item:hover {
  background: rgba(231, 76, 60, 0.1);
  border-color: rgba(231, 76, 60, 0.3);
}
.merch-inv-item .merch-inv-qty {
  position: absolute;
  top: 2px; right: 2px;
  background: rgba(0, 0, 0, 0.9);
  border: 1px solid #777;
  border-radius: 3px;
  padding: 0 4px;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
}
.merch-inv-item .merch-inv-img {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2px;
}
.merch-inv-item .merch-inv-img img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.merch-inv-item .merch-inv-name {
  font-size: 9px;
  font-weight: 600;
  text-align: center;
  color: rgba(255, 255, 255, 0.85);
  max-height: 24px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  width: 100%;
  line-height: 1.2;
}
.merch-inv-item .merch-inv-sell-price {
  font-size: 9px;
  color: #ffd700;
  font-weight: 700;
  margin-top: 1px;
}
.merch-inv-item .merch-sell-btn {
  margin-top: 2px;
  width: 100%;
  padding: 3px;
  border: none;
  border-radius: 5px;
  background: rgba(231, 76, 60, 0.65);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}
.merch-inv-item .merch-sell-btn:hover { background: rgba(231, 76, 60, 0.95); }

/* ── Empty States ── */
.merch-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  grid-column: 1 / -1;
  color: rgba(255, 255, 255, 0.2);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  padding: 20px;
}

/* ── Transaction Toast ── */
.merch-transaction-toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: rgba(10, 10, 20, 0.92);
  backdrop-filter: blur(12px);
  border: 1px solid var(--gold, #c5a059);
  border-radius: 10px;
  padding: 8px 22px;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
}
.merch-transaction-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Responsive ── */
@media (max-width: 1000px) {
  .merchant-trade-bar {
    flex-direction: column;
    max-height: 50vh;
  }
  .merchant-items-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* ═══════════════════════════════════════════
   ROMANCE CARDS (Witcher-style popup)
   ═══════════════════════════════════════════ */
.romance-card-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(0, 0, 0, 0);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.6s ease;
}
.romance-card-overlay.romance-card-visible {
  background: rgba(0, 0, 0, 0.92);
}
.romance-card-overlay.romance-card-fadeout {
  background: rgba(0, 0, 0, 0);
  opacity: 0;
  transition: all 0.5s ease;
}

.romance-card-container {
  width: 340px;
  max-height: 75vh;
  border: 3px solid #c5a059;
  border-radius: 16px;
  overflow: hidden;
  background: #0a0a0c;
  transform: scale(0.5) rotateY(90deg);
  opacity: 0;
  transition: all 0.8s cubic-bezier(0.17, 0.67, 0.35, 1.2);
}
.romance-card-visible .romance-card-container {
  transform: scale(1) rotateY(0deg);
  opacity: 1;
}
.romance-card-fadeout .romance-card-container {
  transform: scale(0.8) rotateY(-30deg);
  opacity: 0;
}

.romance-card-img-wrap {
  width: 100%;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: #1a1a24;
  display: flex;
  align-items: center;
  justify-content: center;
}
.romance-card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(1.1) contrast(1.05);
}

.romance-card-info {
  padding: 14px 16px;
  text-align: center;
  background: linear-gradient(180deg, rgba(10,10,12,0.9), rgba(10,10,12,1));
}
.romance-card-name {
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.romance-card-rarity {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 8px;
  opacity: 0.8;
}
.romance-card-flavor {
  font-size: 12px;
  color: rgba(255, 200, 100, 0.85);
  font-style: italic;
  margin-bottom: 6px;
  font-family: serif;
}
.romance-card-players {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.3);
  letter-spacing: 1px;
}

.romance-card-hint {
  margin-top: 20px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.25);
  letter-spacing: 1px;
  opacity: 0;
  transition: opacity 0.5s ease 1s;
}
.romance-card-visible .romance-card-hint {
  opacity: 1;
}
