@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap");

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

/* Hide scrollbar utility */
.scrollbar-hide {
  -ms-overflow-style: none; /* Internet Explorer 10+ */
  scrollbar-width: none; /* Firefox */
}
.scrollbar-hide::-webkit-scrollbar {
  display: none; /* Safari and Chrome */
}

/* Global styles for fixed navigation */

:root {
  --background: hsl(0, 0%, 100%);
  --foreground: hsl(240, 10%, 3.9%);
  --muted: hsl(240, 4.8%, 95.9%);
  --muted-foreground: hsl(240, 3.8%, 46.1%);
  --popover: hsl(0, 0%, 100%);
  --popover-foreground: hsl(240, 10%, 3.9%);
  --card: hsl(0, 0%, 100%);
  --card-foreground: hsl(240, 10%, 3.9%);
  --border: hsl(240, 5.9%, 90%);
  --input: hsl(240, 5.9%, 90%);
  --primary: hsl(262, 83%, 58%);
  --primary-foreground: hsl(0, 0%, 100%);
  --secondary: hsl(240, 4.8%, 95.9%);
  --secondary-foreground: hsl(240, 5.9%, 10%);
  --accent: hsl(240, 4.8%, 95.9%);
  --accent-foreground: hsl(240, 5.9%, 10%);
  --destructive: hsl(0, 84.2%, 60.2%);
  --destructive-foreground: hsl(0, 0%, 98%);
  --ring: hsl(262, 83%, 58%);
  --radius: 0.75rem;

  /* Modern color palette */
  --modern-primary: hsl(259, 100%, 65%);
  --modern-primary-dark: hsl(259, 100%, 55%);
  --modern-secondary: hsl(197, 100%, 47%);
  --modern-accent: hsl(340, 100%, 63%);
  --modern-success: hsl(142, 76%, 36%);
  --modern-warning: hsl(38, 92%, 50%);
  --modern-info: hsl(197, 100%, 47%);

  /* Gradient colors */
  --gradient-1: linear-gradient(
    135deg,
    hsl(259, 100%, 65%) 0%,
    hsl(197, 100%, 47%) 100%
  );
  --gradient-2: linear-gradient(
    135deg,
    hsl(340, 100%, 63%) 0%,
    hsl(259, 100%, 65%) 100%
  );
  --gradient-3: linear-gradient(
    135deg,
    hsl(197, 100%, 47%) 0%,
    hsl(259, 100%, 65%) 100%
  );

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 10px 10px -5px rgba(0, 0, 0, 0.04);

  /* TCall brand colors */
  --tcall-blue: hsl(197, 100%, 47%);
  --tcall-blue-light: hsl(197, 100%, 57%);
  --tcall-purple: hsl(259, 100%, 65%);

  /* Custom design tokens with brand colors */
  --gradient-primary: linear-gradient(
    135deg,
    hsl(196 100% 57%),
    hsl(196 100% 37%)
  );
  --gradient-accent: linear-gradient(135deg, hsl(30 77% 71%), hsl(30 77% 51%));
  --gradient-hero: linear-gradient(180deg, hsl(220 100% 97%), hsl(220 80% 85%));
  --shadow-glow: 0 0 40px hsl(196 100% 47% / 0.2);
  --shadow-subtle: 0 10px 30px -10px hsl(196 100% 47% / 0.1);
}

/* Pre-flight check animations */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.animate-slideIn {
  animation: slideIn 0.5s ease-out;
}

.animate-fadeInUp {
  animation: fadeInUp 0.5s ease-out;
}

/* Group display animations */
@keyframes groupExpand {
  from {
    max-height: 0;
    opacity: 0;
    transform: scaleY(0);
  }
  to {
    max-height: 2000px;
    opacity: 1;
    transform: scaleY(1);
  }
}

