/* Merchant Panel Layout */
#merchant-panel {
  display: grid;
  grid-template-areas:
    "timer offers"
    "bulkbuy offers"
    "buyout offers"
    "image offers"
    "info offers"
    "message offers";
  grid-template-columns: 25% 1fr;
  grid-template-rows: auto auto auto auto auto 1fr;
  gap: 8px 16px;
  align-items: start;
}

.merchant-image {
  grid-area: image;
  width: 100%;
  object-fit: cover;
  border-radius: 4px;
}

.merchant-info {
  grid-area: info;
  background: rgba(136, 136, 136, 0.5);
  padding: 8px;
  border-radius: 4px;
  margin-bottom: 8px;
}

.merchant-name {
  font-size: 1.2em;
  font-weight: bold;
  margin-bottom: 4px;
  color: #fff;
}

.merchant-description {
  font-size: 0.9em;
  color: #ddd;
  font-style: italic;
}

.merchant-message {
  grid-area: message;
  font-style: italic;
  max-width: 100%;
  text-wrap: normal;
  background: rgba(136, 136, 136, 0.5);
  padding: 8px;
  border-radius: 4px;
  margin-top: 0;
}

.merchant-offers {
  grid-area: offers;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  background: url('../assets/images/table_texture.jpg') top left/auto repeat;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

#merchant-timer {
  /* stick to the top of its container */
  position: relative;
  top: 0;
  z-index: 10;
  text-align: center;

  /* make it big and bold */
  font-size: clamp(1em, 3dvh, 1.6em);
  font-weight: 600;
  padding: 8px 0;

  /* a little background so it always sits cleanly above cards */
  background: rgba(136, 136, 136, 0.5);

  /* allow the urgent red class to override color */
  color: inherit;
  transition: color 0.2s;
}

#merchant-timer.urgent {
  color: red;
}

/* Merchant Offer Card Styles */
.merchant-offer {
  width: 120px;
  margin: 8px;
}

.merchant-offer .card-face.front {
  position: relative;
  overflow: visible;
}

.merchant-offer .merchant-modal-bar-container {
  position: absolute;
  top: 1%;
  left: 3%;
  right: 3%;
  height: 10%;
  background: rgba(200, 200, 200, 0.5);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid rgb(74, 74, 74);
}

.merchant-offer .merchant-modal-bar {
  height: 100%;
  background: #4caf50;
  transition: width 0.3s ease;
}

.merchant-offer .tier-threshold {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  font-family: var(--ui-font); /* fixed typo: --- -> -- */
  font-size: clamp(0.42em, 1.5dvh, 0.75em);
  color: white;
  font-weight: 550;

  max-width: 100%;
  max-height: 100%;
  overflow: hidden;
  white-space: nowrap;
  line-height: 1;
}

.offer-buy-btn {
  position: absolute;
  bottom: 4px;
  left: 2px;
  background: #4caf50;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: clamp(1px, 2dvh, 2px) clamp(2px, 4dvh, 6px);
  font-size: clamp(0.4em, 2dvh, 0.8em);
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  flex-direction: column;
  align-items: flex-start;
  max-width: 75%;
  touch-action: manipulation;
}

.offer-buy-btn .icon {
  width: 16px;
  height: 16px;
  margin-left: 4px;
}


.offer-buy-btn.unaffordable {
  color: #ff4444;
  background: #163117;
}

.offer-buy-btn.unaffordable:hover {
  background: rgba(255, 68, 68, 0.3);
}

#merchant-bulkbuy-btn, .merchant-bulkbuy-btn {
  grid-column: 1;
  grid-row: 2;
  margin: 8px 0 8px 0;
  width: 100%;
  padding: 12px 0;
  font-size: 1.1em;
  font-weight: bold;
  background: linear-gradient(90deg, #4caf50 60%, #81c784 100%);
  color: #fff;
  border: none;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
  display: block;
}
#merchant-bulkbuy-btn:hover, .merchant-bulkbuy-btn:hover {
  background: linear-gradient(90deg, #388e3c 60%, #66bb6a 100%);
  box-shadow: 0 4px 16px rgba(0,0,0,0.13);
}

/* Buyout Cost Grid Styles */
.buyout-cost-container {
  grid-area: buyout;
  width: 100%;
  background: rgba(136, 136, 136, 0.5);
  border-radius: 4px;
  padding: 8px;
  margin-bottom: 8px;
}

.buyout-cost-title {
  text-align: center;
  font-weight: bold;
  margin-bottom: 8px;
  font-size: 1em;
}

.buyout-cost-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
  max-width: 100%;
  gap: 4px;
}

.buyout-cost-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: clamp(0.8em, 2dvh, 0.9em);
  padding: 2px 6px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.2);
  white-space: nowrap;
  overflow: hidden;
  min-width: 0;
}

.buyout-cost-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
}

.buyout-cost-item img {
  width: clamp(12px, 3dvh, 16px);
  height: clamp(12px, 3dvh, 16px);
  flex-shrink: 0;
}

.buyout-cost-item.unaffordable {
  color: #ef3434;
}

.buyout-cost-item.expensive {
  color: #d7e234;
}

.buyout-cost-item.affordable {
  color: #81c784;
}

/* Price Intuition Cloud Styles */
.price-intuition-cloud {
  position: absolute;
  right: -15px;
  bottom: 30%;
  background: white;
  border-radius: 50%;
  padding: 8px 12px;
  font-size: 0.7em;
  font-weight: bold;
  text-align: center;
  white-space: pre-line;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  z-index: 10;
  transform: rotate(-5deg);
  pointer-events: none;
}

.price-intuition-cloud.bad {
  background: #ffebee;
  color: #c62828;
}

.price-intuition-cloud.good {
  background: #e8f5e9;
  color: #2e7d32;
}

.price-intuition-cloud.great {
  background: #e8f5e9;
  color: #1b5e20;
  font-size: 0.8em;
}

.price-intuition-cloud.must-buy {
  background: #e8f5e9;
  color: #1b5e20;
  font-size: 0.9em;
  animation: pulse 1.5s infinite;
}

.merchant-skip-message {
    margin-top: 8px;
    padding: 4px 8px;
    background: rgba(0,0,0,0.5);
    border-radius: 4px;
    font-size: 0.9em;
    color: #999;
    text-align: center;
}

@keyframes pulse {
  0% { transform: rotate(-5deg) scale(1); }
  50% { transform: rotate(-5deg) scale(1.1); }
  100% { transform: rotate(-5deg) scale(1); }
}