/**
 * The One Group - Sophisticated UI Library
 * Enhanced styles for professional AI automation consultancy
 */

/* ==========================================================================
   CSS Custom Properties (Design Tokens)
   ========================================================================== */
:root {
  /* Primary palette - refined */
  --color-primary-50: #eff6ff;
  --color-primary-100: #dbeafe;
  --color-primary-200: #bfdbfe;
  --color-primary-300: #93c5fd;
  --color-primary-400: #60a5fa;
  --color-primary-500: #3b82f6;
  --color-primary-600: #2563eb;
  --color-primary-700: #1d4ed8;
  --color-primary-800: #1e40af;
  --color-primary-900: #1e3a8a;
  
  /* Accent palette - purple sophistication */
  --color-accent-400: #a78bfa;
  --color-accent-500: #8b5cf6;
  --color-accent-600: #7c3aed;
  --color-accent-700: #6d28d9;
  
  /* Semantic colors */
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-error: #ef4444;
  
  /* Service-specific accents */
  --color-audit: #3b82f6;
  --color-optimization: #10b981;
  --color-intel: #f59e0b;
  --color-content: #8b5cf6;
  
  /* Neutral scale */
  --color-gray-50: #f9fafb;
  --color-gray-100: #f3f4f6;
  --color-gray-200: #e5e7eb;
  --color-gray-300: #d1d5db;
  --color-gray-400: #9ca3af;
  --color-gray-500: #6b7280;
  --color-gray-600: #4b5563;
  --color-gray-700: #374151;
  --color-gray-800: #1f2937;
  --color-gray-900: #111827;
  
  /* Dark mode specific */
  --color-dark-bg: #0f172a;
  --color-dark-surface: #1e293b;
  --color-dark-elevated: #334155;
  
  /* Typography */
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Space Grotesk', var(--font-sans);
  --font-mono: 'IBM Plex Mono', 'SF Mono', monospace;
  
  /* Spacing scale */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  
  /* Shadows - refined depth */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 
    0 4px 6px -1px rgb(0 0 0 / 0.1),
    0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 
    0 10px 15px -3px rgb(0 0 0 / 0.1),
    0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 
    0 20px 25px -5px rgb(0 0 0 / 0.1),
    0 8px 10px -6px rgb(0 0 0 / 0.1);
  --shadow-glow: 
    0 0 40px -10px var(--color-primary-500);
  --shadow-glow-accent: 
    0 0 40px -10px var(--color-accent-500);
  
  /* Border radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  --radius-full: 9999px;
  
  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 500ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
  
  /* Z-index scale */
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-modal: 300;
  --z-tooltip: 400;
  --z-toast: 500;
}

/* ==========================================================================
   Base Typography Refinement
   ========================================================================== */
html {
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Improved heading hierarchy */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

h1 {
  font-size: clamp(2.5rem, 5vw, 4rem);
  line-height: 1;
}

h2 {
  font-size: clamp(1.875rem, 4vw, 2.5rem);
}

h3 {
  font-size: clamp(1.25rem, 3vw, 1.5rem);
}

/* Body text refinement */
p {
  line-height: 1.7;
}

/* Monospace accent for technical elements */
.code-text,
.tech-label {
  font-family: var(--font-mono);
  font-size: 0.875em;
  letter-spacing: 0.02em;
}

/* ==========================================================================
   Navigation Enhancements
   ========================================================================== */
.nav-sophisticated {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-sticky);
  transition: all var(--transition-base);
}

.nav-sophisticated.scrolled {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  box-shadow: var(--shadow-sm);
}

.dark .nav-sophisticated.scrolled {
  background: rgba(15, 23, 42, 0.85);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* Animated underline for nav links */
.nav-link {
  position: relative;
  color: var(--color-gray-600);
  transition: color var(--transition-fast);
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--color-primary-500), var(--color-accent-500));
  transition: all var(--transition-base);
  transform: translateX(-50%);
}

.nav-link:hover::after {
  width: 100%;
}

.nav-link:hover {
  color: var(--color-primary-600);
}

/* ==========================================================================
   Card Components - Elevated Design
   ========================================================================== */
.card-elevated {
  background: linear-gradient(
    145deg,
    rgba(255, 255, 255, 0.9) 0%,
    rgba(255, 255, 255, 0.7) 100%
  );
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-xl);
  box-shadow: 
    var(--shadow-md),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
  transition: all var(--transition-slow);
  position: relative;
  overflow: hidden;
}

.card-elevated::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.8),
    transparent
  );
}