@keyframes contactSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes groupHeaderGlow {
  0% {
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(59, 130, 246, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
  }
}

@keyframes groupSelect {
  from {
    transform: scale(1);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  }
  to {
    transform: scale(1.02);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  }
}

@keyframes contactStagger {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.animate-group-expand {
  animation: groupExpand 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.animate-contact-slide-in {
  animation: contactSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.animate-group-header-glow {
  animation: groupHeaderGlow 2s infinite;
}

.animate-group-select {
  animation: groupSelect 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.animate-contact-stagger {
  animation: contactStagger 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.group-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1),
    0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.group-header {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.group-header:hover {
  background: linear-gradient(
    135deg,
    rgba(59, 130, 246, 0.05) 0%,
    rgba(147, 51, 234, 0.05) 100%
  );
}

/* Modern scrollbar for group dropdown */
.group-dropdown::-webkit-scrollbar {
  width: 6px;
}

.group-dropdown::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 3px;
}

.group-dropdown::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}

.group-dropdown::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3);
}

.dark {
  --background: hsl(240, 10%, 3.9%);
  --foreground: hsl(0, 0%, 98%);
  --muted: hsl(240, 3.7%, 15.9%);
  --muted-foreground: hsl(240, 5%, 64.9%);
  --popover: hsl(240, 10%, 3.9%);
  --popover-foreground: hsl(0, 0%, 98%);
  --card: hsl(240, 5%, 15%);
  --card-foreground: hsl(0, 0%, 98%);
  --border: hsl(240, 3.7%, 15.9%);
  --input: hsl(240, 3.7%, 15.9%);
  --primary: hsl(207, 90%, 54%);
  --primary-foreground: hsl(211, 100%, 99%);
  --secondary: hsl(240, 3.7%, 15.9%);
  --secondary-foreground: hsl(0, 0%, 98%);
  --accent: hsl(240, 3.7%, 15.9%);
  --accent-foreground: hsl(0, 0%, 98%);
  --destructive: hsl(0, 62.8%, 30.6%);
  --destructive-foreground: hsl(0, 0%, 98%);
  --ring: hsl(240, 4.9%, 83.9%);
  --radius: 0.5rem;
}

@layer base {
  * {
    @apply border-border;
  }

  body {
    @apply font-poppins antialiased bg-background text-foreground;
  }
}

@layer components {
  .tcall-blue {
    color: var(--tcall-blue);
  }

  .bg-tcall-blue {
    background-color: var(--tcall-blue);
  }

  .bg-tcall-blue-light {
    background-color: var(--tcall-blue-light);
  }

  .bg-tcall-purple {
    background-color: var(--tcall-purple);
  }

  .bg-tcall-gray {
    background-color: var(--tcall-gray);
  }

  .text-tcall-blue {
    color: var(--tcall-blue);
  }

  .border-tcall-blue {
    border-color: var(--tcall-blue);
  }

  .hover\:bg-tcall-blue:hover {
    background-color: var(--tcall-blue);
  }

  .hover\:bg-tcall-blue-light:hover {
    background-color: var(--tcall-blue-light);
  }

  .hover\:text-tcall-blue:hover {
    color: var(--tcall-blue);
  }

  /* Modern gradients */
  .bg-gradient-1 {
    background: var(--gradient-1);
  }

  .bg-gradient-2 {
    background: var(--gradient-2);
  }

  .bg-gradient-3 {
    background: var(--gradient-3);
  }

  /* Modern button styles */
  .btn-modern {
    @apply relative overflow-hidden transition-all duration-300 transform hover:scale-105;
    box-shadow: var(--shadow-md);
  }

  .btn-modern:hover {
    box-shadow: var(--shadow-lg);
  }

  .btn-modern:active {
    transform: scale(0.98);
  }

  /* Glass morphism effect */
  .glass {
    @apply backdrop-blur-lg bg-white/10 border border-white/20;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
  }

  /* Modern card styles */
  .card-modern {
    @apply bg-white rounded-2xl;
    box-shadow: var(--shadow-lg);
    transition: all 0.3s ease;
  }

  .card-modern:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
  }

  /* Animated gradient text */
  .gradient-text {
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
  }

  /* Modern input styles */
  .input-modern {
    @apply border-2 border-gray-200 focus:border-primary transition-all duration-200;
    box-shadow: var(--shadow-sm);
  }

  .input-modern:focus {
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
  }

  /* Smooth transitions */
  * {
    transition: background-color 0.2s ease, border-color 0.2s ease,
      color 0.2s ease;
  }

  /* Fix for SelectContent dropdown width issues and scrollbar flicker */
  [data-radix-select-content] {
    max-width: 100vw !important;
    overflow: hidden !important;
    max-height: 50vh !important;
    overflow-y: auto !important;
  }

  /* Ensure mobile form dropdowns don't cause horizontal scroll or scrollbar flicker */
  #demo-form [data-radix-select-content] {
    max-width: 320px !important;
    left: 0 !important;
    right: auto !important;
    z-index: 9999 !important;
    max-height: 40vh !important;
  }

  #demo-form [data-radix-select-trigger] {
    max-width: 100% !important;
  }

  /* Prevent scrollbar flicker by maintaining stable scrollbar */
  html {
    scrollbar-gutter: auto !important;
    overflow-x: hidden !important;
    width: 100% !important;
    max-width: 100vw !important;
  }

  body {
    overflow-x: hidden !important;
    overflow-y: auto !important;
    width: 100% !important;
    max-width: 100vw !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  #root {
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }

  /* Ensure all dashboard pages respect viewport width */
  [class*="Layout"] > div,
  [class*="Layout"] > div > div {
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Ensure box-sizing is border-box globally */
  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }

  /* Prevent animation overflow issues */
  [data-framer-motion] {
    contain: layout style paint !important;
  }

  /* Optimize scroll performance */
  * {
    scroll-behavior: smooth;
  }

  /* Prevent body scroll when any dropdown is open - more specific targeting */
  body:has([data-radix-select-content][data-state="open"]) {
    overflow: hidden !important;
    padding-right: 0 !important;
    position: fixed !important;
    width: 100% !important;
  }

  /* Additional fix for mobile form dropdowns specifically */
  #demo-form [data-radix-select-content][data-state="open"] {
    position: fixed !important;
    transform: translateZ(0) !important;
    will-change: transform !important;
  }

  /* Ensure dropdowns are contained within viewport */
  [data-radix-select-content] {
    contain: layout style paint !important;
  }

  /* Custom cloud-like 3D sphere animations */
  @keyframes cloud-pulse {
    0%,
    100% {
      transform: scale(1) rotate(0deg);
      opacity: 0.8;
    }
    50% {
      transform: scale(1.1) rotate(180deg);
      opacity: 0.6;
    }
  }

  @keyframes cloud-bounce {
    0%,
    100% {
      transform: scale(1) rotate(0deg) translateY(0px);
      opacity: 0.9;
    }
    25% {
      transform: scale(1.05) rotate(90deg) translateY(-2px);
      opacity: 0.7;
    }
    50% {
      transform: scale(1.1) rotate(180deg) translateY(-4px);
      opacity: 0.5;
    }
    75% {
      transform: scale(1.05) rotate(270deg) translateY(-2px);
      opacity: 0.7;
    }
  }

  @keyframes cloud-ping {
    0% {
      transform: scale(1) rotate(0deg);
      opacity: 0.7;
    }
    50% {
      transform: scale(1.2) rotate(180deg);
      opacity: 0.3;
    }
    100% {
      transform: scale(1) rotate(360deg);
      opacity: 0.7;
    }
  }

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

  .animate-cloud-bounce {
    animation: cloud-bounce 2s ease-in-out infinite;
  }

  .animate-cloud-ping {
    animation: cloud-ping 1.5s ease-in-out infinite;
  }
}

