/* ============================================
   FORTUNE WHEEL - b4glass Native Styles
   Glassmorphism Design System
   ============================================ */

/* === Variables & Layout === */
.deal-wheel {
  --size: clamp(250px, 65vmin, 600px);
  position: relative;
  display: grid;
  grid-gap: calc(var(--size) / 20);
  align-items: center;
  grid-template-areas: "spinner" "trigger";
  font-family: var(--font-body);
  font-size: calc(var(--size) / 21);
  line-height: 1;
  text-transform: lowercase;
  margin-top: 100px;
}

.deal-wheel > * {
  grid-area: spinner;
}

.deal-wheel .btn-spin {
  grid-area: trigger;
  justify-self: center;
}

/* === Wheel Container === */
.wheel-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.wheel-block {
  position: relative;
}

.wheel-bg {
  position: absolute;
  text-align: center;
  width: var(--size);
  height: var(--size);
  scale: 1.1;
}

/* === Spinner (Wheel) === */
.spinner {
  transition: transform 1s ease-out;
  position: relative;
  display: grid;
  align-items: center;
  grid-template-areas: "spinner";
  width: var(--size);
  height: var(--size);
  transform: rotate(calc(var(--rotate, 25) * 1deg));
  border-radius: 50%;
  box-shadow: inset 0 0 0 calc(var(--size) / 40) rgba(0, 0, 0, 0.1),
              0 20px 50px rgba(0, 0, 0, 0.35);
}

.spinner * {
  grid-area: spinner;
}

.spinner.is-spinning {
  animation: start-rotate 4s infinite;
}

@media only screen and (max-width: 600px) {
  .spinner.is-spinning {
    animation: none;
  }
}

@keyframes start-rotate {
  0% { transform: rotate(915deg); }
  50% { transform: rotate(935deg); }
  100% { transform: rotate(915deg); }
}

.is-spinning .spinner {
  transition: transform 12s cubic-bezier(0.1, -0.01, 0, 1);
}

/* === Prize Sectors === */
.prize {
  position: relative;
  display: flex;
  align-items: center;
  width: 50%;
  height: 50%;
  transform-origin: center right;
  transform: rotate(var(--rotate));
  user-select: none;
  background: url(/templates/default/img/fortune_wheel/stars.png) no-repeat center;
}

.icon__money {
  max-width: 30px;
  box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.5);
  border-radius: 50%;
  margin-left: 10px;
}

.icon__money.spin {
  animation: icon-spin 1s linear;
}

@keyframes icon-spin {
  from { transform: rotateY(0deg); }
  to { transform: rotateY(360deg); }
}

.text__wheel {
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
  width: calc(var(--size) / 4);
  text-align: center;
  transform: rotate(180deg);
  font-size: 22px;
}

.prize.selected .text__wheel {
  color: white;
  animation: selected 800ms ease;
}

@keyframes selected {
  25% {
    transform: scale(1.25);
    text-shadow: 1vmin 1vmin 0 rgba(0, 0, 0, 0.1);
  }
  40% {
    transform: scale(0.92);
    text-shadow: 0 0 0 rgba(0, 0, 0, 0.2);
  }
  60% {
    transform: scale(1.02);
    text-shadow: 0.5vmin 0.5vmin 0 rgba(0, 0, 0, 0.1);
  }
  75% { transform: scale(0.98); }
  85% { transform: scale(1); }
}

.pulse-animation {
  animation: pulse 1s ease-out;
  animation-iteration-count: 2;
  animation-fill-mode: forwards;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1) rotate(180deg);
    color: initial;
  }
  50% {
    transform: scale(1.5) rotate(180deg);
    color: var(--action-1);
  }
}

/* === Ticker (Pointer) === */
.ticker {
  position: absolute;
  top: 43%;
  right: -65px;
  width: 140px;
  height: 140px;
  transform: rotate(90deg);
  background: url(/templates/default/img/fortune_wheel/tooth.png) no-repeat;
  pointer-events: none;
  z-index: 10;
}

