/* Base styles */
:root {
  --primary-color: #3b82f6;
  --primary-dark: #2563eb;
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;
  --text-primary: #1f2937;
  --text-secondary: #4b5563;
  --text-light: #6b7280;
  --bg-light: #f9fafb;
  --bg-white: #ffffff;
  --border-light: #e5e7eb;
}

/* Font setup */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  scroll-behavior: smooth;
}

h1, h2, h3, h4, .font-display {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Hero section animation */
.hero-gradient {
  background: linear-gradient(-45deg, #3b82f6, #2563eb, #4f46e5, #6366f1);
  background-size: 400% 400%;
  animation: gradient 15s ease infinite;
}

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

/* Animation for waveform */
.waveform-container {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  overflow: hidden;
  opacity: 0.05;
  pointer-events: none;
  z-index: 0;
}

.waveform {
  position: absolute;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.3), transparent);
  animation: wave 8s ease-in-out infinite;
  transform: translateX(-100%);
}

@keyframes wave {
  0% { transform: translateX(-100%); }
  50% { transform: translateX(100%); }
  100% { transform: translateX(-100%); }
}

/* Pulse animation */
.pulse {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7);
  }
  
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 10px rgba(59, 130, 246, 0);
  }
  
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
  }
}

/* Card hover effects */
.feature-card {
  transition: all 0.3s ease;
}

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

/* Loading spinner */
.lds-ring {
  display: inline-block;
  position: relative;
  width: 64px;
  height: 64px;
  margin: 0 auto;
}
.lds-ring div {
  box-sizing: border-box;
  display: block;
  position: absolute;
  width: 48px;
  height: 48px;
  margin: 8px;
  border: 4px solid #3b82f6;
  border-radius: 50%;
  animation: lds-ring 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
  border-color: #3b82f6 transparent transparent transparent;
}
.lds-ring div:nth-child(1) { animation-delay: -0.45s; }
.lds-ring div:nth-child(2) { animation-delay: -0.3s; }
.lds-ring div:nth-child(3) { animation-delay: -0.15s; }

@keyframes lds-ring {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Audio player customization */
.audio-player {
  --player-bg: #f9fafb;
  --player-text: #1f2937;
  --player-progress: #3b82f6;
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  background: var(--player-bg);
  padding: 10px;
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}

/* Custom code blocks */
.code-block {
  border-radius: 8px;
  background: #1e293b;
  color: #f8fafc;
  padding: 1.5rem;
  margin: 1.5rem 0;
  overflow-x: auto;
  font-family: 'SF Mono', Menlo, Monaco, Consolas, monospace;
  font-size: 0.9rem;
  line-height: 1.5;
}

/* Code tabs */
.code-tabs {
  display: flex;
  background: #1e293b;
  border-bottom: 1px solid #334155;
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
  overflow: hidden;
}

.code-tab {
  padding: 0.75rem 1.25rem;
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.2s;
}

.code-tab:hover {
  color: #f8fafc;
  background: #334155;
}

.code-tab.active {
  background: #334155;
  color: #f8fafc;
  font-weight: 500;
}

/* Fixed header and mobile menu styling */
nav.fixed-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 50;
  background: white;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

#mobileMenu.fixed-menu {
  position: fixed;
  top: 77px; /* Height of your nav */
  left: 0;
  right: 0;
  width: 100%;
  z-index: 49;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  max-height: calc(100vh - 77px);
  overflow-y: auto;
}

body.fixed-nav {
  padding-top: 77px; /* Same as nav height */
}

/* Mobile menu overlay */
.mobile-menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.3);
  z-index: 48;
  display: none;
  transition: opacity 0.3s ease;
}

.mobile-menu-overlay.active {
  display: block;
}

/* Fix for Safari/iOS */
@supports (-webkit-touch-callout: none) {
  body.fixed-nav {
    /* iOS requires a different approach for fixed positioning */
    padding-top: 0;
  }
  
  nav.fixed-header {
    position: sticky;
  }
}

