@tailwind base;
@tailwind components;
@tailwind utilities;

@layer base {
  html {
    scroll-behavior: smooth;
    overflow-x: hidden;
    overflow-y: auto;
    width: 100%;
    max-width: 100vw;
    height: 100%;
  }
  
  body {
    @apply antialiased;
    overflow-x: hidden;
    overflow-y: auto;
    word-wrap: break-word;
    overflow-wrap: break-word;
    width: 100%;
    max-width: 100vw;
    min-height: 100vh;
    position: relative;
  }
  
  /* Prevent text and image overflow */
  * {
    max-width: 100%;
  }
  
  /* Prevent vertical overflow from fixed/absolute elements */
  .fixed, .absolute {
    max-height: 100vh;
  }
  
  /* Ensure flex containers don't overflow */
  .flex, .inline-flex {
    min-width: 0;
  }
  
  /* Ensure grid containers don't overflow */
  .grid {
    min-width: 0;
  }
  
  img {
    max-width: 100%;
    height: auto;
    object-fit: contain;
  }
  
  p, h1, h2, h3, h4, h5, h6, span, a, li {
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
  }
}

@layer components {
  /* Custom animations and styles */
  @keyframes fade-in-up {
    from {
      opacity: 0;
      transform: translateY(30px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .animate-fade-in-up {
    animation: fade-in-up 0.6s ease both;
  }

  /* Hero Section Animations */
  @keyframes gradient-shift {
    0%, 100% {
      background-position: 0% 50%;
    }
    50% {
      background-position: 100% 50%;
    }
  }

  @keyframes gradient-shift-colorful {
    0% {
      background-position: 0% 50%;
    }
    25% {
      background-position: 100% 50%;
    }
    50% {
      background-position: 100% 100%;
    }
    75% {
      background-position: 0% 100%;
    }
    100% {
      background-position: 0% 50%;
    }
  }

  @keyframes float {
    0%, 100% {
      transform: translateY(0px) translateX(0px) rotate(0deg);
    }
    33% {
      transform: translateY(-30px) translateX(15px) rotate(10deg);
    }
    66% {
      transform: translateY(15px) translateX(-15px) rotate(-10deg);
    }
  }

  @keyframes float-reverse {
    0%, 100% {
      transform: translateY(0px) translateX(0px) rotate(0deg);
    }
    33% {
      transform: translateY(20px) translateX(-20px) rotate(-10deg);
    }
    66% {
      transform: translateY(-20px) translateX(20px) rotate(10deg);
    }
  }

  @keyframes pulse-glow-hero {
    0%, 100% {
      opacity: 0.4;
      transform: scale(1);
      box-shadow: 0 0 20px rgba(234, 179, 8, 0.3);
    }
    50% {
      opacity: 0.8;
      transform: scale(1.05);
      box-shadow: 0 0 40px rgba(234, 179, 8, 0.6);
    }
  }

  @keyframes gradient-text {
    0%, 100% {
      background-position: 0% 50%;
    }
    50% {
      background-position: 100% 50%;
    }
  }

  @keyframes slide-up {
    from {
      opacity: 0;
      transform: translateY(20px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  @keyframes fade-in-delay {
    0% {
      opacity: 0;
    }
    50% {
      opacity: 0;
    }
    100% {
      opacity: 1;
    }
  }

  @keyframes spin-slow {
    from {
      transform: rotate(0deg);
    }
    to {
      transform: rotate(360deg);
    }
  }

  @keyframes sparkle {
    0%, 100% {
      opacity: 0;
      transform: scale(0) translateY(0);
    }
    50% {
      opacity: 1;
      transform: scale(1) translateY(-20px);
    }
  }

  @keyframes color-wave {
    0%, 100% {
      transform: translateX(-50%) translateY(-50%) scale(1);
      opacity: 0.3;
    }
    50% {
      transform: translateX(-50%) translateY(-50%) scale(1.2);
      opacity: 0.6;
    }
  }

  @keyframes shape-color-shift {
    0% {
      background: radial-gradient(circle, rgba(234, 179, 8, 0.3) 0%, transparent 70%);
    }
    25% {
      background: radial-gradient(circle, rgba(249, 115, 22, 0.3) 0%, transparent 70%);
    }
    50% {
      background: radial-gradient(circle, rgba(236, 72, 153, 0.3) 0%, transparent 70%);
    }
    75% {
      background: radial-gradient(circle, rgba(59, 130, 246, 0.3) 0%, transparent 70%);
    }
    100% {
      background: radial-gradient(circle, rgba(234, 179, 8, 0.3) 0%, transparent 70%);
    }
  }

  .hero-section {
    position: relative;
  }

  .hero-gradient-animation {
    position: absolute;
    inset: 0;
    background: linear-gradient(
      45deg,
      rgba(234, 179, 8, 0.15) 0%,
      rgba(249, 115, 22, 0.1) 20%,
      rgba(236, 72, 153, 0.15) 40%,
      rgba(59, 130, 246, 0.1) 60%,
      rgba(34, 197, 94, 0.15) 80%,
      rgba(234, 179, 8, 0.15) 100%
    );
    background-size: 300% 300%;
    animation: gradient-shift-colorful 12s ease infinite;
  }

  .hero-color-waves {
    position: absolute;
    inset: 0;
    background: radial-gradient(
      ellipse at 30% 20%,
      rgba(234, 179, 8, 0.2) 0%,
      transparent 50%
    ),
    radial-gradient(
      ellipse at 70% 80%,
      rgba(236, 72, 153, 0.2) 0%,
      transparent 50%
    ),
    radial-gradient(
      ellipse at 50% 50%,
      rgba(59, 130, 246, 0.15) 0%,
      transparent 50%
    );
    animation: color-wave 8s ease-in-out infinite;
  }

  .floating-shapes {
    position: absolute;
    inset: 0;
    overflow: hidden;
  }

  .shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(50px);
    animation: shape-color-shift 10s ease-in-out infinite;
  }

  .shape-1 {
    width: 350px;
    height: 350px;
    top: 10%;
    left: 10%;
    background: radial-gradient(circle, rgba(234, 179, 8, 0.4) 0%, transparent 70%);
    animation: float 15s ease-in-out infinite, shape-color-shift 12s ease-in-out infinite;
  }

  .shape-2 {
    width: 250px;
    height: 250px;
    top: 60%;
    right: 15%;
    background: radial-gradient(circle, rgba(236, 72, 153, 0.4) 0%, transparent 70%);
    animation: float-reverse 12s ease-in-out infinite, shape-color-shift 10s ease-in-out infinite;
  }

  .shape-3 {
    width: 300px;
    height: 300px;
    bottom: 20%;
    left: 20%;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.4) 0%, transparent 70%);
    animation: float 18s ease-in-out infinite, shape-color-shift 14s ease-in-out infinite;
  }

  .shape-4 {
    width: 220px;
    height: 220px;
    top: 30%;
    right: 30%;
    background: radial-gradient(circle, rgba(249, 115, 22, 0.4) 0%, transparent 70%);
    animation: float-reverse 14s ease-in-out infinite, shape-color-shift 11s ease-in-out infinite;
  }

  .shape-5 {
    width: 280px;
    height: 280px;
    bottom: 10%;
    right: 10%;
    background: radial-gradient(circle, rgba(34, 197, 94, 0.4) 0%, transparent 70%);
    animation: float 16s ease-in-out infinite, shape-color-shift 13s ease-in-out infinite;
  }

  .shape-6 {
    width: 200px;
    height: 200px;
    top: 50%;
    left: 50%;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.4) 0%, transparent 70%);
    animation: float 20s ease-in-out infinite, shape-color-shift 15s ease-in-out infinite;
  }

  .sparkle-container {
    position: absolute;
    inset: 0;
    overflow: hidden;
  }

  .sparkle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 0 6px 2px rgba(234, 179, 8, 0.8);
  }

  .sparkle-1 {
    top: 20%;
    left: 20%;
    animation: sparkle 3s ease-in-out infinite;
  }

  .sparkle-2 {
    top: 40%;
    right: 25%;
    animation: sparkle 4s ease-in-out infinite 0.5s;
  }

  .sparkle-3 {
    bottom: 30%;
    left: 30%;
    animation: sparkle 3.5s ease-in-out infinite 1s;
  }

  .sparkle-4 {
    top: 60%;
    right: 40%;
    animation: sparkle 4.5s ease-in-out infinite 1.5s;
  }

  .sparkle-5 {
    bottom: 20%;
    right: 20%;
    animation: sparkle 3.8s ease-in-out infinite 2s;
  }

  .animate-gradient-text {
    background-size: 200% auto;
    animation: gradient-text 4s linear infinite;
  }

  .animate-slide-up {
    animation: slide-up 1s ease-out 0.3s both;
  }

  .animate-fade-in-delay {
    animation: fade-in-delay 1.5s ease-out both;
  }

  .animate-pulse-glow {
    animation: pulse-glow-hero 3s ease-in-out infinite;
  }

  .animate-spin-slow {
    animation: spin-slow 8s linear infinite;
  }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: #12121a;
}

