/* Design Tokens - Extracted from React Version
 * These CSS custom properties ensure visual consistency between React and PHP implementations
 * Last Updated: June 29, 2025
 */

:root {
  /* Core Color System */
  --background: 0 0% 100%;
  --foreground: 222.2 84% 4.9%;

  /* Card Component Colors */
  --card: 0 0% 100%;
  --card-foreground: 222.2 84% 4.9%;

  /* Popover Component Colors */
  --popover: 0 0% 100%;
  --popover-foreground: 222.2 84% 4.9%;

  /* Primary Brand Colors */
  --primary: 222.2 47.4% 11.2%;
  --primary-foreground: 210 40% 98%;

  /* Secondary Colors */
  --secondary: 210 40% 96.1%;
  --secondary-foreground: 222.2 47.4% 11.2%;

  /* Muted/Subdued Colors */
  --muted: 210 40% 96.1%;
  --muted-foreground: 215.4 16.3% 46.9%;

  /* Accent Colors */
  --accent: 210 40% 96.1%;
  --accent-foreground: 222.2 47.4% 11.2%;

  /* Destructive/Error Colors */
  --destructive: 0 84.2% 60.2%;
  --destructive-foreground: 210 40% 98%;

  /* UI Element Colors */
  --border: 214.3 31.8% 91.4%;
  --input: 214.3 31.8% 91.4%;
  --ring: 222.2 84% 4.9%;

  /* Border Radius */
  --radius: 0.5rem;

  /* Sidebar Component Colors */
  --sidebar-background: 0 0% 98%;
  --sidebar-foreground: 240 5.3% 26.1%;
  --sidebar-primary: 240 5.9% 10%;
  --sidebar-primary-foreground: 0 0% 98%;
  --sidebar-accent: 240 4.8% 95.9%;
  --sidebar-accent-foreground: 240 5.9% 10%;
  --sidebar-border: 220 13% 91%;
  --sidebar-ring: 217.2 91.2% 59.8%;

  /* Extended Brand Colors for Integral Mind */
  --brand-blue: 220 91% 58%;
  --brand-purple: 262 83% 58%;
  --brand-gradient: linear-gradient(to right, hsl(var(--brand-blue)), hsl(var(--brand-purple)));
}

/* Dark Mode Variants */
.dark {
  --background: 222.2 84% 4.9%;
  --foreground: 210 40% 98%;

  --card: 222.2 84% 4.9%;
  --card-foreground: 210 40% 98%;

  --popover: 222.2 84% 4.9%;
  --popover-foreground: 210 40% 98%;

  --primary: 210 40% 98%;
  --primary-foreground: 222.2 47.4% 11.2%;

  --secondary: 217.2 32.6% 17.5%;
  --secondary-foreground: 210 40% 98%;

  --muted: 217.2 32.6% 17.5%;
  --muted-foreground: 215 20.2% 65.1%;

  --accent: 217.2 32.6% 17.5%;
  --accent-foreground: 210 40% 98%;

  --destructive: 0 62.8% 30.6%;
  --destructive-foreground: 210 40% 98%;

  --border: 217.2 32.6% 17.5%;
  --input: 217.2 32.6% 17.5%;
  --ring: 212.7 26.8% 83.9%;

  --sidebar-background: 240 5.9% 10%;
  --sidebar-foreground: 240 4.8% 95.9%;
  --sidebar-primary: 224.3 76.3% 48%;
  --sidebar-primary-foreground: 0 0% 100%;
  --sidebar-accent: 240 3.7% 15.9%;
  --sidebar-accent-foreground: 240 4.8% 95.9%;
  --sidebar-border: 240 3.7% 15.9%;
  --sidebar-ring: 217.2 91.2% 59.8%;
}

/* Base Styles Using Design Tokens */
* {
  border-color: hsl(var(--border));
}

body {
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  font-feature-settings: "rlig" 1, "calt" 1;
}