.card-elevated:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow: 
    var(--shadow-xl),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.dark .card-elevated {
  background: linear-gradient(
    145deg,
    rgba(30, 41, 59, 0.9) 0%,
    rgba(15, 23, 42, 0.9) 100%
  );
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 
    var(--shadow-md),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.dark .card-elevated::before {
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
}

/* Popular plan card with glow */
.card-popular {
  border: 2px solid var(--color-primary-500);
  position: relative;
}

.card-popular::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: var(--radius-xl);
  background: linear-gradient(
    135deg,
    var(--color-primary-500),
    var(--color-accent-500)
  );
  opacity: 0;
  z-index: -1;
  transition: opacity var(--transition-slow);
  filter: blur(20px);
}

.card-popular:hover::after {
  opacity: 0.3;
}

/* ==========================================================================
   Button Micro-interactions
   ========================================================================== */
.btn-primary {
  position: relative;
  background: linear-gradient(135deg, var(--color-primary-500), var(--color-accent-600));
  color: white;
  font-weight: 600;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-lg);
  border: none;
  cursor: pointer;
  overflow: hidden;
  transition: all var(--transition-base);
  transform: translateY(0);
  box-shadow: 
    0 4px 14px 0 rgba(59, 130, 246, 0.39),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-primary::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left 0.5s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 
    0 6px 20px 0 rgba(59, 130, 246, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.btn-primary:hover::before {
  left: 100%;
}

.btn-primary:active {
  transform: translateY(0);
}

/* Secondary button style */
.btn-secondary {
  background: transparent;
  border: 2px solid var(--color-primary-500);
  color: var(--color-primary-600);
  position: relative;
  overflow: hidden;
  z-index: 1;
}

.btn-secondary::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 100%;
  background: var(--color-primary-500);
  transition: width var(--transition-base);
  z-index: -1;
}

.btn-secondary:hover {
  color: white;
}

.btn-secondary:hover::before {
  width: 100%;
}

/* ==========================================================================
   Gradient Text Effects
   ========================================================================== */
.gradient-text {
  background: linear-gradient(
    135deg,
    var(--color-primary-500) 0%,
    var(--color-accent-500) 50%,
    var(--color-primary-600) 100%
  );
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradient-shift 8s ease infinite;
}

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

/* Subtle shimmer effect */
.shimmer-text {
  position: relative;
  display: inline-block;
}

.shimmer-text::after {
  content: attr(data-text);
  position: absolute;
  left: 0;
  top: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.4) 50%,
    transparent 100%
  );
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  animation: shimmer 3s infinite;
  pointer-events: none;
}

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

/* ==========================================================================
   Agent Cards - Interactive Visualization
   ========================================================================== */
.agent-card {
  background: linear-gradient(
    145deg,
    rgba(30, 41, 59, 0.95) 0%,
    rgba(15, 23, 42, 0.98) 100%
  );
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  position: relative;
  overflow: hidden;
  transition: all var(--transition-slow);
  cursor: pointer;
}

.agent-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--agent-color, var(--color-primary-500)),
    transparent
  );
  opacity: 0.5;
}

.agent-card:hover {
  transform: translateY(-8px) scale(1.02);
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 
    0 20px 40px -10px rgba(0, 0, 0, 0.5),
    0 0 30px -5px var(--agent-color, var(--color-primary-500));
}

/* Agent status indicator */
.agent-status {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--color-success);
  box-shadow: 0 0 10px var(--color-success);
}

.agent-status::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: var(--radius-full);
  border: 2px solid var(--color-success);
  animation: pulse-ring 2s ease-out infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(2); opacity: 0; }
}

/* Agent icon styling */
.agent-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  background: linear-gradient(
    135deg,
    var(--agent-color, var(--color-primary-500)),
    var(--agent-color-secondary, var(--color-accent-500))
  );
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: var(--space-4);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* ==========================================================================
   Mission Control Dashboard Preview
   ========================================================================== */
.dashboard-preview {
  background: var(--color-dark-bg);
  border-radius: var(--radius-2xl);
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
  position: relative;
  box-shadow: 
    0 25px 50px -12px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.dashboard-preview::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
}