/* #root {
  margin: 0 auto;
  text-align: center;
} */

.logo {
  height: 6em;
  padding: 1.5em;
  will-change: filter;
  transition: filter 300ms;
}
.logo:hover {
  filter: drop-shadow(0 0 2em #646cffaa);
}
.logo.react:hover {
  filter: drop-shadow(0 0 2em #61dafbaa);
}

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

@media (prefers-reduced-motion: no-preference) {
  a:nth-of-type(2) .logo {
    animation: logo-spin infinite 20s linear;
  }
}

.card {
  padding: 2em;
}

.read-the-docs {
  color: #888;
}

/* Cloud floating animation - Original smooth movement */
@keyframes float {
  0%,
  100% {
    transform: translateY(0px) translateX(0px);
  }
  33% {
    transform: translateY(-20px) translateX(15px);
  }
  66% {
    transform: translateY(10px) translateX(-15px);
  }
}

.animate-float {
  animation: float 6s ease-in-out infinite;
}

/* Fast cloud sliding animation - right to left every 10 seconds */
@keyframes cloudSlide {
  0% {
    transform: translateX(100vw) translateY(0px);
  }
  15% {
    transform: translateX(-100vw) translateY(-10px);
  }
  100% {
    transform: translateX(-100vw) translateY(0px);
  }
}

.animate-cloud-slide {
  animation: cloudSlide 10s ease-in-out infinite;
}

/* Neon pulse animation for glowing effects */
@keyframes neonPulse {
  0%,
  100% {
    box-shadow: 0 0 20px #00aeef, 0 0 40px #00aeef80, 0 0 60px #00aeef40;
  }
  50% {
    box-shadow: 0 0 30px #00aeef, 0 0 60px #00aeef, 0 0 90px #00aeef80;
  }
}

/* Logo scroll animation - infinite seamless scroll using calculated width */
@keyframes scroll-infinite {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(var(--translate-amount, -25%));
  }
}

/* Flag scroll animation - starts from center, moves left */
@keyframes scrollLeft {
  sub 0% {
    transform: translateX(50vw);
  }
  100% {
    transform: translateX(-100%);
  }
}

.animate-scroll-left {
  animation: scrollLeft 118s linear infinite;
}

/* Gradient text utility class */
.gradient-text {
  @apply bg-gradient-to-r from-primary via-blue-600 to-primary bg-clip-text text-transparent;
}

/* AI Agent Creation Animations */
@keyframes slideEmojis {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}

@keyframes waveform {
  0%,
  100% {
    transform: scaleY(0.3);
    opacity: 0.7;
  }
  50% {
    transform: scaleY(1.2);
    opacity: 1;
  }
}

@keyframes floatParticles {
  0%,
  100% {
    transform: translateY(0px) translateX(0px);
    opacity: 0.3;
  }
  25% {
    transform: translateY(-30px) translateX(20px);
    opacity: 0.8;
  }
  50% {
    transform: translateY(-50px) translateX(-10px);
    opacity: 1;
  }
  75% {
    transform: translateY(-30px) translateX(-20px);
    opacity: 0.8;
  }
}

/* Microphone transparent background - Remove all backgrounds */
.microphone-transparent {
  background: none !important;
  background-color: transparent !important;
  background-image: none !important;
}

/* Custom slow glow animation - 14 seconds per cycle */
@keyframes slowGlow {
  0%,
  100% {
    box-shadow: 0 0 20px #00aeef40, 0 0 40px #00aeef20, 0 0 60px #00aeef10;
    opacity: 0.7;
  }
  50% {
    box-shadow: 0 0 50px #00aeef, 0 0 100px #00aeef80, 0 0 150px #00aeef40;
    opacity: 1;
  }
}

@keyframes slowRing {
  0% {
    opacity: 0.1;
    transform: scale(1);
  }
  50% {
    opacity: 0.3;
    transform: scale(1.1);
  }
  100% {
    opacity: 0.1;
    transform: scale(1);
  }
}

/* Phone ringing animation with waves */
@keyframes phoneRing {
  0%,
  100% {
    transform: rotate(0deg);
  }
  10% {
    transform: rotate(-10deg);
  }
  20% {
    transform: rotate(10deg);
  }
  30% {
    transform: rotate(-10deg);
  }
  40% {
    transform: rotate(10deg);
  }
  50% {
    transform: rotate(0deg);
  }
}

@keyframes ringWave {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  100% {
    transform: scale(2.5);
    opacity: 0;
  }
}

.phone-ringing {
  animation: phoneRing 2s ease-in-out infinite;
  position: relative;
}

.phone-ringing::before,
.phone-ringing::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border: 2px solid hsl(var(--primary));
  border-radius: 50%;
  animation: ringWave 2s ease-out infinite;
}

.phone-ringing::after {
  animation-delay: 1s;
}

@keyframes rotate360 {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

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

@keyframes bounceGentle {
  0%,
  100% {
    transform: translateY(0px) scale(1);
  }
  50% {
    transform: translateY(-4px) scale(1.05);
  }
}

@keyframes pulseGlow {
  0%,
  100% {
    transform: scale(1);
    filter: brightness(1);
  }
  50% {
    transform: scale(1.1);
    filter: brightness(1.2);
  }
}

.icon-rotate-360 {
  animation: rotate360 3s linear infinite;
}

.icon-float {
  animation: floatUp 2.5s ease-in-out infinite;
}

.icon-bounce {
  animation: bounceGentle 2s ease-in-out infinite;
}

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