/* Utility Classes for Design Tokens */
.bg-background { background-color: hsl(var(--background)); }
.bg-foreground { background-color: hsl(var(--foreground)); }
.bg-card { background-color: hsl(var(--card)); }
.bg-card-foreground { background-color: hsl(var(--card-foreground)); }
.bg-popover { background-color: hsl(var(--popover)); }
.bg-popover-foreground { background-color: hsl(var(--popover-foreground)); }
.bg-primary { background-color: hsl(var(--primary)); }
.bg-primary-foreground { background-color: hsl(var(--primary-foreground)); }
.bg-secondary { background-color: hsl(var(--secondary)); }
.bg-secondary-foreground { background-color: hsl(var(--secondary-foreground)); }
.bg-muted { background-color: hsl(var(--muted)); }
.bg-muted-foreground { background-color: hsl(var(--muted-foreground)); }
.bg-accent { background-color: hsl(var(--accent)); }
.bg-accent-foreground { background-color: hsl(var(--accent-foreground)); }
.bg-destructive { background-color: hsl(var(--destructive)); }
.bg-destructive-foreground { background-color: hsl(var(--destructive-foreground)); }

.text-background { color: hsl(var(--background)); }
.text-foreground { color: hsl(var(--foreground)); }
.text-card { color: hsl(var(--card)); }
.text-card-foreground { color: hsl(var(--card-foreground)); }
.text-popover { color: hsl(var(--popover)); }
.text-popover-foreground { color: hsl(var(--popover-foreground)); }
.text-primary { color: hsl(var(--primary)); }
.text-primary-foreground { color: hsl(var(--primary-foreground)); }
.text-secondary { color: hsl(var(--secondary)); }
.text-secondary-foreground { color: hsl(var(--secondary-foreground)); }
.text-muted { color: hsl(var(--muted)); }
.text-muted-foreground { color: hsl(var(--muted-foreground)); }
.text-accent { color: hsl(var(--accent)); }
.text-accent-foreground { color: hsl(var(--accent-foreground)); }
.text-destructive { color: hsl(var(--destructive)); }
.text-destructive-foreground { color: hsl(var(--destructive-foreground)); }

.border-border { border-color: hsl(var(--border)); }
.border-input { border-color: hsl(var(--input)); }
.border-ring { border-color: hsl(var(--ring)); }

/* Focus Ring Utility */
.focus-ring {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
}

/* Border Radius Utilities */
.rounded-radius { border-radius: var(--radius); }
.rounded-radius-sm { border-radius: calc(var(--radius) - 2px); }
.rounded-radius-md { border-radius: calc(var(--radius) - 0px); }
.rounded-radius-lg { border-radius: calc(var(--radius) + 2px); }

