/* variables-clean.css - Clean CSS Variables System */
/* No !important declarations - proper CSS cascade */

:root,
#smartfence-embed-root { 
  /* Dynamic colors are loaded from dynamic-colours.php */
  /* These act as the primary color references */
  --primary-color: var(--dynamic-primary-base, #2563eb);
  --primary-dark: var(--dynamic-primary-dark, #1d4ed8);
  --primary-light: var(--dynamic-primary-light, #3b82f6);
  --primary-hover: var(--dynamic-primary-hover, #1e40af);
  --secondary-color: var(--dynamic-secondary-base, #7c3aed);
  --accent-color: var(--dynamic-accent-base, #06b6d4);
  
  /* Static design tokens - these don't change per company */
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;
  --info-color: #3b82f6;
  
  /* Typography colors with better contrast */
  --text-primary: #111827;
  --text-secondary: #111827;
  --text-light: #9ca3af;
  --text-muted: #d1d5db;
  
  /* Background colors */
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #f1f5f9;
  --bg-accent: #fafbfc;
  
  /* Border and spacing */
  --border-color: #a5a6a6;
  --border-light: #e5e7eb;
  --border-radius: 12px;
  --border-radius-sm: 8px;
  --border-radius-lg: 16px;
  --border-radius-xl: 20px;
  
  /* 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);
  
  /* Animation and transitions */
  --transition: all 0.2s ease;
  --transition-fast: all 0.15s ease;
  --transition-slow: all 0.3s ease;
  
  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 1.875rem;
  
  /* Spacing scale */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  
  /* Z-index scale */
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;
  --z-toast: 1080;
}

/* Base styles without aggressive specificity */
#smartfence-embed-root * { 
  box-sizing: border-box;
}

#smartfence-embed-root body { 
  font-family: var(--font-family);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  margin: 0;
  padding: 0;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Remove inline CSS equivalents */
/* These replace the inline styles from index.html */

#smartfence-embed-root .app-container { 
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#smartfence-embed-root .chat-container { 
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 100%;
  margin: 0 auto;
  background-color: var(--bg-primary);
}

#smartfence-embed-root .chat-header { 
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  color: white;
  padding: var(--space-4);
  text-align: center;
  border-radius: 0;
}

#smartfence-embed-root .chat-messages { 
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

#smartfence-embed-root .chat-input-area { 
  padding: var(--space-4);
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
}

#smartfence-embed-root .input-container { 
  display: flex;
  align-items: center;
  background-color: var(--bg-primary);
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: var(--space-2) var(--space-4);
  transition: var(--transition);
}

#smartfence-embed-root .input-container:focus-within { 
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

#smartfence-embed-root .input-container input { 
  flex: 1;
  border: none;
  outline: none;
  font-size: var(--font-size-base);
  color: var(--text-primary);
  background: transparent;
  padding: var(--space-2) 0;
  font-family: var(--font-family);
}

#smartfence-embed-root .input-container input::placeholder { 
  color: var(--text-secondary);
}

#smartfence-embed-root .send-button { 
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  color: white;
  border: none;
  border-radius: var(--border-radius-sm);
  padding: var(--space-2) var(--space-4);
  margin-left: var(--space-2);
  cursor: pointer;
  transition: var(--transition);
  font-weight: 600;
}

#smartfence-embed-root .send-button:hover { 
  background: var(--primary-hover);
  transform: translateY(-1px);
}

#smartfence-embed-root .send-button:disabled { 
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Quick actions */
#smartfence-embed-root .quick-actions { 
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  overflow-x: auto;
  padding-bottom: var(--space-1);
  scrollbar-width: none;
}

#smartfence-embed-root .quick-actions::-webkit-scrollbar { 
  display: none;
}

#smartfence-embed-root .quick-action { 
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  color: white;
  border: none;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--border-radius-sm);
  font-size: var(--font-size-sm);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  font-weight: 600;
}

#smartfence-embed-root .quick-action:hover { 
  background: var(--primary-hover);
  transform: translateY(-1px);
}

/* Message styling */
#smartfence-embed-root .message { 
  margin-bottom: var(--space-3);
  opacity: 0;
  animation: fadeInSlide 0.4s ease-out forwards;
}

#smartfence-embed-root .message-content { 
  padding: var(--space-4) var(--space-5);
  border-radius: var(--border-radius);
  font-size: var(--font-size-base);
  line-height: 1.6;
  word-wrap: break-word;
}

#smartfence-embed-root .user-message { 
  align-self: flex-end;
  max-width: 75%;
}

#smartfence-embed-root .user-message .message-content { 
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  color: white;
}

#smartfence-embed-root .bot-message { 
  align-self: flex-start;
  max-width: 75%;
}

#smartfence-embed-root .bot-message .message-content { 
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

/* Welcome message */
#smartfence-embed-root .welcome-message-container { 
  width: 100%;
  align-self: stretch;
}

#smartfence-embed-root .welcome-message-container .message-content { 
  background-color: transparent;
  border: 1px solid var(--border-color);
  text-align: center;
  padding: var(--space-6);
}

/* Error states */
#smartfence-embed-root .error-message .message-content { 
  background-color: #fef2f2;
  border: 1px solid #fecaca;
  color: var(--danger-color);
}

/* Loading states */
#smartfence-embed-root .typing-indicator { 
  background-color: var(--bg-tertiary);
  color: var(--text-secondary);
  font-style: italic;
}

/* Animation keyframes */
@keyframes fadeInSlide {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive design */
@media (max-width: 768px) {
  #smartfence-embed-root .chat-container { 
    height: 100vh;
  }
  
  #smartfence-embed-root .chat-messages { 
    padding: var(--space-3);
  }
  
  #smartfence-embed-root .chat-input-area { 
    padding: var(--space-3);
    padding-bottom: calc(var(--space-3) + env(safe-area-inset-bottom));
  }
  
  .user-message,
  #smartfence-embed-root .bot-message { 
    max-width: 90%;
  }
  
  #smartfence-embed-root .quick-actions { 
    flex-wrap: wrap;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root,
  #smartfence-embed-root { 
    --border-color: #000000;
    --text-secondary: #000000;
    --bg-tertiary: #f0f0f0;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  #smartfence-embed-root * { 
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}