/* Popup Content Container */
/* The main popup box with two-column layout and animation effects */
.popup-content {
    color: #333;
    width: 65%;
    max-width: 65%;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    position: relative;
    animation: slideUp 0.5s ease;
    background-image: url(../img/img-lucky-spin/bg.jpg);
    aspect-ratio: 483/242;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-color: #000;
}
/* Wheel Container Styles */
/* Container for the spinning wheel with decorative border and shadow effects */
.wheel-container {
    position: relative;
    box-shadow: 0 0 40px 10px #fff5;
    border-radius: 100%;
    perspective: 1000px;
    width: 100%;
    left: 36px;
    max-width: 400px;
    aspect-ratio: 1 / 1;
    border: 12px solid #08611f;
}

.wheel-container::before {
  content: "";
  position: absolute;
  bottom: -45px;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  height: 30px;
  background: radial-gradient(
    ellipse,
    rgba(19, 13, 17, 0.52) 0%,
    transparent 70%
  );
  border-radius: 50%;
  z-index: -1;
}

/* Canvas Element */
/* Canvas that renders the wheel with smooth transition for spinning animation */
canvas#wheel {
  border-radius: 50%;
  width: 100%;
  height: 100%;
}

/* LED Light Effect */
/* Decorative blinking LED lights around the wheel */
.led {
  position: absolute;
  width: 8px;
  height: 8px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 0 3px white;
  animation: blink 0.5s infinite alternate;
  transform: translate(-50%, -50%);
}

/* LED Blinking Animation */
@keyframes blink {
  0% {
    opacity: 0.2;
  }
  100% {
    opacity: 1;
  }
}

/* Spin Button Styles */
/* Central button to trigger the wheel spin with gradient background and interactive effects */
#spin {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 50px;
  height: 50px;
  background: radial-gradient(circle at center, #11613a, #1b6134);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: inset -2px -4px 8px rgba(0, 0, 0, 0.6),
    0 0 15px rgba(255, 255, 255, 0.4);
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: bold;
  color: white;
  text-align: center;
  border: 2px solid gold;
}

/* Spin Button Arrow Indicator */
/* Creates a golden arrow pointer on the spin button */
#spin::after {
  content: "";
  position: absolute;
  top: 36%;
  right: -47%;
  transform: translateX(-50%) rotate(90deg);
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 14px solid gold;
}

#result {
  margin-top: 20px;
  color: #fff;
  font-size: 18px;
  font-weight: bold;
  text-align: center;
  white-space: pre-line;
}

/* Popup Overlay */
/* Dark semi-transparent overlay that covers the entire viewport when popup is active */
#popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 888;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

#popup.show {
  opacity: 1;
  pointer-events: auto;
}

.title {
  color: white;
}

.sign {
  color: #fff8d6;
  font-size: 36px;
  font-weight: bold;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 2px;
  width: 100%;
  box-sizing: border-box;
  text-shadow: 0 0 4px #fff3b0, 0 0 4px #ffef9f, 0 0 12px #ffe97d;
}

.boxes {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
}

.box {
  background-color: #163f29;
  padding: 20px 30px;
  border-radius: 12px;
  text-align: center;
  min-width: 80px;
  box-shadow: 0 0 15px rgba(0, 255, 100, 0.3);
}

.box h3 {
  margin: 0;
  font-size: 12px;
  color: #ffffff;
}

.box p {
  font-size: 20px;
  font-weight: bold;
  color: #a6ff9e;
  margin: 5px 0 0;
  text-shadow: 0 0 5px #a6ff9e, 0 0 10px #5eff9e;
}

.popup-left {
  padding: 30px 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  position: relative;
  width: 100%;
}

.popup-left {
  color: white;
  min-height: 320px;
}

.popup-right {
  color: #111;
  position: relative;
}

.popup-left h2,
.popup-right h2 {
  margin-bottom: 10px;
}

#closePopup {
  position: absolute;
  top: 16px;
  right: 16px;
  background-color: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  font-size: 22px;
  font-weight: bold;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.25s, transform 0.2s;
  z-index: 88;
}

#closePopup:hover {
  background-color: rgba(255, 255, 255, 0.25);
  transform: scale(1.1);
}

#resultPopup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 88;
  padding: 16px;
  box-sizing: border-box;
}

#resultPopup .popup-content-result {
  background: #ffffff;
  padding: 32px 28px;
  border-radius: 6px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  position: relative;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.15);
  animation: fadeIn 0.4s ease-in-out;
  box-sizing: border-box;
  border: 1px solid #b2dfdb;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Close Button (modern circle style) */