/* === Spin Button === */
.btn-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 26%;
  height: 25%;
  z-index: 5;
}

.btn-spin {
  /* Yellow button with image background */
  background: url(/templates/default/img/fortune_wheel/spin-yellow.png) no-repeat center;
  background-size: cover;
  
  border: none;
  border-radius: 50%;
  
  box-shadow: 
    0 20px 40px rgba(0, 0, 0, 0.4),
    0 4px 12px rgba(251, 238, 57, 0.3);
  
  width: 100%;
  height: 100%;
  color: #fff;
  font-size: 1em;
  font-weight: 600;
  text-transform: uppercase;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
  
  cursor: pointer;
  transition: all 0.3s ease;
  
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-spin:hover:not(:disabled) {
  transform: scale(1.1);
  box-shadow: 
    0 24px 50px rgba(0, 0, 0, 0.5),
    0 6px 20px rgba(251, 238, 57, 0.5);
}

.btn-spin:active:not(:disabled) {
  transform: scale(0.98);
  box-shadow: 
    0 10px 20px rgba(0, 0, 0, 0.3),
    inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.btn-spin:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  filter: grayscale(0.5);
}

/* === Wheel Layout === */
.wheel__desc-block {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 60px;
  padding: 0 34px;
}

.wheel-flex {
  display: flex;
  flex-direction: column;
  margin-left: 50px;
  gap: 32px;
}

.wheel-text {
  margin-top: 70px;
  text-align: center;
}

.wheel-text h3 {
  font-size: 33px;
  color: var(--text);
  margin: 0 0 12px 0;
}

.wheel-text h1 {
  font-size: 100px;
  text-align: center;
  color: var(--action-1);
  margin: 0;
  text-shadow: 0 4px 12px var(--action-shadow);
}

.wheel-text p {
  font-size: 22px;
  color: var(--text-dim);
  margin: 8px 0 0 0;
}

.wheel-rise {
  text-align: center;
  color: var(--text);
  font-size: 28px;
  margin: 24px 0;
}

.wheel-freespins {
  transition: opacity 0.3s ease;
}

.wheel-freespins.hide {
  display: none !important;
}

/* === Bid Table (Boost Chances) === */
.wheel-table {
  margin-top: 20px;
}

.wheel-table__title {
  text-align: center;
  margin-bottom: 16px;
  font-size: 33px;
  color: var(--text);
}

.wheel-table__blocks {
  /* Glassmorphism container with yellow tint */
  background: linear-gradient(135deg,
    rgba(251, 238, 57, 0.15) 0%,
    rgba(250, 204, 21, 0.10) 100%);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  
  border: 1px solid rgba(251, 238, 57, 0.25);
  border-radius: var(--radius-md);
  
  box-shadow: 
    0 16px 40px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  
  padding: 20px;
  width: 330px;
  margin: 0 auto;
}

.wheel-table__inner {
  display: flex;
  flex-wrap: wrap;
  border-radius: var(--radius-sm);
  overflow: hidden;
  gap: 2px;
}

.wheel-table__block {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  gap: 15px;
  color: #fff;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
  transition: all 0.3s ease;
  flex: 1 1 100%;
  cursor: pointer;
  border-radius: 8px;
  min-height: 60px;
}

.wheel-table__block:hover {
  opacity: 0.9;
  transform: translateX(4px);
}

/* Sector colors with glassmorphism */
.wheel-table__block:nth-child(7n + 1) {
  background: linear-gradient(135deg, rgba(216, 4, 0, 0.9), rgba(180, 3, 0, 0.8));
}
.wheel-table__block:nth-child(7n + 2) {
  background: linear-gradient(135deg, rgba(255, 91, 91, 0.9), rgba(220, 70, 70, 0.8));
}
.wheel-table__block:nth-child(7n + 3) {
  background: linear-gradient(135deg, rgba(126, 97, 255, 0.9), rgba(100, 75, 220, 0.8));
}
.wheel-table__block:nth-child(7n + 4) {
  background: linear-gradient(135deg, rgba(149, 225, 211, 0.9), rgba(120, 200, 180, 0.8));
}
.wheel-table__block:nth-child(7n + 5) {
  background: linear-gradient(135deg, rgba(179, 179, 244, 0.9), rgba(150, 150, 220, 0.8));
}
.wheel-table__block:nth-child(7n + 6) {
  background: linear-gradient(135deg, rgba(201, 201, 201, 0.9), rgba(170, 170, 170, 0.8));
}
.wheel-table__block:nth-child(7n + 7) {
  background: linear-gradient(135deg, rgba(244, 179, 179, 0.9), rgba(220, 150, 150, 0.8));
}

.wheel-table__checkbox {
  display: none !important;
}

.wheel-table__text {
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 18px;
  font-weight: 600;
}

.wheel-table__text.gold {
  color: var(--action-1) !important;
  text-shadow: 0 0 10px rgba(251, 238, 57, 0.6) !important;
  transform: scale(1.05);
}

.boost-percent {
  transition: all 0.3s ease;
}

.wheel-table__checkbox:checked ~ * .boost-percent {
  background: var(--action-1);
  color: var(--action-text);
  padding: 4px 10px;
  border-radius: 6px;
  font-weight: 700;
  transform: scale(1.1);
  box-shadow: 0 0 12px rgba(251, 238, 57, 0.6);
}

/* === Modals (Glassmorphism) === */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  
  display: none !important;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeInOverlay 0.3s ease-out;
  padding: 20px;
}

