.market-window {
  position: absolute;
  width: 100%;
  height: 100%;
  background: rgba(30, 30, 30, 0.95);
  flex-direction: column;
  font-family: 'black ops one', sans-serif;
  color: #eee;
  display: none;
  overflow: auto;
}
.market-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  background: #222;
  border-bottom: 2px solid #444;
  flex-direction: column;
  position: relative;
}
.market-header h2 {
  text-align: center;
  margin-top: 1rem;
}
#close-market {
  position: absolute;
  top: 2rem;
  right: 0;
}

.market-tabs {
  display: flex;
  gap: 8px;
  padding: 8px;
  background: #1a1a1a;
}

.market-tabs .tab {
  flex: 1;
  background: #333;
  border: none;
  padding: 6px;
  cursor: pointer;
  color: #eee;
  border-radius: 6px;
}

.market-tabs .tab.active {
  background: #666;
}

.market-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: grid;
  flex-direction: column;
  gap: 12px;
  justify-content: flex-start;
  overflow: visible;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  background: url('../images/extra-dark-steel.png');
}

.market-item {
  flex-direction: column;
  display: flex;
  align-items: center;
  background: #2a2a2a;
  min-height: 140px;
  width: 100%;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  transition: transform 0.15s ease;
  cursor: pointer;
  border-radius: 6px;
}
.market-item:hover {
  transform: scale(1.05);
  background: #3a3a3a;
}

.market-item img {
  width: 40px;
  height: 40px;
}

.item-types {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.item-name {
  font-weight: bold;
}

.item-price {
  font-size: 0.9em;
  color: #bbb;
}

.buy-btn, .post-btn, .close-btn {
  background: #444;
  border: none;
  padding: 6px 12px;
  margin-bottom: 1rem;
  cursor: pointer;
  color: #eee;
  border-radius: 6px;
}

.buy-btn:hover, .post-btn:hover, .close-btn:hover {
  background: #666;
}

.market-footer {
  padding: 10px;
  border-top: 2px solid #444;
  background: #222;
  text-align: right;
}


#item-detail-window {
  display: flex;
  flex-direction: column;
  background: #1e1e1e;
  color: #fff;
  width: 100%;
  height: 100%;
}

.item-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.item-detail-header h2 {
  margin: 0;
  flex: 1;
  text-align: center;
}

.item-detail-content {
  margin-top: 1rem;
  flex: 1;
  overflow-y: auto;
}

.buy-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.buy-modal-content {
  background: #2a2a2a;
  padding: 20px;
  border-radius: 10px;
  text-align: center;
  width: 300px;
}

.buy-modal-content h3 {
  margin-bottom: 10px;
}

.buy-modal-content input {
  width: 80px;
  padding: 5px;
  margin: 10px 0;
  text-align: center;
}

.buy-buttons {
  display: flex;
  justify-content: space-between;
  margin-top: 15px;
}
.buy-btn:disabled {
  background: #555;
  color: #999;
  cursor: not-allowed;
}
#market-loading {
  display: none;
  text-align: center;
  font-size: 1.2em;
  padding: 20px;
  color: #fff;
}

#market-loading::after {
  content: "⏳";
  display: inline-block;
  margin-left: 8px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
