/* Store modal: sidebar (categories) + item list + detail panel, matching real Tibia's own
   three-pane layout. Reuses the same dark/gradient look as market.css and the same row-list
   conventions as modal.css's .offer-row / .character-row. */

.store-modal {
  background: #444 url("../png/bg.png") repeat;
  border: 1px solid #111;
  box-shadow: inset 0 0 0 1px #777, 0 4px 18px #000;
  color: #dedede;
  flex-direction: column;
  font-family: Verdana, Arial, sans-serif;
  font-size: 11px;
  height: min(600px, calc(100% - 20px));
  left: 50%;
  min-height: 480px;
  min-width: 760px;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(900px, calc(100% - 24px));
  z-index: 40000;
  display: none;
}

.store-body {
  display: grid;
  flex: 1 1 auto;
  gap: 10px;
  grid-template-columns: 170px minmax(0, 1.4fr) minmax(0, 1fr);
  min-height: 0;
  padding: 10px;
  box-shadow: none;
}

/* ---- Sidebar ---- */

.store-sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background-image: url("../png/bg2.png");
  box-shadow: inset 0 0 6px black;
  border: 1px solid black;
  padding: 4px;
}

.store-category-list {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1 1 auto;
  overflow-y: auto;
}

.store-category {
  padding: 5px 6px;
  cursor: pointer;
  border-radius: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.store-category:hover {
  background-color: rgba(255, 255, 255, 0.08);
}

.store-category.selected {
  background-color: rgba(255, 255, 255, 0.22);
  font-weight: bold;
}

.store-category-arrow {
  margin-left: auto;
  opacity: 0.6;
  font-size: 9px;
}

.store-subcategory-list {
  list-style: none;
  margin: 0;
  padding: 0 0 4px 14px;
}

.store-subcategory {
  padding: 3px 6px;
  cursor: pointer;
  border-radius: 2px;
  opacity: 0.85;
}

.store-subcategory:hover {
  background-color: rgba(255, 255, 255, 0.08);
}

.store-subcategory.selected {
  background-color: rgba(255, 255, 255, 0.18);
  opacity: 1;
  font-weight: bold;
}

.store-search-input {
  margin-top: 6px;
  box-sizing: border-box;
  width: 100%;
  color: white;
  background-image: url("../png/bg2.png");
  border: 1px solid black;
  padding: 4px;
}

/* ---- Main item list ---- */

.store-main {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.store-toolbar {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
}

.store-subcategory-select,
.store-sort-select {
  flex: 1 1 auto;
  min-width: 0;
  color: white;
  background-image: url("../png/bg2.png");
  border: 1px solid black;
  padding: 3px 4px;
}

/* The closed select box above picks up color/background from the rule above just fine, but
   the native popup list a browser opens for <option> ignores background-image entirely and,
   left with no background-color of its own, defaults to opaque white -- inheriting this
   modal's white text color on top of that made every unselected row unreadable (white on
   white), which is the "fica em branco" Douglas ran into. background-color/color on <option>
   itself IS respected by the popup even though nothing else about its chrome can be styled. */
.store-subcategory-select option,
.store-sort-select option {
  background-color: #2b2b2b;
  color: #ddd;
}

.store-item-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  background-image: url("../png/bg2.png");
  box-shadow: inset 0 0 6px black;
  border: 1px solid black;
  padding: 2px;
}

.store-item-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px;
  cursor: pointer;
  border-radius: 2px;
}

.store-item-row:hover {
  background-color: rgba(255, 255, 255, 0.08);
}

.store-item-row.selected {
  background-color: rgba(255, 255, 255, 0.22);
}

.store-item-icon {
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  image-rendering: pixelated;
  display: flex;
  align-items: center;
  justify-content: center;
}

.store-item-icon-placeholder {
  width: 56px;
  height: 56px;
  border: 1px solid #222;
  background: linear-gradient(#5e5e5e, #343434);
  border-radius: 3px;
}

/* Premium Time/Blessings/Extras have no in-game sprite of their own (they are services, not
   items) -- these use the real Store icon artwork straight from png/storeicon instead. */
.store-icon-image {
  max-width: 100%;
  max-height: 100%;
  image-rendering: pixelated;
}

.store-item-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.store-item-price {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 3px;
  font-weight: bold;
  color: #f2d675;
}

.store-item-price-unavailable {
  color: #888;
  font-weight: normal;
  font-style: italic;
}

.store-item-price-owned {
  color: #7fd67f;
  font-weight: normal;
  font-style: italic;
}

.store-empty-message {
  padding: 20px;
  text-align: center;
  color: #999;
}

/* ---- Detail panel ---- */

.store-detail {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background-image: url("../png/bg2.png");
  box-shadow: inset 0 0 6px black;
  border: 1px solid black;
  padding: 10px;
  overflow-y: auto;
}

.store-detail-empty {
  margin: auto;
  color: #999;
  text-align: center;
  padding: 20px;
}

.store-detail-icon {
  width: 128px;
  height: 128px;
  margin: 0 auto 8px;
  image-rendering: pixelated;
  display: flex;
  align-items: center;
  justify-content: center;
}

.store-detail-name {
  text-align: center;
  font-weight: bold;
  font-size: 13px;
  margin-bottom: 6px;
}

.store-detail-price {
  text-align: center;
  font-weight: bold;
  color: #f2d675;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-bottom: 10px;
}

.store-detail-bundles {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}

.store-detail-bundle-row {
  display: flex;
  justify-content: space-between;
  padding: 3px 6px;
  border: 1px solid black;
  background-color: rgba(0, 0, 0, 0.2);
  cursor: pointer;
  border-radius: 2px;
}

/* Quantity stepper for Potions/Runes: a plain per-unit price scaled by a whole-number amount
   the player picks with -/+ (1x = one unit batch, 2x = two, ...), rather than the real Store's
   two fixed bulk-discount tiers -- Douglas asked for the simpler linear version. */
.store-detail-stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 10px;
}