/* Dashboard header bar */
.dashboard-header {
  background: rgba(30, 41, 59, 0.8);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.dashboard-dot {
  width: 12px;
  height: 12px;
  border-radius: var(--radius-full);
}

.dashboard-dot.red { background: #ff5f56; }
.dashboard-dot.yellow { background: #ffbd2e; }
.dashboard-dot.green { background: #27c93f; }

/* Dashboard content grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
  padding: var(--space-6);
}

.dashboard-metric {
  background: rgba(30, 41, 59, 0.6);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: all var(--transition-base);
}

.dashboard-metric:hover {
  background: rgba(30, 41, 59, 0.8);
  border-color: rgba(255, 255, 255, 0.1);
}

.metric-value {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-primary-400);
}

.metric-label {
  font-size: 0.75rem;
  color: var(--color-gray-400);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: var(--space-1);
}

/* ==========================================================================
   Model Routing Showcase
   ========================================================================== */
.model-router {
  background: linear-gradient(
    145deg,
    rgba(15, 23, 42, 0.95) 0%,
    rgba(30, 41, 59, 0.98) 100%
  );
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  position: relative;
  overflow: hidden;
}

.model-router::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 20% 50%, rgba(59, 130, 246, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 50%, rgba(139, 92, 246, 0.1) 0%, transparent 50%);
  pointer-events: none;
}

.model-card {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  position: relative;
  transition: all var(--transition-base);
}

.model-card.gpt {
  --model-color: #10a37f;
  border-left: 3px solid var(--model-color);
}

.model-card.claude {
  --model-color: #d97757;
  border-left: 3px solid var(--model-color);
}

.model-card.gemini {
  --model-color: #8b5cf6;
  border-left: 3px solid var(--model-color);
}

.model-card:hover {
  transform: translateX(8px);
  background: rgba(30, 41, 59, 0.95);
  box-shadow: -10px 0 30px -10px var(--model-color);
}

.model-name {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--model-color);
  margin-bottom: var(--space-2);
}

.model-use-case {
  color: var(--color-gray-300);
  font-size: 0.9375rem;
}

/* ==========================================================================
   Loading & Animation Utilities
   ========================================================================== */
.animate-fade-in {
  animation: fade-in 0.6s ease-out forwards;
}

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

.animate-scale-in {
  animation: scale-in 0.4s ease-out forwards;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes scale-in {
  from { 
    opacity: 0;
    transform: scale(0.95);
  }
  to { 
    opacity: 1;
    transform: scale(1);
  }
}

/* Staggered animation delays */
.stagger-1 { animation-delay: 0.1s; }
.stagger-2 { animation-delay: 0.2s; }
.stagger-3 { animation-delay: 0.3s; }
.stagger-4 { animation-delay: 0.4s; }
.stagger-5 { animation-delay: 0.5s; }

/* Skeleton loading state */
.skeleton {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.05) 0%,
    rgba(255, 255, 255, 0.1) 50%,
    rgba(255, 255, 255, 0.05) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}

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

/* ==========================================================================
   Toast & Notification Styles
   ========================================================================== */
.toast {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  background: rgba(30, 41, 59, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-6);
  box-shadow: var(--shadow-xl);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  transform: translateY(100px);
  opacity: 0;
  transition: all var(--transition-base);
  z-index: var(--z-toast);
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.success { border-left: 3px solid var(--color-success); }
.toast.error { border-left: 3px solid var(--color-error); }
.toast.warning { border-left: 3px solid var(--color-warning); }

/* ==========================================================================
   Dark Mode Specific Enhancements
   ========================================================================== */
.dark body {
  background: var(--color-dark-bg);
  background-image: 
    radial-gradient(circle at 0% 0%, rgba(59, 130, 246, 0.05) 0%, transparent 50%),
    radial-gradient(circle at 100% 0%, rgba(139, 92, 246, 0.05) 0%, transparent 50%),
    radial-gradient(circle at 50% 100%, rgba(16, 185, 129, 0.03) 0%, transparent 50%);
  background-attachment: fixed;
}

/* Noise texture overlay for dark mode */
.dark body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  opacity: 0.02;
  pointer-events: none;
  z-index: -1;
}

/* Glow effects for dark mode */
.dark .glow-primary {
  box-shadow: 0 0 40px -10px rgba(59, 130, 246, 0.3);
}

.dark .glow-accent {
  box-shadow: 0 0 40px -10px rgba(139, 92, 246, 0.3);
}

/* ==========================================================================
   Responsive Utilities
   ========================================================================== */
@media (max-width: 768px) {
  h1 { font-size: 2.5rem; }
  h2 { font-size: 1.875rem; }
  h3 { font-size: 1.25rem; }
  
  .card-elevated:hover {
    transform: translateY(-2px);
  }
  
  .agent-card:hover {
    transform: translateY(-4px);
  }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */
@media print {
  .nav-sophisticated,
  .btn-primary,
  .dashboard-preview {
    display: none;
  }
  
  body {
    background: white;
    color: black;
  }
}

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