::-webkit-scrollbar-thumb {
  background: #333340;
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: #d4af37;
}

/* Selection Colors */
::selection {
  background: rgba(212, 175, 55, 0.3);
  color: #ffffff;
}

/* Focus States */
a:focus-visible,
button:focus-visible {
  outline: 2px solid #d4af37;
  outline-offset: 2px;
}

@layer components {
  /* Casino Card Animations */
  @keyframes shimmer {
    0% {
      background-position: -1000px 0;
    }
    100% {
      background-position: 1000px 0;
    }
  }

  @keyframes pulse-glow {
    0%, 100% {
      box-shadow: 0 0 0 0 rgba(234, 179, 8, 0.4);
    }
    50% {
      box-shadow: 0 0 0 8px rgba(234, 179, 8, 0);
    }
  }

  @keyframes slide-in {
    from {
      opacity: 0;
      transform: translateY(20px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .casino-card {
    animation: slide-in 0.6s ease-out;
    animation-fill-mode: both;
    position: relative;
    z-index: 1;
    isolation: isolate;
  }

  .casino-card:nth-child(1) { animation-delay: 0.1s; }
  .casino-card:nth-child(2) { animation-delay: 0.2s; }
  .casino-card:nth-child(3) { animation-delay: 0.3s; }
  .casino-card:nth-child(4) { animation-delay: 0.4s; }

  /* Shimmer effect for premium badges */
  .premium-badge {
    background: linear-gradient(
      90deg,
      rgba(255, 255, 255, 0) 0%,
      rgba(255, 255, 255, 0.3) 50%,
      rgba(255, 255, 255, 0) 100%
    ) !important;
    background-size: 200% 100%;
    animation: shimmer 3s infinite;
  }
}

@layer utilities {
  /* Custom utility classes */
  .text-balance {
    text-wrap: balance;
  }
  
  /* Blob animation for hero section */
  @keyframes blob {
    0% {
      transform: translate(0px, 0px) scale(1);
    }
    33% {
      transform: translate(30px, -50px) scale(1.1);
    }
    66% {
      transform: translate(-20px, 20px) scale(0.9);
    }
    100% {
      transform: translate(0px, 0px) scale(1);
    }
  }
  
  .animate-blob {
    animation: blob 7s infinite;
  }
  
  .animation-delay-2000 {
    animation-delay: 2s;
  }
  
  .animation-delay-4000 {
    animation-delay: 4s;
  }
  
  /* Background size and position utilities for gradient animations */
  .bg-size-200 {
    background-size: 200% 100%;
  }
  
  .bg-pos-0 {
    background-position: 0% 0%;
  }
  
  .bg-pos-100 {
    background-position: 100% 0%;
  }
}