/* Brand Gradient Utilities */
.bg-brand-gradient { background: var(--brand-gradient); }
.text-brand-gradient {
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Typography Scale - Matching React Tailwind Exactly */
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.text-2xl { font-size: 1.5rem; line-height: 2rem; }
.text-4xl { font-size: 2.25rem; line-height: 2.5rem; }
.text-5xl { font-size: 3rem; line-height: 1; }
.text-6xl { font-size: 3.75rem; line-height: 1; }
.text-7xl { font-size: 4.5rem; line-height: 1; }

/* Responsive Typography */
@media (min-width: 768px) {
  .md\:text-2xl { font-size: 1.5rem; line-height: 2rem; }
  .md\:text-5xl { font-size: 3rem; line-height: 1; }
  .md\:text-6xl { font-size: 3.75rem; line-height: 1; }
  .md\:text-7xl { font-size: 4.5rem; line-height: 1; }
}

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

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

@keyframes pulse-scale {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

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

.animate-float { animation: float 6s ease-in-out infinite; }
.animate-slide-in { animation: slideInFromRight 0.8s ease-out; }
.animate-pulse-scale { animation: pulse-scale 2s ease-in-out infinite; }
.animate-scroll { animation: scroll 30s linear infinite; }

/* Enhanced Button Interactions */
.button-3d {
  box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
  transform: translateY(-2px);
  transition: all 0.2s ease;
}

.button-3d:hover {
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
  transform: translateY(-3px);
}

.button-3d:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
}

/* Glassmorphism Effects */
.glass-effect {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

/* Dark Mode Styles */
.dark {
  --background: 222.2 84% 4.9%;
  --foreground: 210 40% 98%;
  --card: 222.2 84% 8%;
  --card-foreground: 210 40% 98%;
  --primary: 217.2 91.2% 59.8%;
  --primary-foreground: 222.2 47.4% 11.2%;
  --muted: 217.2 32.6% 17.5%;
  --muted-foreground: 215 20.2% 65.1%;
  --border: 217.2 32.6% 20%;
}

/* Utility Classes for Animations */
.transition-all-300 { transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1); }
.hover-lift:hover { transform: translateY(-4px); }

/* Custom Slider Styling */
.slider {
  background: linear-gradient(to right, hsl(220, 91%, 58%) 0%, hsl(220, 91%, 58%) 70%, #d1d5db 70%, #d1d5db 100%);
}

.slider::-webkit-slider-thumb {
  appearance: none;
  height: 20px;
  width: 20px;
  border-radius: 50%;
  background: hsl(220, 91%, 58%);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
}

.slider::-webkit-slider-thumb:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.slider::-moz-range-thumb {
  height: 20px;
  width: 20px;
  border-radius: 50%;
  background: hsl(220, 91%, 58%);
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* Industry Selector Buttons */
.industry-btn {
  background-color: #f3f4f6;
  color: #6b7280;
  border: 2px solid transparent;
  transition: all 0.2s ease;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.industry-btn:hover {
  background-color: #e5e7eb;
  color: #4b5563;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.industry-btn.active {
  background: linear-gradient(to right, #3b82f6, #8b5cf6);
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
  transform: translateY(-1px);
}

.industry-btn.active:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.industry-btn i {
  /* Icon centering now handled by flexbox align-items: center */
}

/* Content Transition Animation */
.content-transition {
  animation: fadeInUp 0.5s ease-out;
}

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

/* Mobile-Only Display Utility */
@media (min-width: 768px) {
  .mobile-only { 
    display: none !important; 
  }
}

/* Screen Reader Only (Accessibility) */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.focus\:not-sr-only:focus {
  position: absolute;
  width: auto;
  height: auto;
  padding: 0.5rem 1rem;
  margin: 0;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

/* Chat Section Animations */
.chat-widget-container {
  transition: all 0.3s ease;
}

.pulse-attention {
  animation: pulseGlow 1s ease-in-out 2;
}

@keyframes pulseGlow {
  0%, 100% { 
    transform: scale(1); 
    box-shadow: 0 0 0 rgba(59, 130, 246, 0); 
  }
  50% { 
    transform: scale(1.02); 
    box-shadow: 0 0 30px rgba(59, 130, 246, 0.3); 
  }
}

/* Blob Background Animations */
@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;
}

/* Chat Section Relative Positioning */
#chat-section {
  position: relative;
}

/* ElevenLabs Widget Centering */
.chat-widget-container elevenlabs-convai {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Ensure the widget iframe is properly sized */
.chat-widget-container iframe {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  border-radius: 12px;
}

/* Content transition animation (smooth without loading overlay) */
.content-transition {
  transition: opacity 0.2s ease-in-out;
}

/* Navigation Active States */
.nav-link {
  position: relative;
  transition: all 0.3s ease;
}

.nav-link.active {
  color: hsl(220, 91%, 58%);
  font-weight: 600;
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(to right, hsl(220, 91%, 58%), hsl(262, 83%, 58%));
  border-radius: 1px;
  transform: scaleX(1);
  transition: transform 0.3s ease;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(to right, hsl(220, 91%, 58%), hsl(262, 83%, 58%));
  border-radius: 1px;
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

/* Mobile navigation active states */
.mobile-nav-link.active {
  color: hsl(220, 91%, 58%);
  font-weight: 600;
  background-color: hsl(220, 91%, 95%);
  border-radius: 0.375rem;
  padding-left: 1rem;
  padding-right: 1rem;
}

/* ============================
   KEYBOARD NAVIGATION & ACCESSIBILITY
   ============================ */

/* Enhanced focus indicators that only show during keyboard navigation */
.keyboard-navigation *:focus {
  outline: 3px solid #2563eb;
  outline-offset: 2px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.8), 0 0 0 4px rgba(37, 99, 235, 0.3);
}

/* Hide focus outline during mouse navigation */
*:focus:not(.keyboard-navigation *) {
  outline: none;
}

/* Specific focus styles for interactive elements */
.keyboard-navigation button:focus,
.keyboard-navigation .industry-btn:focus {
  outline: 3px solid #2563eb;
  outline-offset: 2px;
  background-color: rgba(37, 99, 235, 0.1);
  transform: translateY(-1px);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.8), 
              0 0 0 4px rgba(37, 99, 235, 0.3),
              0 4px 12px rgba(37, 99, 235, 0.2);
}

/* Active industry button focus state */
.keyboard-navigation .industry-btn.active:focus {
  outline: 3px solid #ffffff;
  outline-offset: 2px;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.8), 
              0 0 0 4px rgba(255, 255, 255, 0.9),
              0 6px 16px rgba(37, 99, 235, 0.3);
}

/* Navigation link focus states */
.keyboard-navigation .nav-link:focus,
.keyboard-navigation .mobile-nav-link:focus {
  outline: 2px solid #2563eb;
  outline-offset: 4px;
  background-color: rgba(37, 99, 235, 0.05);
  border-radius: 4px;
  padding: 4px 8px;
  margin: -4px -8px;
}

/* Form element focus states */
.keyboard-navigation input:focus,
.keyboard-navigation select:focus,
.keyboard-navigation textarea:focus {
  outline: 3px solid #2563eb;
  outline-offset: 1px;
  border-color: #2563eb;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.8), 
              0 0 0 4px rgba(37, 99, 235, 0.2);
}

/* Mobile menu focus management */
.keyboard-navigation #mobile-menu a:focus {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
  background-color: rgba(37, 99, 235, 0.1);
  border-radius: 6px;
  padding: 8px 12px;
  margin: -8px -12px;
}

/* Skip link enhanced focus */
.keyboard-navigation .sr-only:focus,
.keyboard-navigation .focus\\:not-sr-only:focus {
  outline: 3px solid #ffffff;
  outline-offset: 2px;
  background: #2563eb;
  color: white;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.8), 
              0 0 0 4px rgba(255, 255, 255, 0.9),
              0 8px 20px rgba(0, 0, 0, 0.3);
  transform: translateY(0);
  font-weight: 600;
}

/* High contrast focus mode for accessibility */
@media (prefers-contrast: high) {
  .keyboard-navigation *:focus {
    outline: 4px solid #000000;
    outline-offset: 2px;
    background-color: #ffffff;
    color: #000000;
    box-shadow: 0 0 0 2px #ffffff, 0 0 0 6px #000000;
  }
  
  .keyboard-navigation .industry-btn.active:focus {
    outline: 4px solid #ffffff;
    background-color: #000000;
    color: #ffffff;
    box-shadow: 0 0 0 2px #000000, 0 0 0 6px #ffffff;
  }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  .keyboard-navigation *:focus {
    transition: none;
    transform: none;
  }
  
  .keyboard-navigation button:focus,
  .keyboard-navigation .industry-btn:focus {
    transform: none;
  }
}

/* Focus within containers */
.keyboard-navigation #industry-selector:focus-within {
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
  border-radius: 8px;
  padding: 4px;
  margin: -4px;
}

/* Keyboard shortcut hints (for future enhancement) */
.keyboard-hint {
  display: none;
  position: absolute;
  bottom: -24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  z-index: 1000;
}

.keyboard-navigation *:focus .keyboard-hint {
  display: block;
}

/* Focus trap indicator */
.focus-trap-active {
  box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.3);
  border-radius: 8px;
}

/* Announcement region for screen readers */
[aria-live] {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Enhanced tabindex -1 focus styles */
.keyboard-navigation [tabindex="-1"]:focus {
  outline: 2px solid rgba(37, 99, 235, 0.8);
  outline-offset: 2px;
}