/* Ensure proper z-index layering */
#documentationSidebar {
  z-index: 100;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  /* Adjust content padding on mobile */
  main {
    padding: 1rem;
  }
  
  /* Make code blocks scroll horizontally on mobile */
  pre {
    overflow-x: auto;
    white-space: pre;
    word-wrap: normal;
  }
  
  /* Fix table overflow */
  table {
    display: block;
    overflow-x: auto;
  }
  
  /* Improve code block readability on mobile */
  pre {
    font-size: 12px;
    padding: 0.75rem !important;
  }
  
  /* Adjust content spacing on mobile */
  .p-6 {
    padding: 1rem;
  }
  
  .mb-16 {
    margin-bottom: 2.5rem;
  }
  
  /* Make headings more compact on mobile */
  h2.text-3xl {
    font-size: 1.75rem;
  }
  
  /* Ensure documentation sidebar takes full screen on mobile */
  #documentationSidebar {
    height: 100vh;
    overflow-y: auto;
    padding-bottom: 6rem;
  }
  
  /* Make the footer more compact on mobile */
  footer.p-8 {
    padding: 1.5rem 1rem;
  }

  /* Mobile-specific adjustments for loader */
  .usage-loader {
    width: 32px;
    height: 32px;
  }
  
  .loader-container.py-12 {
    padding-top: 2rem;
    padding-bottom: 2rem;
  }
}