.store-detail-stepper-button {
  width: 22px;
  height: 22px;
  padding: 0;
}

.store-detail-stepper-amount {
  min-width: 90px;
  text-align: center;
}

.store-detail-stepper-quantity {
  color: #cfcfcf;
  font-size: 10px;
}

.store-detail-bundle-row:hover {
  background-color: rgba(255, 255, 255, 0.08);
}

.store-detail-bundle-row.selected {
  background-color: rgba(255, 255, 255, 0.2);
}

.store-detail-description {
  font-size: 11px;
  color: #cfcfcf;
  line-height: 1.4;
  margin-bottom: 10px;
}

.store-detail-buy-button {
  margin-top: auto;
  flex-shrink: 0;
}

.store-bundle-preview {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  flex-shrink: 0;
}

.store-bundle-preview .store-item-icon { width: auto; height: auto; }
.store-bundle-promotion { display: flex; justify-content: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.store-bundle-promotion strong { color: #96d99b; }
.store-bundle-promotion s { color: #aaa; }
.store-bundle-contents { margin-bottom: 12px; }
.store-bundle-content { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid #555; }
.store-bundle-content .store-item-icon { width: 40px; height: 40px; }
.store-bundle-content strong { font-size: 11px; overflow-wrap: anywhere; }
.store-bundle-content div div { color: #bbb; font-size: 10px; margin-top: 4px; }
.store-quantity-choices { display: flex; justify-content: center; gap: 0; margin-bottom: 10px; }
.store-quantity-choices button { min-width: 64px; height: 28px; }
.store-quantity-choices button[aria-pressed="true"] { background: #426449; color: #fff; }

body.mobile-layout .store-bundle-preview.store-detail-icon { width: 80px !important; height: 80px !important; }
body.mobile-layout .store-bundle-preview.store-detail-icon canvas { max-width: 40px; max-height: 40px; }
body.mobile-layout .store-bundle-content .store-item-icon { width: 40px; height: 40px; }

.store-inbox-pager { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 3px 5px; flex-shrink: 0; color: #ddd; font-size: 10px; }
.store-inbox-pager span { min-width: 48px; text-align: center; }
.store-inbox-pager button { width: 24px; height: 22px; padding: 0; }
body.mobile-layout .store-inbox-pager button { width: 32px; height: 30px; }

/* ---- Footer ---- */

.store-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-top: 1px solid black;
  background-image: url("../png/bg2.png");
}

.store-balance {
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: bold;
}

.store-coin-icon {
  display: inline-block;
  width: 14px;
  height: 14px;
  background-image: url("../png/storeicon/coin.png");
  background-size: contain;
  background-repeat: no-repeat;
}

.store-footer-buttons {
  display: flex;
  gap: 6px;
}

/* The store's own footer buttons reuse the same two-state gray graphic every other modal
   footer button uses (see modal.css) -- only the layout (row instead of right-aligned block)
   differs here. */
.store-footer .store-footer-buttons button {
  background: url("../png/button_gray.png") no-repeat left center / 200% 100%;
  border: 0;
  box-shadow: none;
  outline: none;
  filter: none;
  height: 24px;
  font-size: 11px;
  color: #ddd;
  padding: 0 10px;
}

.store-footer .store-footer-buttons button:active {
  background: url("../png/button_gray.png") no-repeat right center / 200% 100%;
}

.store-footer .store-footer-buttons button.store-get-button {
  background: url("../png/store/get.png") no-repeat center top / 64px 40px;
  image-rendering: pixelated;
  width: 64px;
  height: 20px;
  padding: 0;
  align-self: center;
}

.store-footer .store-footer-buttons button.store-get-button:active {
  background-position: center bottom;
}

.store-history-title { font-weight: bold; color: #ddd; margin-bottom: 6px; }
.store-history-list { display: flex; flex-direction: column; gap: 4px; overflow-y: auto; min-height: 0; flex: 1; width: 100%; }
.store-history-entry { padding: 4px 6px; border: 1px solid rgba(255, 255, 255, 0.12); background: rgba(0, 0, 0, 0.25); font-size: 11px; }
.store-history-line { display: flex; justify-content: space-between; gap: 6px; }
.store-history-meta { color: #9a9a9a; margin-top: 2px; }
.store-history-paid .store-history-status { color: #7fd97f; }
.store-history-pending .store-history-status, .store-history-review .store-history-status { color: #e6c35c; }
.store-history-failed .store-history-status, .store-history-refunded .store-history-status { color: #d97f7f; }
.store-history-pager { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 6px; }