.modal:not(.hidden) {
  display: flex !important;
}

.modal.hidden {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

@keyframes fadeInOverlay {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Modal Content - Pure Glassmorphism */
.modal__content {
  position: relative;
  
  /* High transparency + strong blur */
  background: linear-gradient(135deg,
    var(--glass-grad-1),
    var(--glass-grad-2));
  backdrop-filter: blur(calc(var(--blur) * 3)) saturate(var(--material-saturation));
  -webkit-backdrop-filter: blur(calc(var(--blur) * 3)) saturate(var(--material-saturation));
  
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  
  padding: 32px 24px;
  min-width: 320px;
  max-width: 480px;
  text-align: center;
  animation: glassSlideIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

@keyframes glassSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Glass reflection */
.modal__content::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(180deg,
    rgba(255, 255, 255, 0.1) 0%,
    transparent 100%);
  pointer-events: none;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.modal-wheel__title {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 20px 0;
  line-height: 1.3;
  position: relative;
  z-index: 1;
}

.modal-wheel__content:not(.modal-wheel__error) .modal-wheel__title::before {
  content: '🎉';
  display: inline-block;
  margin-right: 8px;
  font-size: 32px;
}

.modal-wheel__img {
  max-width: 140px;
  max-height: 140px;
  margin: 0 auto 20px;
  display: block;
  filter: drop-shadow(0 6px 20px rgba(0, 0, 0, 0.3));
  position: relative;
  z-index: 1;
}

.modal-wheel__img.modal-img__block {
  opacity: 0.5;
  filter: grayscale(100%) drop-shadow(0 4px 16px rgba(0, 0, 0, 0.2));
}

/* Error state */
.modal-wheel__error {
  border: 1px solid rgba(248, 113, 113, 0.3) !important;
}

.modal-wheel__error .modal-wheel__title::before {
  content: '⚠️';
  font-size: 28px;
}

/* Close button */
.modal__close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  
  display: flex;
  align-items: center;
  justify-content: center;
  
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.15);
  
  font-size: 24px;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  
  transition: all 0.3s ease;
  z-index: 10;
}

.modal__close:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--glass-highlight);
  color: var(--text);
  transform: rotate(90deg);
}

.modal__close:active {
  transform: rotate(90deg) scale(0.9);
}