#closeResultPopup {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  background-color: transparent;
  border: 2px solid #00502b;
  color: #00502b;
  border-radius: 50%;
  font-size: 18px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

#closeResultPopup:hover {
  background-color: #00502b;
  color: #ffffff;
  transform: rotate(90deg);
}

/* Prize Text */
#finalPrizeText {
  margin-top: 30px;
  font-size: 16.5px;
  line-height: 1.6;
  color: #00391f;
  background-color: #f1fdf6;
  border: 1px dashed #66bb6a;
  padding: 12px;
  border-radius: 6px;
  font-weight: 500;
  white-space: pre-line;
  word-break: break-word;
  box-shadow: inset 0 0 6px rgba(0, 80, 43, 0.05);
  transition: all 0.3s ease;
}

#finalPrizeText span {
  display: inline-block;
  color: #f3968d;
  font-weight: 600;
  font-size: 18px;
  margin-top: 8px;
}

.instruction-text {
  color: #666;
  font-size: 14px;
  margin-top: -5px;
  margin-bottom: 15px;
}

@keyframes pulseResult {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.03);
  }
}

#finalPrizeText {
  animation: pulseResult 0.6s ease;
}

/* Form Group */
#popupForm .form-group {
  margin-bottom: 10px;
  text-align: left;
}

/* Label */
#popupForm label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  font-weight: 500;
  color: #00502b;
  font-size: 14px;
}

/* Input Field */
#popupForm input {
  width: 95%;
  padding: 12px 15px;
  border-radius: 6px;
  border: 1px solid #a5d6a7;
  font-size: 15px;
  background-color: #ffff;
  outline: none;
  margin: 0;
  transition: border-color 0.3s ease, box-shadow 0.3s;
}

#popupForm input :hover {
  box-shadow: none;
}

#popupForm input:focus {
  border-color: #00502b;
  box-shadow: 0 0 0 2px rgba(0, 80, 43, 0.2);
}

/* Submit Button */
#submitPopupInfo {
  background: linear-gradient(135deg, #00502b, #00704f);
  color: #ffffff;
  padding: 14px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  padding: 5px 0;
  margin-top: 10px;
  cursor: pointer;
  width: 100%;
  transition: background 0.3s ease, transform 0.2s ease;
}

#submitPopupInfo:hover {
  background: linear-gradient(135deg, #004d27, #006644);
  transform: translateY(-2px);
}

canvas#confettiCanvas {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
}

/* Responsive Design */
/* Mobile-first approach with progressive enhancement for larger screens */
@media (max-width: 480px) {
  #resultPopup .popup-content-result {
    padding: 24px 16px;
    max-width: 100%;
    border-radius: 16px;
  }

  #popupForm label {
    font-size: 13px;
  }

  #popupForm input {
    font-size: 14px;
    padding: 10px;
  }

  #submitPopupInfo {
    font-size: 15px;
  }

  #closeResultPopup {
    font-size: 24px;
    top: 10px;
    right: 10px;
  }
}

@media screen and (max-width: 379px) {
  .popup-content {
    width: 90%;
  }

  #resultPopup .popup-content-result {
    width: 100%;
    padding: 20px;
  }

  #resultPopup input,
  #resultPopup button {
    font-size: 14px;
  }
}

@media (max-width: 768px) {
  #popup {
    align-items: center;
    justify-content: center;
    padding: 0;
    box-sizing: border-box;
    overflow-y: auto;
    display: flex;
  }

  #popup.show {
    display: flex;
  }

    .popup-content {
        flex-direction: column;
        max-width: 100%;
        width: 100%;
        background-image: url(../img/img-lucky-spin/bgMobile.jpg);
        background-size: cover; background-position: center;
        height: 90vh;
        min-height: 90vh;
        margin: auto;
        border-radius: 0;
        aspect-ratio: unset;
        display: flex;
        align-items: center;
        justify-content: center;
    }

  .wheel-container {
    max-width: 320px;
    width: 100%;
    aspect-ratio: 1 / 1;
    position: relative;
    box-shadow: 0 0 40px 10px #fff5;
    border-radius: 100%;
    perspective: 1000px;
    margin: 0 auto;
    left: 0;
  }

  .popup-left {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    width: 100%;
    height: 100%;
  }

  .popup-left,
  .popup-right {
    flex: 1 1 100%;
  }

  .popup-left h2,
  .popup-right h2 {
    font-size: 18px;
  }
}

