.item-page {
  width: 100%;
  padding: 40px 0;
}

.costume-image-menu-button {
  position: absolute;
  top: 10px;
  right: 10px;
  cursor: pointer;
  z-index: 10;
  user-select: none;
  transition: transform 0.3s ease;
}

.costume-image-menu-button.active {
  transform: rotate(45deg);
}

.costume-image-menu-button img {
  width: 24px;
  height: 24px;
}

.costume-image-menu-content {
  position: absolute;
  top: 40px;
  right: 10px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  padding: 10px;
  border-radius: 5px;
  z-index: 11;
  display: flex;
  flex-direction: column;
  gap: 5px;
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.costume-image-menu-content.hidden {
  display: none;
}

.costume-image-menu-content.show {
  display: flex;
  opacity: 1;
  transform: scale(1);
}

.costume-image-menu-option {
  cursor: pointer;
  padding: 5px;
  transition: background 0.2s ease;
}

.costume-image-menu-option:hover {
  color: var(--ast-global-color-1);
}

.similar-items {
  margin: 40px 0;
  text-transform: uppercase;
}

.item-container {
  display: flex;
  flex-wrap: nowrap; /* Prevent wrapping */
  justify-content: space-between; /* Ensure space is distributed between the two columns */
  align-items: stretch; /* Make both columns fill the height equally */
  width: 100%; /* Ensure the container fills the full width of the page */
  max-width: 1200px; /* Optional: Limit the container's width for readability */
  margin: 0 auto; /* Center the container horizontally */
  gap: 20px; /* Add space between image and content */
}

.item-content-wrapper {
  text-align: center;
  text-align: center;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.item-image {
  flex: 1; /* 50% width of the container */
  display: flex;
  justify-content: center; /* Center the image horizontally */
  align-items: center; /* Center the image vertically */
  position: relative; /* Allows the theme overlay to be positioned within the container */
  box-sizing: border-box; /* Include padding in width calculations */
  border-radius: 8px;
  width: 100%;
  height: auto;
}

.item-image img,
.item-image picture {
  height: auto; /* Maintain aspect ratio */
  display: block; /* Ensure the image lays out properly */
}

.item-image.img-type-nameplate img {
  padding: 5px;
}

.item-image.img-type-costume img,
.item-image.img-type-costume picture {
  max-height: 570px;
}

.item-image.img-type-mvp picture {
  display: block; /* Ensure Safari handles <picture> correctly */
  width: 100%;
  height: 100%; /* Let <img> handle the size */
}

.item-image canvas {
  max-width: 100%;
  max-height: 570px;
}

/* CSS for the new image toolbar */
.rs-item-media-section {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 200px;
  width: 100%;
  text-align: -webkit-center;
}

.rs-toolbar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 10px;
  justify-content: center;
  background: transparent;
  height: 60px;
}

.rs-view-btn {
  appearance: none;
  border: none;
  background: none;
  padding: 8px 2px;
  margin: 0;
  font: inherit;
  color: #cfcfcf;
  letter-spacing: 0.2px;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: border-color 0.15s ease, color 0.15s ease, opacity 0.15s ease;
  box-shadow: none;
}

.rs-view-btn:hover,
.rs-view-btn:focus,
.rs-view-btn:focus-visible {
  color: #ffffff;
  outline: none;
  background: transparent;
}

.rs-view-btn.is-active {
  color: #ffffff;
  border-bottom-color: var(--accent);
  font-weight: 700;
}

/* Disabled tab (still shows tooltip via title attr) */
.rs-view-btn.is-disabled {
  cursor: not-allowed;
  opacity: 0.5;
  border-bottom-color: transparent;
  text-decoration: line-through;
}

.rs-toolbar .rs-download-btn {
  position: absolute;
  right: 8px;
  top: 8px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  backdrop-filter: blur(4px);
  text-decoration: none;
  opacity: 0.9;
  z-index: 5;
}

@media (max-width: 400px) {
  .rs-toolbar.rs-toolbar-wide .rs-download-btn {
    position: relative;
    right: unset;
    top: unset;
    transform: unset;
  }
}

.rs-stage {
  position: relative;
  z-index: 1;
  margin: auto 0;
  padding-bottom: 40px; /* height of .rs-toolbar minus 20px to make it seem more centered */
}

/* set default costume image to start from bottom */
.item-image.img-type-costume .rs-stage[data-active="costume"] {
  padding: 0;
  margin: 0;
  margin-top: auto;
}

.item-image.img-type-costume .rs-stage[data-active="costume"] img {
  border-radius: 6px;
}

.item-image.img-type-mvp .rs-stage[data-active="lastframe"] img {
  width: 100%;
}

.share-button {
  position: absolute;
  bottom: 20px;
  right: 20px;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 5px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  cursor: pointer;
}

.share-button img {
  width: 20px;
  height: 20px;
  margin-bottom: -2px;
}

.share-button:hover {
  opacity: 0.9;
}

.item-details {
  flex: 1; /* 50% width of the container */
  display: flex;
  position: relative;
  flex-direction: column; /* Stack content vertically */
  justify-content: start;
  padding: 20px;
  box-sizing: border-box; /* Include padding in width calculations */
  color: #fff;
  background: var(--ast-global-color-8);
  border-radius: 8px; /* Optional: Add rounded corners */
  min-height: 200px;
}

.back-button-desktop {
  position: absolute;
  top: 22px;
  right: 20px;
  font-size: 18px;
}

.back-button-mobile {
  display: none;
  font-size: 18px;
}

.item-name,
.item-meta,
.item-collection,
.item-description {
  margin-bottom: 5px;
}

.item-name {
  font-size: 1.8rem;
  font-weight: bold;
}

.item-name,
.item-meta,
.item-collection {
  text-transform: uppercase;
}

.item-page-link {
  color: #fff;
  text-decoration: none;
}

.item-page-link:hover {
  color: #ffd700;
  text-decoration: underline;
}

.item-meta,
.item-meta-type {
  display: inline-flex;
  align-items: center;
}

.item-meta-type img {
  height: 24px;
  width: 24px;
  margin-right: 2px;
  margin-left: -2px;
}

.item-collection {
  display: flex;
  align-items: center;
}

.item-collection img {
  width: 24px;
  height: 24px;
  margin-right: 4px;
}

.item-description {
  color: white;
  opacity: 0.8;
}

.read-more-link {
  color: #0073aa;
  text-decoration: underline;
  cursor: pointer;
  font-size: 0.95em;
}
.read-more-link:hover {
  color: #005177;
}

.item-appears-in {
  font-style: italic;
  color: white;
  opacity: 0.8;
}

/* Container for price and time sections */
.price-time-container {
  display: flex;
  align-items: stretch; /* Ensures both items are the same height */
  gap: 16px; /* Space between price and time boxes */
}

/* Container for time-remaining */
.time-remaining {
  display: flex;
  align-items: center;
  justify-content: center; /* Center content horizontally */
  gap: 5px;
  padding: 8px 12px;
  margin-top: 20px;
  border-radius: 8px;
  width: fit-content;
  border: 1px solid var(--ast-global-color-1);
  font-weight: bold;
  font-size: 14px;
}

/* Style for last-seen */
.time-remaining.last-seen {
  color: #d91717;
  border: 1px solid #d91717;
}

/* Original Price Section */
.item-price {
  display: flex;
  align-items: center;
  background-color: #ffd700; /* Gold-ish background for price */
  padding: 5px;
  border-radius: 8px;
  margin-top: 20px;
  padding-right: 20px;
  width: max-content;
  cursor: pointer;
}

.item-price-wrapper {
  position: relative;
}

.tooltip {
  position: absolute;
  top: -15px;
  background-color: #fff;
  color: #333;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 14px;
  white-space: nowrap;
  box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
  display: none; /* Hidden by default */
  z-index: 10;
}

.item-price.active + .tooltip {
  display: block; /* Show tooltip when item-price is active */
}

.price-icon img {
  width: 50px;
  height: 50px;
  margin-right: 5px;
}

.price-discounted {
  font-size: 28px;
  font-weight: bold;
  color: red;
  margin-bottom: -2px;
}

.price-original {
  font-size: 18px;
  color: #999;
  margin-left: 10px;
  text-decoration: line-through;
  margin-bottom: -8px;
}

.price-normal {
  font-size: 28px;
  font-weight: bold;
  color: #333;
  margin-bottom: -2px;
}

/* Bundle Link */
.bundle-link {
  margin-top: 10px;
}

.bundle-link a {
  display: inline-block;
  padding: 10px 15px;
  background-color: #ffd700; /* Yellow background for consistency with price section */
  color: #333;
  text-decoration: none;
  border-radius: 8px;
  font-weight: bold;
}

.bundle-link a:hover {
  background-color: #ffc107;
}

.bundle-section {
  margin-top: 20px;
  text-align: left;
  text-transform: uppercase;
}

.bundle-header {
  font-size: 1.2rem;
  font-weight: bold;
  margin-bottom: 10px;
  color: #fff; /* Adjust color as needed */
}

table,
td,
th,
tr {
  border: unset !important;
}

/* Details Table */
.item-details-table th {
  opacity: 0.9;
}

.item-details-table th,
.item-details-table td {
  padding: 0;
  text-align: left;
  vertical-align: top;
}

.item-details-table th {
  width: 115px;
  min-width: 115px;
}

/* Add spacing below the Source Information row */
.source-information-row td {
  padding-bottom: 10px;
  opacity: 0.8;
  text-align: left; /* Align text to the left */
  font-style: italic; /* Optional: Different style to distinguish the row */
}

.item-details-marvel-id th,
.item-details-marvel-id td {
  padding-top: 10px;
}

/* Wishlist / Locker buttons */
.user-collection-buttons {
  display: flex;
  gap: 10px;
  margin-top: auto;
}

.user-collection-buttons button {
  background: #fff;
  color: #000;
  padding: 8px 10px;
  font-weight: bold;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 0.3s ease; /* Only color changes on hover */
  border: none;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.2), 0 2px 4px rgba(0, 0, 0, 0.2);
}

