/* Rewards Shop Styles */

#rewardsTabContent {
  scrollbar-width: none;          /* Firefox */
  -ms-overflow-style: none;       /* IE/Edge */
  box-sizing: border-box;
}

#rewardsTabContent::-webkit-scrollbar {
  display: none;                  /* Chrome, Safari, Opera */
}

.rewards-container {
  width: 100%;
  margin: 0 auto;
  padding: 20px;
  padding-bottom: 60px;
  background: transparent;
  box-sizing: border-box;
}

/* Coin Tab in Category Row */
.coin-tab {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%) !important;
  border: 2px solid #fcd34d !important;
  color: #b45309 !important;
  font-weight: 700 !important;
  cursor: default !important;
}

.coin-tab:hover {
  transform: none !important;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%) !important;
}

.coin-tab .coin-lottie {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.coin-tab .coin-lottie lottie-player {
  width: 24px !important;
  height: 24px !important;
}

.coin-tab #rewardsCoinsEarned {
  font-size: 17px;
  font-weight: 700;
  color: #000000;
  min-width: 30px;
  text-align: center;
}

.coin-tab .coin-separator {
  font-size: 17px;
  font-weight: 400;
  color: #9ca3af;
  margin: 0 4px;
}

.coin-tab .wallet-icon {
  width: 19px;
  height: 19px;
  color: #000000;
  flex-shrink: 0;
}

.coin-tab #rewardsCoinBalance {
  font-size: 17px;
  font-weight: 700;
  color: #dc2626;
  min-width: 30px;
  text-align: center;
}

/* Category Tabs */
.rewards-category-tabs {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.category-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  color: #64748b;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.category-tab:hover {
  background: #f1f5f9;
  transform: translateY(-2px);
}

.category-tab.active {
  background: white;
  color: #764ba2;
  border-color: #764ba2;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.category-tab i,
.category-tab svg {
  width: 20px;
  height: 20px;
}

/* Shop Grid */
.rewards-shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 24px;
  padding: 20px;
  box-sizing: border-box;
}

/* Shop Item Card */
.shop-item-card {
  background: white;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Rarity Badge */
.rarity-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  z-index: 2;
}

.rarity-common {
  background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%);
  color: white;
}

.rarity-uncommon {
  background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
  color: white;
}

.rarity-rare {
  background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
  color: white;
}

.rarity-epic {
  background: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 100%);
  color: white;
}

.rarity-legendary {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  color: #78350f;
  box-shadow: 0 2px 8px rgba(251, 191, 36, 0.5);
}

.shop-item-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.shop-item-card.owned {
  border: 3px solid #10b981;
}