@media (max-width: 380px) {
    .popup-content {
        width: 100%;
        max-width: 100%;
        margin: auto;
        border-radius: 0;
        background-image: url(../img/img-lucky-spin/bgMobile.jpg);
        background-size: contain;
        background-position: center;
        height: 90vh;
        min-height: 90vh;
        display: flex;
        align-items: center;
        justify-content: center;
    }

  #resultPopup .popup-content-result {
    width: 100%;
    max-width: 100%;
    padding: 20px;
    border-radius: 12px;
  }

  .wheel-container {
    max-width: 280px;
    left: 0;
    margin: 0 auto;
  }

  .popup-left {
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
  }

  .popup-right {
    padding: 16px 12px;
    width: 100%;
  }

  #popup .popup-left h2,
  #popup .popup-right h2 {
    font-size: 16px;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(40px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Error Message Styling */
.error-message {
  color: #d32f2f;
  font-size: 15px;
  display: block;
  font-weight: 500;
  transition: all 0.3s ease;
  height: auto;
  opacity: 1;
  padding-left: 5px;
  border-radius: 6px;
  margin-bottom: 10px;
}

#popupForm input.error {
  border-color: #d32f2f;
  background-color: #fff8f8;
  box-shadow: 0 0 0 1px rgba(211, 47, 47, 0.2);
}

/* Success Message Styling */
#successMessage {
  text-align: center;
  animation: fadeIn 0.5s ease;
}

.success-icon {
  margin-bottom: 15px;
}

.success-icon i {
  font-size: 60px;
  color: #4caf50;
  animation: scaleIn 0.5s ease;
}

#successMessage h3 {
  color: #00502b;
  margin-bottom: 10px;
  font-size: 20px;
}

#successMessage p {
    color: #555;
    margin-bottom: 20px;
    line-height: 1.5;
    font-size: 14px;
}

#closeSuccessBtn {
  background: linear-gradient(135deg, #00502b, #00704f);
  color: #ffffff;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.3s ease, transform 0.2s ease;
  margin: 0;
  height: 40px;
  padding: 0 20px;
}

#closeSuccessBtn:hover {
  background: linear-gradient(135deg, #004d27, #006644);
  transform: translateY(-2px);
}

@keyframes scaleIn {
  from {
    transform: scale(0);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* Laptop/Medium Screen Adjustments */
@media (min-width: 769px) and (max-width: 1366px) {
  .popup-content {
    max-width: 60%;
    aspect-ratio: 483/242;
  }

  .wheel-container {
    max-width: 300px;
    left: 35px;
  }

  #spin {
    width: 40px;
    height: 40px;
    font-size: 12px;
  }

  #spin::after {
    top: 36%;
    right: -42%;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 12px solid gold;
  }

  #resultPopup .popup-content-result {
    max-width: 380px;
    padding: 25px 20px;
  }

  .popup-left {
    min-height: 280px;
    padding: 20px 15px;
  }

  /* Ensure popup is centered and fits on screen */
  #popup {
    padding: 10px;
    box-sizing: border-box;
  }

  /* Adjust LED size for laptop */
  .led {
    width: 6px;
    height: 6px;
  }
}

/* Custom Confirmation Dialog */
#confirmDialog {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 16px;
  box-sizing: border-box;
}

.confirm-content {
  background: #ffffff;
  padding: 24px;
  border-radius: 8px;
  max-width: 320px;
  width: 100%;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  animation: fadeIn 0.3s ease;
}

.confirm-content h3 {
  color: #00502b;
  margin-top: 0;
  margin-bottom: 16px;
  font-size: 18px;
}

.confirm-content p {
  color: #333;
  margin-bottom: 24px;
  font-size:14px;
  line-height: 1.5;
}

.confirm-buttons {
  display: flex;
  justify-content: center;
  gap: 16px;
}

.confirm-buttons button {
  padding: 10px 20px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
  border: none;
}

#confirmCancel {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #f1f1f1;
  color: #555;
  margin: 0;
  height: 40px;
  padding: 0 20px;
}

#confirmCancel:hover {
  background-color: #e0e0e0;
}

#confirmOk {
  background: linear-gradient(135deg, #00502b, #00704f);
  color: white;
  margin: 0;
  height: 40px;
  padding: 0 20px;
}

#confirmOk:hover {
  background: linear-gradient(135deg, #004d27, #006644);
  transform: translateY(-2px);
}

@media (max-width: 480px) {
  .confirm-content {
    padding: 20px;
    max-width: 280px;
  }

  .confirm-buttons button {
    padding: 8px 16px;
    font-size: 13px;
  }
}