.user-collection-buttons button:hover {
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.3), 0 4px 8px rgba(0, 0, 0, 0.3);
}

/* Font size for desktop */
@media (min-width: 700px) {
  .user-collection-buttons button {
    font-size: 20px;
  }
}

/* Font size for mobile */
@media (max-width: 699px) {
  .user-collection-buttons button {
    font-size: 16px;
  }
  .user-collection-buttons {
    margin-bottom: 60px;
  }
  .share-button {
    bottom: 10px;
    right: 10px;
  }
}

/* Wishlist hover effect */
.user-collection-buttons .wishlist-btn:hover {
  color: #4caf50; /* Green text */
}

/* Locker hover effect */
.user-collection-buttons .locker-btn:hover {
  color: #4caf50; /* Green text */
}

/* Default Green Add Icon */
.collection-icon {
  color: #4caf50; /* ✅ Always green for adding */
  margin-bottom: 2px;
}

/* Removed item button styling */
.user-collection-buttons .remove-from-collection {
  background: #fff;
  color: #000;
}

/* ✅ Icon turns red for removal */
.user-collection-buttons .remove-from-collection .collection-icon {
  color: #e74c3c;
}

/* ✅ Only text color changes on hover for remove */
.user-collection-buttons .remove-from-collection:hover {
  color: #e74c3c;
}

/* Responsive Layout for Desktop */
@media (min-width: 969px) {
  .item-name,
  .item-meta,
  .item-collection {
    padding-right: 50px;
  }
}

/* Responsive Layout for Mobile */
@media (max-width: 968px) {
  .back-button-desktop {
    display: none;
  }
  .back-button-mobile {
    display: block;
  }

  .item-container {
    flex-direction: column; /* Stack image and details vertically */
  }

  .item-image,
  .item-details {
    max-width: 100%; /* Full width for both image and details */
  }

  .tooltip {
    font-size: 12px;
    top: -12px;
  }

  .item-details-table {
    margin-bottom: 40px;
  }

  .item-details-table th {
    width: 105px;
    min-width: 105px;
  }

  .price-time-container:has(.time-remaining.last-seen),
  .page-template-bundle-template .price-time-container {
    flex-direction: column; /* Stack elements */
  }

  .remaining-time .remaining-time-text {
    display: none;
  }

  .page-template-bundle-template .remaining-time span {
    display: inline-block;
  }

  .time-remaining.last-seen,
  .page-template-bundle-template .time-remaining {
    margin-top: 5px;
  }

  .similar-items h2 {
    text-align: center;
  }

  .rs-stage {
    padding-bottom: 20px;
  }
}
