/* Mobile-first approach to fix layout issues */
* {
  box-sizing: border-box;
}

html,
body {
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
}

/* Container max-width fix for mobile */
.container {
  max-width: 100%;
  padding-left: 1rem;
  padding-right: 1rem;
}

@media (min-width: 640px) {
  .container {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

/* Custom animations */
@keyframes float {
  0%,
  100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-20px);
  }
}

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

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

@keyframes slideInLeft {
  from {
    transform: translateX(-50px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideInRight {
  from {
    transform: translateX(50px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

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

@keyframes pulseGlow {
  0%,
  100% {
    box-shadow: 0 0 5px rgba(14, 165, 233, 0.5);
  }
  50% {
    box-shadow: 0 0 20px rgba(14, 165, 233, 0.8);
  }
}

/* Gumroad button specific animations */
@keyframes gumroadPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(245, 158, 11, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0);
  }
}

.gumroad-button {
  position: relative;
  overflow: hidden;
}

.gumroad-button::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.gumroad-button:hover::before {
  width: 300px;
  height: 300px;
}

.gumroad-button:active {
  animation: gumroadPulse 0.6s;
}

/* PLR/MRR specific styling */
.plr-highlight {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.mrr-badge {
  display: inline-flex;
  align-items: center;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.mrr-badge::before {
  content: "💰";
  margin-right: 6px;
}

/* Animation classes */
.animate-float {
  animation: float 3s ease-in-out infinite;
}

.animate-slide-up {
  animation: slideUp 0.6s ease-out;
}

.animate-fade-in {
  animation: fadeIn 0.8s ease-out;
}

.animate-slide-in-left {
  animation: slideInLeft 0.8s ease-out;
}

.animate-slide-in-right {
  animation: slideInRight 0.8s ease-out;
}

.animate-scale-in {
  animation: scaleIn 0.6s ease-out;
}

.animate-pulse-glow {
  animation: pulseGlow 2s ease-in-out infinite;
}

/* Intersection Observer animations */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.animate-on-scroll.animate {
  opacity: 1;
  transform: translateY(0);
}

/* Staggered animations */
.animate-on-scroll[style*="animation-delay"] {
  transition-delay: var(--animation-delay, 0s);
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(to bottom, #0ea5e9, #f59e0b);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(to bottom, #0284c7, #d97706);
}

/* Enhanced hover effects */
.hover-scale:hover {
  transform: scale(1.05);
}

.hover-glow:hover {
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

/* Gradient text animation */
@keyframes gradient-shift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.animate-gradient {
  background: linear-gradient(-45deg, #0ea5e9, #f59e0b, #0ea5e9, #f59e0b);
  background-size: 400% 400%;
  animation: gradient-shift 3s ease infinite;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Card hover animations */
.card-hover {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-hover:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
}

/* Button pulse effect */
@keyframes button-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(14, 165, 233, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(14, 165, 233, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(14, 165, 233, 0);
  }
}

.pulse-button {
  animation: button-pulse 2s infinite;
}

/* Format indicator animations */
.format-indicator {
  transition: all 0.3s ease;
}

.format-indicator:hover {
  transform: rotate(10deg) scale(1.1);
}

/* Loading animation for countdown */
.countdown-loading {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Gumroad integration styles */
.gumroad-section {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  position: relative;
  overflow: hidden;
}

.gumroad-section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="white" stroke-width="0.5" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
  pointer-events: none;
}

.gumroad-badge {
  background: linear-gradient(135deg, #ff6b6b, #ee5a24);
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
  animation: gumroadPulse 2s infinite;
}

/* PLR/MRR specific enhancements */
.plr-container {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border: 2px solid rgba(16, 185, 129, 0.3);
  position: relative;
}

.plr-container::before {
  content: "";
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(45deg, #10b981, #059669, #10b981, #059669);
  background-size: 400% 400%;
  border-radius: inherit;
  z-index: -1;
  animation: gradient-shift 3s ease infinite;
}

.mrr-highlight {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
  padding: 12px 24px;
  border-radius: 25px;
  font-weight: 700;
  text-align: center;
  box-shadow: 0 8px 25px rgba(245, 158, 11, 0.4);
  transform: perspective(1000px) rotateX(5deg);
  transition: all 0.3s ease;
}

.mrr-highlight:hover {
  transform: perspective(1000px) rotateX(0deg) translateY(-3px);
  box-shadow: 0 12px 35px rgba(245, 158, 11, 0.6);
}

/* Mobile fixes */
@media (max-width: 768px) {
  .container {
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
    max-width: none;
    width: 100%;
  }

  /* Prevent horizontal scrolling */
  .grid {
    overflow-x: visible;
  }

  /* Fix hero section on mobile */
  #home .grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  /* Ensure text doesn't overflow */
  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  /* Fix button sizing on mobile */
  .btn-responsive {
    width: 100%;
    padding: 1rem 2rem;
    text-align: center;
  }

  /* Prevent cards from overflowing */
  .card-mobile {
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
  }

  /* Gumroad buttons on mobile */
  .gumroad-button {
    width: 100%;
    display: block;
    text-align: center;
    padding: 16px 24px;
  }
}

/* Smooth transitions for interactive elements */
.transition-smooth {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.transition-bounce {
  transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Custom focus styles for accessibility */
button:focus,
a:focus,
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid #0ea5e9;
  outline-offset: 2px;
  border-radius: 4px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .bg-gradient-to-r {
    background: #000 !important;
    color: #fff !important;
  }

  .text-gray-600 {
    color: #000 !important;
  }

  .border-gray-200 {
    border-color: #000 !important;
  }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .animate-float,
  .animate-pulse,
  .animate-bounce,
  .gumroad-button::before {
    animation: none !important;
  }
}

/* Print styles */
@media print {
  .no-print,
  header,
  nav,
  .overlay-menu,
  .mobile-menu-toggle,
  .gumroad-button {
    display: none !important;
  }

  body {
    font-size: 12pt;
    line-height: 1.4;
    color: #000;
    background: #fff;
  }

  h1,
  h2,
  h3 {
    page-break-after: avoid;
    color: #000;
  }

  .bg-gradient-to-r {
    background: #fff !important;
    color: #000 !important;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: #1a1a1a;
    --text-color: #ffffff;
    --card-bg: #2a2a2a;
    --border-color: #333;
  }
}

/* Custom utilities */
.backdrop-blur-glass {
  backdrop-filter: blur(10px) saturate(180%);
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.125);
}

.text-shadow-sm {
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.shadow-glow {
  box-shadow: 0 0 20px rgba(14, 165, 233, 0.3);
}

.shadow-glow-accent {
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.3);
}

/* Animation delays for staggered effects */
.delay-100 {
  animation-delay: 0.1s;
}
.delay-200 {
  animation-delay: 0.2s;
}
.delay-300 {
  animation-delay: 0.3s;
}
.delay-400 {
  animation-delay: 0.4s;
}
.delay-500 {
  animation-delay: 0.5s;
}

/* Ensure proper spacing on all devices */
.section-padding {
  padding-top: 5rem;
  padding-bottom: 5rem;
}

@media (min-width: 768px) {
  .section-padding {
    padding-top: 6rem;
    padding-bottom: 6rem;
  }
}

/* Fix mobile overflow issues */
.overflow-fix {
  overflow-x: hidden;
  max-width: 100vw;
}

/* Responsive text scaling */
.text-responsive {
  font-size: clamp(1rem, 2.5vw, 1.25rem);
}

.text-responsive-lg {
  font-size: clamp(1.5rem, 4vw, 2.5rem);
}

.text-responsive-xl {
  font-size: clamp(2rem, 5vw, 3.5rem);
}