/* Timer Modal */
.modal-again__content {
  background: linear-gradient(135deg,
    var(--glass-grad-1),
    var(--glass-grad-2));
  backdrop-filter: blur(calc(var(--blur) * 3)) saturate(var(--material-saturation));
  -webkit-backdrop-filter: blur(calc(var(--blur) * 3)) saturate(var(--material-saturation));
  
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  
  animation: glassSlideIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-again__title {
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 20px 0;
  position: relative;
  z-index: 1;
}

.modal-again__title::before {
  content: '⏰';
  display: inline-block;
  margin-right: 8px;
  font-size: 26px;
}

.modal-again__timer {
  display: block;
  font-size: 56px;
  font-weight: 300;
  color: var(--text);
  margin: 20px 0;
  font-family: var(--font-mono);
  letter-spacing: 4px;
  position: relative;
  z-index: 1;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.modal__btn {
  margin-top: 20px;
  padding: 12px 32px;
  
  background: linear-gradient(135deg, 
    rgba(var(--tint-color), 0.3),
    rgba(var(--tint-color), 0.2));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  
  border: 1px solid rgba(var(--tint-color), 0.4);
  border-radius: var(--radius-sm);
  
  box-shadow:
    0 8px 20px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  
  cursor: pointer;
  transition: all 0.3s ease;
}

.modal__btn:hover {
  background: linear-gradient(135deg, 
    rgba(var(--tint-color), 0.4),
    rgba(var(--tint-color), 0.3));
  border-color: rgba(var(--tint-color), 0.6);
  transform: translateY(-2px);
  box-shadow:
    0 12px 28px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.modal__btn:active {
  transform: translateY(0);
}

/* === Responsive Design === */
@media (max-width: 1090px) {
  .wheel__desc-block {
    display: block;
    padding: 0;
  }
  
  .wheel-flex {
    margin-left: 0;
  }
  
  .modal__content {
    max-width: 90vw;
  }
}

@media (max-width: 768px) {
  .ticker {
    top: 39%;
    right: -50px;
    transform: rotate(90deg) scale(0.8);
  }
  
  .text__wheel {
    font-size: 19px;
  }
  
  .modal {
    padding: 15px;
  }
  
  .modal__content {
    padding: 24px 20px;
    min-width: 280px;
    border-radius: var(--radius-sm);
  }
  
  .modal-wheel__title {
    font-size: 24px;
    margin-bottom: 16px;
  }
  
  .modal-wheel__img {
    max-width: 120px;
    max-height: 120px;
    margin: 8px auto 16px;
  }
  
  .modal-again__timer {
    font-size: 40px;
    margin: 16px 0;
  }
  
  .modal__close {
    width: 36px;
    height: 36px;
    top: 12px;
    right: 12px;
    font-size: 20px;
  }
}

@media (max-width: 680px) {
  .wheel-table__block {
    width: 100%;
  }
  
  .btn-spin {
    font-size: 14px !important;
  }
  
  .btn-container {
    width: 100px;
    height: 100px;
  }
  
  .wheel-table__blocks {
    width: 90%;
  }
}

@media (max-width: 600px) {
  .text__wheel {
    font-size: 15px;
  }
  
  .icon__prize {
    max-width: 18px;
  }
}

@media (max-width: 500px) {
  .prize {
    background-position: 48%;
  }
  
  .icon__prize {
    max-width: 10px;
  }
  
  .ticker {
    top: 37%;
  }
  
  .btn-container {
    width: 80px;
    height: 80px;
  }
  
  .text__wheel {
    font-size: 12px;
  }
}

@media (max-width: 400px) {
  .ticker {
    top: 35%;
  }
  
  .modal__content {
    width: 95%;
  }
}

/* === Accessibility === */
@media (prefers-reduced-motion: reduce) {
  .spinner,
  .modal__content,
  .btn-spin {
    animation: none !important;
    transition: none !important;
  }
}

@media (prefers-contrast: more) {
  .modal__content,
  .wheel-table__blocks,
  .btn-spin {
    border-width: 2px;
    border-color: rgba(255, 255, 255, 0.4);
  }
}