/* Media queries for better mobile experience */
@media (max-width: 640px) {
  .hero-section h1 {
    font-size: 2.25rem;
  }
  
  .hero-section h2 {
    font-size: 1.25rem;
  }
  
  .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

/* Custom inputs and buttons */
button:focus, input:focus {
  outline: 2px solid rgba(59, 130, 246, 0.5);
  outline-offset: 2px;
}

/* Fancy gradient buttons for CTA */
.gradient-btn {
  background: linear-gradient(90deg, #3b82f6, #6366f1);
  transition: all 0.3s ease;
}

.gradient-btn:hover {
  background: linear-gradient(90deg, #2563eb, #4f46e5);
  box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.3), 0 4px 6px -2px rgba(59, 130, 246, 0.1);
}

/* Fancy transitions */
.transition-all {
  transition-property: all;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 300ms;
}

/* Hide download button in audio player */
audio::-webkit-media-controls-enclosure {
  overflow: hidden;
}

audio::-webkit-media-controls-panel {
  width: calc(100% + 30px);
}

/* Logo styles */
.logo-container {
  position: relative;
  display: flex;
  align-items: center;
}

.logo-icon {
  position: relative;
  width: 40px;
  height: 40px;
  margin-right: 10px;
}

.sound-waves {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 100%;
}

.wave {
  position: absolute;
  background: linear-gradient(45deg, #00f5ff, #0080ff, #8000ff);
  border-radius: 20px;
}

.wave:nth-child(1) {
  width: 4px;
  height: 25px;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  animation: pulse 2s ease-in-out infinite;
}

.wave:nth-child(2) {
  width: 3px;
  height: 18px;
  left: 35%;
  top: 50%;
  transform: translate(-50%, -50%);
  animation: pulse 2s ease-in-out infinite;
  animation-delay: 0.2s;
}

.wave:nth-child(3) {
  width: 3px;
  height: 18px;
  left: 65%;
  top: 50%;
  transform: translate(-50%, -50%);
  animation: pulse 2s ease-in-out infinite;
  animation-delay: 0.4s;
}

@keyframes pulse {

  0%,
  100% {
    transform: translate(-50%, -50%) scaleY(0.5);
    opacity: 0.6;
  }

  50% {
    transform: translate(-50%, -50%) scaleY(1);
    opacity: 1;
  }
}

.ai-core {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 6px;
  height: 6px;
  background: radial-gradient(circle, #ffffff, #00f5ff);
  border-radius: 50%;
  box-shadow: 0 0 10px #00f5ff, 0 0 20px #00f5ff;
}

/* Custom styles */
body {
  background-color: #fff;
  overflow-x: hidden;
}

.font-display {
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.hero-gradient {
  background: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 50%, #16213e 100%);
}

.sound-wave {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 40px;
}

.sound-wave .bar {
  display: inline-block;
  width: 4px;
  margin: 0 3px;
  background: #00f5ff;
  border-radius: 3px;
  animation: sound-wave-animation 1.2s infinite ease-in-out;
}

.sound-wave .bar:nth-child(1) {
  height: 20px;
  animation-delay: 0s;
}

.sound-wave .bar:nth-child(2) {
  height: 35px;
  animation-delay: 0.1s;
}

.sound-wave .bar:nth-child(3) {
  height: 45px;
  animation-delay: 0.2s;
}

.sound-wave .bar:nth-child(4) {
  height: 30px;
  animation-delay: 0.3s;
}

.sound-wave .bar:nth-child(5) {
  height: 20px;
  animation-delay: 0.4s;
}

.sound-wave .bar:nth-child(6) {
  height: 40px;
  animation-delay: 0.5s;
}

.sound-wave .bar:nth-child(7) {
  height: 25px;
  animation-delay: 0.6s;
}

@keyframes sound-wave-animation {

  0%,
  100% {
    transform: scaleY(1);
  }

  50% {
    transform: scaleY(0.6);
  }
}

.gradient-text {
  background: linear-gradient(90deg, #00f5ff, #8000ff);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.gradient-btn {
  background: linear-gradient(90deg, #00f5ff, #8000ff);
  transition: all 0.3s ease;
}

.gradient-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(0, 245, 255, 0.3);
}

.floating {
  animation: floating 3s ease-in-out infinite;
}

@keyframes floating {
  0% {
    transform: translateY(0px);
  }

  50% {
    transform: translateY(-10px);
  }

  100% {
    transform: translateY(0px);
  }
}

.voice-card {
  transition: all 0.3s ease;
}

.voice-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.particles {
  position: absolute;
  top: 0;
  left: 0;
}

/* Loader styling */
.loader-container {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

#initialLoader {
  min-height: 300px;
}

.usage-loader {
  border: 3px solid rgba(59, 130, 246, 0.2);
  border-radius: 50%;
  border-top: 3px solid #3b82f6;
  width: 36px;
  height: 36px;
  animation: loader-spin 1s linear infinite;
}

@keyframes loader-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Animation for usage circle */
.usage-circle-animate {
  transition: stroke-dasharray 1.2s ease-in-out;
}

.code-block {
  overflow-x: auto;
  background: #1e293b;
  border-radius: 8px;
  font-family: 'Fira Code', 'Courier New', monospace;
}

.code-line {
  display: block;
  padding: 0 1rem;
}

.code-comment {
  color: #64748b;
}

.code-keyword {
  color: #f472b6;
}

.code-string {
  color: #a5b4fc;
}

.code-function {
  color: #38bdf8;
}

/* Additional mobile improvements */
@media (max-width: 768px) {
  /* Ensure proper spacing under fixed nav for sidebar on mobile */
  #documentationSidebar {
    top: 77px;
  }
  
  /* Fix pre code block overflow on mobile */
  pre {
    word-break: break-word;
    white-space: pre-wrap;
  }
  
  /* Make documentation sidebar take full width on mobile */
  #documentationSidebar {
    width: 85%;
    max-width: 300px;
    transform: translateX(-105%);
    transition: transform 0.3s ease;
  }
  
  #documentationSidebar:not(.hidden) {
    transform: translateX(0);
  }
}

/* Server switch notification */
#serverSwitchNotification {
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  min-width: 250px;
  animation-duration: 0.5s;
}

/* Ensure notification is always on top and visible */
@media (max-width: 640px) {
  #serverSwitchNotification {
    bottom: 65px; /* Move up to avoid bottom navigation bars on mobile */
    width: 90%;
    max-width: none;
  }
}

/* Animation for notification */
.animate__fadeOut {
  animation-name: fadeOut;
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

/* Server status indicators */
.server-status {
  padding: 0.25rem 0.75rem;
  border-radius: 0.375rem;
  background-color: #f3f4f6;
}