.shop-item-card.owned::before {
  content: "Owned";
  position: absolute;
  top: 10px;
  right: 10px;
  background: #10b981;
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.shop-item-preview {
  position: relative;
  height: 140px;
  background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}

.shop-item-image {
  max-width: 60%;
  max-height: 60%;
  object-fit: contain;
}

/* SVG items in preview - limit to 60% of container */
.shop-item-preview svg {
  max-width: 60%;
  max-height: 60%;
  width: auto;
  height: auto;
}

/* Scuba diver preview - taller aspect ratio needs special handling */
.shop-item-preview svg.creature-scuba-diver {
  max-width: 90%;
  max-height: 85%;
  overflow: visible;
}

/* CSS Preview for decorations */
.decoration-css-preview {
  width: 60px;
  height: 60px;
}

/* Rock decoration */
.rock-decoration {
  position: relative;
  width: 50px;
  height: 35px;
  background: linear-gradient(135deg, #78716c 0%, #57534e 100%);
  border-radius: 50% 50% 40% 40%;
}

.rock-decoration::before {
  content: "";
  position: absolute;
  top: -15px;
  left: 10px;
  width: 30px;
  height: 25px;
  background: linear-gradient(135deg, #a8a29e 0%, #78716c 100%);
  border-radius: 50% 50% 40% 40%;
}

/* Coral decoration */
.coral-decoration {
  position: relative;
  width: 40px;
  height: 50px;
}

.coral-decoration::before,
.coral-decoration::after {
  content: "";
  position: absolute;
  bottom: 0;
  width: 10px;
  background: linear-gradient(to top, #f97316, #fb923c);
  border-radius: 5px 5px 0 0;
}

.coral-decoration::before {
  left: 5px;
  height: 40px;
}

.coral-decoration::after {
  right: 5px;
  height: 30px;
}

/* Treasure chest decoration */
.chest-decoration {
  position: relative;
  width: 50px;
  height: 40px;
  background: linear-gradient(135deg, #92400e 0%, #78350f 100%);
  border-radius: 5px;
  border: 2px solid #fbbf24;
}

.chest-decoration::before {
  content: "";
  position: absolute;
  top: -10px;
  left: -2px;
  width: 54px;
  height: 20px;
  background: linear-gradient(135deg, #a16207 0%, #92400e 100%);
  border-radius: 5px 5px 0 0;
  border: 2px solid #fbbf24;
}

.chest-decoration::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 12px;
  height: 10px;
  background: #fcd34d;
  border-radius: 2px;
}

/* Seaweed decoration */
.seaweed-decoration {
  position: relative;
  width: 30px;
  height: 60px;
}

.seaweed-decoration::before,
.seaweed-decoration::after {
  content: "";
  position: absolute;
  bottom: 0;
  width: 8px;
  background: linear-gradient(to top, #15803d, #22c55e);
  border-radius: 4px 4px 0 0;
  animation: seaweedSway 2s ease-in-out infinite;
}

.seaweed-decoration::before {
  left: 3px;
  height: 50px;
  animation-delay: 0s;
}

.seaweed-decoration::after {
  right: 3px;
  height: 35px;
  animation-delay: 0.3s;
}

@keyframes seaweedSway {
  0%, 100% { transform: rotate(-5deg); }
  50% { transform: rotate(5deg); }
}

/* Anchor decoration */
.anchor-decoration {
  width: 40px;
  height: 50px;
  position: relative;
}

.anchor-decoration::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 8px;
  height: 35px;
  background: linear-gradient(135deg, #4b5563 0%, #374151 100%);
  border-radius: 4px;
}

.anchor-decoration::after {
  content: "";
  position: absolute;
  bottom: 5px;
  left: 50%;
  transform: translateX(-50%);
  width: 35px;
  height: 8px;
  background: linear-gradient(135deg, #4b5563 0%, #374151 100%);
  border-radius: 0 0 50% 50%;
}

/* Shell decoration */
.shell-decoration {
  width: 40px;
  height: 35px;
  background: linear-gradient(135deg, #fecaca 0%, #fca5a5 100%);
  border-radius: 50% 50% 0 0;
  position: relative;
}

.shell-decoration::before {
  content: "";
  position: absolute;
  top: 5px;
  left: 5px;
  right: 5px;
  height: 20px;
  background: repeating-linear-gradient(
    90deg,
    transparent,
    transparent 3px,
    rgba(255, 255, 255, 0.5) 3px,
    rgba(255, 255, 255, 0.5) 6px
  );
  border-radius: 50% 50% 0 0;
}

/* Shop Item Info */
.shop-item-info {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-grow: 1;
}

.shop-item-name {
  font-size: 16px;
  font-weight: 700;
  color: #1f2937;
  margin: 0;
}

.shop-item-description {
  font-size: 13px;
  color: #6b7280;
  margin: 0;
  line-height: 1.4;
}

/* Price & Buy Button */
.shop-item-footer {
  padding: 12px 16px;
  background: #f9fafb;
  border-top: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.item-price {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 18px;
  font-weight: 700;
  color: #b45309;
}

.item-price .price-coin {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
}

.item-price .price-coin lottie-player {
  width: 20px;
  height: 20px;
}

.buy-button {
  padding: 8px 20px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.buy-button:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.buy-button:disabled {
  background: #9ca3af;
  cursor: not-allowed;
  transform: none;
}

.buy-button.owned-button {
  background: #9ca3af;
  cursor: default;
}

.buy-button.insufficient {
  background: #ef4444;
}

.buy-button.sign-in-button {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.buy-button.sign-in-button:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  transform: translateY(-1px);
}

/* Sign-in prompt for anonymous users */
#rewardsCoinBalance.sign-in-prompt {
  font-size: 12px;
  min-width: auto;
  white-space: nowrap;
}

/* Showing/Not Showing button states */
.buy-button.showing-button {
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
  cursor: pointer;
}

.buy-button.showing-button:hover {
  background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
  transform: translateY(-1px);
}

.buy-button.not-showing-button {
  background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
  cursor: pointer;
}

.buy-button.not-showing-button:hover {
  background: linear-gradient(135deg, #4b5563 0%, #374151 100%);
  transform: translateY(-1px);
}

/* Empty State */
.rewards-empty-state {
  text-align: center;
  padding: 60px 20px;
  color: white;
}

.rewards-empty-state .empty-icon {
  font-size: 64px;
  margin-bottom: 20px;
}

.rewards-empty-state h3 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 12px;
}

.rewards-empty-state p {
  font-size: 16px;
  opacity: 0.9;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .rewards-container {
    padding: 6px;
    border-radius: 0;
    min-height: calc(100vh - 60px);
  }

  .rewards-header {
    padding: 16px;
    margin-bottom: 16px;
  }

  .coin-balance-display {
    padding: 12px 24px;
  }

  .coin-icon {
    font-size: 24px;
  }

  .coin-amount {
    font-size: 28px;
  }

  .coin-label {
    font-size: 14px;
  }

  .rewards-category-tabs {
    gap: 8px;
  }

  .category-tab {
    padding: 10px 16px;
    font-size: 12px;
  }

  .category-tab span {
    display: none;
  }

  .category-tab i,
  .category-tab svg {
    width: 24px;
    height: 24px;
  }

  .rewards-shop-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 6px;
  }

  .shop-item-preview {
    height: 100px;
  }

  .shop-item-info {
    padding: 12px;
  }

  .shop-item-name {
    font-size: 14px;
  }

  .shop-item-description {
    font-size: 11px;
  }

  .shop-item-footer {
    padding: 10px 12px;
    flex-direction: column;
    gap: 8px;
  }

  .buy-button {
    width: 100%;
  }
}

/* Tablet */
@media (min-width: 769px) and (max-width: 1024px) {
  .rewards-shop-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Purchase Animation */
@keyframes purchaseSuccess {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

.shop-item-card.just-purchased {
  animation: purchaseSuccess 0.5s ease-out;
}

/* Creature Previews */
.creature-css-preview {
  width: 80px;
  height: 60px;
  position: relative;
}

/* Jellyfish */
.jellyfish-creature {
  position: relative;
  width: 50px;
  height: 60px;
}

.jellyfish-creature::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 50px;
  height: 30px;
  background: linear-gradient(135deg, #c4b5fd 0%, #a78bfa 100%);
  border-radius: 50% 50% 30% 30%;
}

.jellyfish-creature::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 10px;
  width: 30px;
  height: 30px;
  background: repeating-linear-gradient(
    180deg,
    transparent,
    transparent 4px,
    #c4b5fd 4px,
    #c4b5fd 6px
  );
  animation: jellyfishFloat 2s ease-in-out infinite;
}

@keyframes jellyfishFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

/* Turtle */
.turtle-creature {
  position: relative;
  width: 60px;
  height: 40px;
}

.turtle-creature::before {
  content: "";
  position: absolute;
  top: 5px;
  left: 10px;
  width: 40px;
  height: 30px;
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  border-radius: 50% 50% 40% 40%;
  border: 2px solid #15803d;
}

.turtle-creature::after {
  content: "";
  position: absolute;
  top: 12px;
  left: 0;
  width: 15px;
  height: 12px;
  background: #86efac;
  border-radius: 50%;
}

/* Submarine */
.submarine-creature {
  position: relative;
  width: 70px;
  height: 35px;
}

.submarine-creature::before {
  content: "";
  position: absolute;
  top: 10px;
  left: 0;
  width: 60px;
  height: 25px;
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  border-radius: 15px;
}

.submarine-creature::after {
  content: "";
  position: absolute;
  top: 0;
  left: 20px;
  width: 20px;
  height: 15px;
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  border-radius: 5px 5px 0 0;
}

/* Background Previews */
.background-preview-thumbnail {
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
}

.bg-coral-reef {
  background: linear-gradient(to bottom, #38bdf8 0%, #0ea5e9 50%, #f97316 100%);
}

.bg-deep-ocean {
  background: linear-gradient(to bottom, #1e3a8a 0%, #1e40af 50%, #0c4a6e 100%);
}

.bg-sunset {
  background: linear-gradient(to bottom, #f97316 0%, #fb923c 30%, #38bdf8 100%);
}

.bg-night {
  background: linear-gradient(to bottom, #0f172a 0%, #1e293b 50%, #334155 100%);
  position: relative;
}

.bg-night::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: radial-gradient(white 1px, transparent 1px);
  background-size: 20px 20px;
  opacity: 0.3;
}

/* ========================================
   REWARDS TAB SWIMMING FISH BACKGROUND
   ======================================== */

.rewards-fish-container {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

/* Fish base styling (from aquarium/win-modal) */
.rewards-swimming-fish {
  position: absolute;
  width: 50px;
  height: 22px;
  border-radius: 50% 35% 35% 50% / 60% 45% 45% 60%;
  display: flex;
  align-items: center;
  justify-content: center;
  --fish-hue: 200;
  --fish-saturation: 70%;
  --fish-lightness: 60%;
  background-image: linear-gradient(
    to bottom,
    hsl(var(--fish-hue), var(--fish-saturation), var(--fish-lightness)),
    hsl(var(--fish-hue), var(--fish-saturation), calc(var(--fish-lightness) + 20%))
  );
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  opacity: 0.4;
  animation: rewardsFishSwim 12s linear infinite;
}

/* Fish tail */
.rewards-swimming-fish::before {
  content: "";
  position: absolute;
  right: -16px;
  top: 50%;
  width: 16px;
  height: 18px;
  background-color: hsl(var(--fish-hue), var(--fish-saturation), var(--fish-lightness));
  filter: brightness(0.8);
  clip-path: polygon(0% 50%, 100% 10%, 80% 50%, 100% 90%);
  transform: translateY(-50%);
  transform-origin: 0% 50%;
  animation: rewardsFishTailWag 0.5s ease-in-out infinite;
}

/* Dorsal fin */
.rewards-swimming-fish::after {
  content: "";
  position: absolute;
  top: -5px;
  left: 40%;
  width: 12px;
  height: 8px;
  background-color: hsl(var(--fish-hue), var(--fish-saturation), var(--fish-lightness));
  filter: brightness(0.9);
  clip-path: polygon(0% 100%, 50% 0%, 100% 100%);
  animation: rewardsFishFinSway 1s ease-in-out infinite alternate;
}

/* Fish eye */
.rewards-fish-eye {
  position: absolute;
  left: 15%;
  top: 35%;
  width: 6px;
  height: 6px;
  background: white;
  border-radius: 50%;
  box-shadow: inset 2px 0 0 1px #333;
}

/* Different fish colors and positions */
.rewards-swimming-fish.fish-1 {
  --fish-hue: 200;
  top: 20%;
  animation-duration: 14s;
  animation-delay: 0s;
}

.rewards-swimming-fish.fish-2 {
  --fish-hue: 280;
  top: 50%;
  width: 40px;
  height: 18px;
  animation-duration: 10s;
  animation-delay: -4s;
}

.rewards-swimming-fish.fish-3 {
  --fish-hue: 30;
  top: 75%;
  width: 45px;
  height: 20px;
  animation-duration: 16s;
  animation-delay: -8s;
}

/* Swimming animation - fish swims from right to left */
@keyframes rewardsFishSwim {
  0% {
    left: 110%;
    transform: translateY(0);
  }
  25% {
    transform: translateY(-8px);
  }
  50% {
    transform: translateY(0);
  }
  75% {
    transform: translateY(8px);
  }
  100% {
    left: -15%;
    transform: translateY(0);
  }
}

/* Tail wagging animation */
@keyframes rewardsFishTailWag {
  0%, 100% {
    transform: translateY(-50%) rotateZ(-12deg);
  }
  50% {
    transform: translateY(-50%) rotateZ(12deg);
  }
}

/* Fin sway animation */
@keyframes rewardsFishFinSway {
  0% {
    transform: rotateZ(-3deg);
  }
  100% {
    transform: rotateZ(3deg);
  }
}
