/* Default button styles */

#ryviu-reward-button {
  display: none;
  opacity: 0; /* Bắt đầu với opacity = 0 để hiệu ứng fade-in */
  transition: opacity 0.5s ease-in-out; /* Hiệu ứng mượt */
  position: fixed;
  bottom: var(--ryviu-bottom, 20px); /* Per-shop spacing, see loyalty.liquid */
  right: var(--ryviu-side, 20px); /* Per-shop spacing, see loyalty.liquid */
  justify-content: center;
  align-items: center;
  background: var(--ryviu-bg, #333333);
  color: var(--ryviu-color, white);
  border-radius: var(--ryviu-radius, 50px);
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  z-index: 9999;
  transition:
    background-color 0.3s ease,
    color 0.3s ease,
    transform 0.2s ease;
  transform-origin: "top";
}

#ryviu-reward-button.ryviu-button-show {
  display: flex; /* Hiển thị nút, căn giữa nội dung theo cả 2 trục */
  opacity: 1; /* Đặt opacity = 1 để hiện dần */
  /* max-height: 70px; */
}

#ryviu-reward-button:hover {
  background-color: #afafaf;
  transform: scale(1.05);
}

.ryviu-button-wrap {
  display: flex;
  align-items: center;
  padding: 6px 0;
}

/* Adjustments for close button inside the reward button */
.ryviu-button-close {
  display: none;
  line-height: 1;
}

.ryviu-button-content {
  display: flex;
  gap: 6px;
  padding: 0 10px;
  align-items: center;
}

/* Dynamic positioning */
#ryviu-reward-button.bottom-left {
  left: var(--ryviu-side, 20px);
  bottom: var(--ryviu-bottom, 20px);
  right: auto;
}

/* .ryviu-button-wrap defaults to the bottom-position padding (6px 0) above;
   center positions need the wider horizontal padding instead. */
#ryviu-reward-button.center-left .ryviu-button-wrap,
#ryviu-reward-button.center-right .ryviu-button-wrap {
  padding: 5px 15px;
}

/* Icon size is computed per-shop (loyalty.liquid) and passed as --ryviu-icon-size */
.ryviu-reward-icon {
  width: var(--ryviu-icon-size, 24px) !important;
  height: var(--ryviu-icon-size, 24px) !important;
}

.ryviu-reward-close-icon {
  width: 28px !important;
  height: 28px !important;
}

.ryviu-reward-text {
  font-weight: bold;
}

/* Legacy (pre-v3) default button, no per-shop customization */
.ryviu-reward-button-legacy {
  background: #1f1d1d;
  color: #ffffff;
  display: flex;
  justify-content: center;
}

.ryviu-reward-icon-legacy {
  width: 30px !important;
  height: 30px !important;
}

.ryviu-popup-body {
  margin-bottom: 17px;
}

#ryviu-reward-button.center-right {
  top: 50%;
  right: 20px;
  bottom: auto;
  left: auto;
  transform: translate(50%, -50%) rotate(90deg);
  /* border-radius comes from the base rule's --ryviu-radius (computed in
     loyalty.liquid for center positions based on the shop's shape setting) */
}

#ryviu-reward-button.center-left {
  top: 50%;
  left: 20px;
  bottom: auto;
  right: auto;
  transform: translate(-50%, -50%) rotate(-90deg);
  /* border-radius comes from the base rule's --ryviu-radius (computed in
     loyalty.liquid for center positions based on the shop's shape setting) */
}
/* Popover container */
#ryviu-popover {
  border-radius: 10px;
  background: #fff;
  position: fixed;
  bottom: 20px; /* Ban đầu đặt ở dưới */
  right: 20px;
  background-color: white;
  border-radius: 10px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  width: 380px;
  max-width: 100%;
  z-index: 9999;
  opacity: 0; /* Ẩn theo mặc định */
  transform: translateY(15px); /* Dịch chuyển xuống */
  transition:
    opacity 0.2s ease-in-out,
    transform 0.2s ease-in-out;
  display: none; /* Không hiển thị theo mặc định */
  overflow: hidden;
}

/* Trạng thái hiển thị */
#ryviu-popover.show {
  display: block; /* Hiển thị popover */
  opacity: 1; /* Hiển thị hoàn toàn */
  transform: translateY(0); /* Trở lại vị trí ban đầu */
}

/* Bottom Right */
#ryviu-popover.bottom-right {
  bottom: 80px; /* Popover appears above the button */
  right: 20px;
}

/* Bottom Left */
#ryviu-popover.bottom-left {
  bottom: 80px; /* Popover appears above the button */
  left: 20px;
}

/* Center Right */
#ryviu-popover.center-right {
  top: 50%;
  right: 60px; /* Popover appears to the left of the button */
  transform: translateY(-50%);
}

/* Center Left */
#ryviu-popover.center-left {
  top: 50%;
  left: 60px; /* Popover appears to the right of the button */
  transform: translateY(-50%);
}

/* Popover iframe */
#ryviu-popover iframe {
  border: none;
}

/* Popover content */
#ryviu-popover-content {
  padding: 20px;
}

.ryviu-loader {
  width: 48px;
  height: 48px;
  border: 3px solid #d8d8d8;
  border-bottom-color: transparent;
  border-radius: 50%;
  display: inline-block !important;
  box-sizing: border-box;
  animation: rotation 1s linear infinite;
}
@keyframes rotation {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

#ryviu-loader-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  background: #fff; /* Màu nền (tùy chọn) */
}

.ryviu-popup {
  width: 300px;
  font-size: 14px;
  position: fixed;
  bottom: 80px;
  right: 20px;
  z-index: 444;
}

/* Bottom Right */
#ryviu-popup.bottom-right {
  bottom: 80px; /* Popover appears above the button */
  right: 20px;
}

/* Bottom Left */
#ryviu-popup.bottom-left {
  bottom: 80px; /* Popover appears above the button */
  left: 20px;
}

/* Center Right */
#ryviu-popup.center-right {
  top: 50%;
  right: 60px; /* Popover appears to the left of the button */
  transform: translateY(-50%);
}

/* Center Left */
#ryviu-popup.center-left {
  top: 50%;
  left: 60px; /* Popover appears to the right of the button */
  transform: translateY(-50%);
}

.ryviu-popup-content {
  display: flex;
  background-color: #ffffff;
  flex-direction: column;
  padding: 10px 15px;
  gap: 7px;
  text-align: center;
  border-radius: 5px;
  box-shadow:
    0 0 0 1px #3f3f440d,
    0 1px 3px 0 #3f3f4426;
}

#ryviu-popup-heading {
  margin-top: 17px;
}

.ryviu-popup-redeem-btn {
  background-color: #2d2828;
  color: #ffffff;
  border: none;
  padding: 10px;
  border-radius: 3px;
  cursor: pointer;
  font-weight: bold;
}
.ryviu-btn-close-popup {
  position: absolute;
  top: 5px;
  right: 5px;
  background: #eaeaea;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  width: 20px;
  height: 20px;
  color: #25272c;
  font-size: 11px;
  font-weight: bold;
}
