/* ==========================================================================
   URBot.net Design Token System
   Foundational CSS custom properties and utility classes.
   All pages import this file for consistent styling.

   Dark theme is the default. Light theme activates via
   @media (prefers-color-scheme: light).

   Breakpoint reference (cannot be used in media queries):
     --urbot-bp-sm: 640px
     --urbot-bp-md: 768px
     --urbot-bp-lg: 1024px
     --urbot-bp-xl: 1280px
   ========================================================================== */


/* --------------------------------------------------------------------------
   1. COLOR TOKENS
   -------------------------------------------------------------------------- */

:root {
  /* Brand / action colors */
  --urbot-primary: #6366f1;
  --urbot-primary-hover: #4f46e5;
  --urbot-primary-light: #8b5cf6;
  --urbot-accent: #f59e0b;

  /* Semantic colors */
  --urbot-success: #22c55e;
  --urbot-warning: #f59e0b;
  --urbot-danger: #ef4444;
  --urbot-info: #3b82f6;

  /* Neutral scale */
  --urbot-gray-50:  #f8fafc;
  --urbot-gray-100: #f1f5f9;
  --urbot-gray-200: #e2e8f0;
  --urbot-gray-300: #cbd5e1;
  --urbot-gray-400: #94a3b8;
  --urbot-gray-500: #64748b;
  --urbot-gray-600: #475569;
  --urbot-gray-700: #334155;
  --urbot-gray-800: #1e293b;
  --urbot-gray-900: #0f172a;
  --urbot-gray-950: #020617;

  /* Surface colors (dark theme default) */
  --urbot-bg-base: #0a0a1a;
  --urbot-bg-surface: #0f172a;
  --urbot-bg-elevated: #1e293b;
  --urbot-bg-overlay: rgba(0, 0, 0, 0.6);

  /* Text colors */
  --urbot-text-primary: #f1f5f9;
  --urbot-text-secondary: #94a3b8;
  --urbot-text-muted: #64748b;

  /* Border colors */
  --urbot-border: rgba(255, 255, 255, 0.08);
  --urbot-border-focus: rgba(99, 102, 241, 0.5);


/* --------------------------------------------------------------------------
   2. TYPOGRAPHY TOKENS
   -------------------------------------------------------------------------- */

  --urbot-font-sans: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --urbot-font-mono: 'Cascadia Code', 'Fira Code', Consolas, monospace;

  --urbot-text-xs:  0.75rem;    /* 12px */
  --urbot-text-sm:  0.8125rem;  /* 13px */
  --urbot-text-base: 0.875rem;  /* 14px */
  --urbot-text-md:  1rem;       /* 16px */
  --urbot-text-lg:  1.125rem;   /* 18px */
  --urbot-text-xl:  1.5rem;     /* 24px */
  --urbot-text-2xl: 1.75rem;    /* 28px */
  --urbot-text-3xl: 2.25rem;    /* 36px */


/* --------------------------------------------------------------------------
   3. SPACING SCALE (4px base unit)
   -------------------------------------------------------------------------- */

  --urbot-space-1:  4px;
  --urbot-space-2:  8px;
  --urbot-space-3:  12px;
  --urbot-space-4:  16px;
  --urbot-space-5:  20px;
  --urbot-space-6:  24px;
  --urbot-space-8:  32px;
  --urbot-space-10: 40px;
  --urbot-space-12: 48px;


/* --------------------------------------------------------------------------
   4. BORDER RADIUS
   -------------------------------------------------------------------------- */

  --urbot-radius-sm:   6px;
  --urbot-radius-md:   10px;
  --urbot-radius-lg:   14px;
  --urbot-radius-xl:   20px;
  --urbot-radius-full: 9999px;


/* --------------------------------------------------------------------------
   5. SHADOWS (depth system)
   -------------------------------------------------------------------------- */

  --urbot-shadow-sm:  0 1px 3px rgba(0, 0, 0, 0.12);
  --urbot-shadow-md:  0 4px 12px rgba(0, 0, 0, 0.15);
  --urbot-shadow-lg:  0 8px 24px rgba(0, 0, 0, 0.2);
  --urbot-shadow-glow: 0 0 20px rgba(99, 102, 241, 0.3);


/* --------------------------------------------------------------------------
   6. ANIMATION TOKENS
   -------------------------------------------------------------------------- */

  --urbot-duration-fast:   150ms;
  --urbot-duration-normal: 300ms;
  --urbot-duration-slow:   500ms;

  --urbot-ease-default: cubic-bezier(0.4, 0, 0.2, 1);
  --urbot-ease-in:      cubic-bezier(0.4, 0, 1, 1);
  --urbot-ease-out:     cubic-bezier(0, 0, 0.2, 1);
  --urbot-ease-bounce:  cubic-bezier(0.34, 1.56, 0.64, 1);
}


/* ==========================================================================
   UTILITY CLASSES
   ========================================================================== */


/* --------------------------------------------------------------------------
   7. LAYOUT UTILITIES
   -------------------------------------------------------------------------- */

.urbot-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--urbot-space-4);
}

.urbot-flex {
  display: flex;
}

.urbot-flex-col {
  display: flex;
  flex-direction: column;
}

.urbot-flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.urbot-grid-auto {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--urbot-space-4);
}


/* --------------------------------------------------------------------------
   8. BUTTON VARIANTS
   -------------------------------------------------------------------------- */

.urbot-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--urbot-radius-md);
  font-family: var(--urbot-font-sans);
  font-size: var(--urbot-text-base);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--urbot-duration-fast) var(--urbot-ease-default);
  border: none;
}

.urbot-btn-primary {
  background: var(--urbot-primary);
  color: white;
}

.urbot-btn-primary:hover {
  background: var(--urbot-primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--urbot-shadow-glow);
}

.urbot-btn-secondary {
  background: transparent;
  border: 1px solid var(--urbot-border);
  color: var(--urbot-text-primary);
}

.urbot-btn-ghost {
  background: transparent;
  color: var(--urbot-text-secondary);
}

.urbot-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}


/* --------------------------------------------------------------------------
   9. CARD COMPONENTS
   -------------------------------------------------------------------------- */

.urbot-card {
  background: var(--urbot-bg-surface);
  border: 1px solid var(--urbot-border);
  border-radius: var(--urbot-radius-lg);
  padding: var(--urbot-space-5);
}

.urbot-card-hover:hover {
  border-color: var(--urbot-border-focus);
  box-shadow: var(--urbot-shadow-md);
  transform: translateY(-2px);
  transition: all var(--urbot-duration-normal) var(--urbot-ease-out);
}


/* --------------------------------------------------------------------------
   10. TYPOGRAPHY UTILITIES
   -------------------------------------------------------------------------- */

.urbot-heading-lg {
  font-size: var(--urbot-text-2xl);
  font-weight: 700;
  color: var(--urbot-text-primary);
  line-height: 1.2;
}

.urbot-heading-md {
  font-size: var(--urbot-text-xl);
  font-weight: 600;
  color: var(--urbot-text-primary);
  line-height: 1.3;
}

.urbot-heading-sm {
  font-size: var(--urbot-text-lg);
  font-weight: 600;
  color: var(--urbot-text-primary);
  line-height: 1.4;
}

.urbot-text-muted {
  color: var(--urbot-text-muted);
}

.urbot-text-small {
  font-size: var(--urbot-text-sm);
}


/* --------------------------------------------------------------------------
   11. LOADING / SKELETON STATES
   -------------------------------------------------------------------------- */

.urbot-skeleton {
  background: linear-gradient(
    90deg,
    var(--urbot-bg-elevated) 25%,
    rgba(255, 255, 255, 0.05) 50%,
    var(--urbot-bg-elevated) 75%
  );
  background-size: 200% 100%;
  animation: urbot-skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: var(--urbot-radius-sm);
}

@keyframes urbot-skeleton-shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}

.urbot-skeleton-text {
  height: 14px;
  width: 80%;
  margin-bottom: 8px;
}

.urbot-skeleton-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

.urbot-skeleton-card {
  height: 120px;
}


/* --------------------------------------------------------------------------
   12. ERROR / EMPTY STATES
   -------------------------------------------------------------------------- */

.urbot-error-state {
  text-align: center;
  padding: var(--urbot-space-8);
  color: var(--urbot-text-muted);
}

.urbot-error-state svg {
  width: 48px;
  height: 48px;
  margin-bottom: var(--urbot-space-3);
  opacity: 0.4;
}

.urbot-empty-state {
  text-align: center;
  padding: var(--urbot-space-10);
  color: var(--urbot-text-muted);
}


/* --------------------------------------------------------------------------
   13. TOAST NOTIFICATIONS
   -------------------------------------------------------------------------- */

.urbot-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  background: var(--urbot-bg-elevated);
  border: 1px solid var(--urbot-border);
  border-radius: var(--urbot-radius-md);
  color: var(--urbot-text-primary);
  font-size: var(--urbot-text-sm);
  box-shadow: var(--urbot-shadow-lg);
  z-index: 10000;
  animation: urbot-toast-in var(--urbot-duration-normal) var(--urbot-ease-out);
}

.urbot-toast-success {
  border-color: var(--urbot-success);
}

.urbot-toast-error {
  border-color: var(--urbot-danger);
}

@keyframes urbot-toast-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}


/* --------------------------------------------------------------------------
   14. ACCESSIBILITY
   -------------------------------------------------------------------------- */

.urbot-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.urbot-skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--urbot-primary);
  color: white;
  padding: 8px 16px;
  z-index: 100000;
  transition: top var(--urbot-duration-fast);
}

.urbot-skip-link:focus {
  top: 0;
}

.urbot-focus-ring:focus-visible {
  outline: 2px solid var(--urbot-primary);
  outline-offset: 2px;
}


/* --------------------------------------------------------------------------
   15. REDUCED MOTION
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .urbot-skeleton {
    animation: none;
    background: var(--urbot-bg-elevated);
  }
}


/* --------------------------------------------------------------------------
   16. LIGHT THEME OVERRIDES
   -------------------------------------------------------------------------- */

@media (prefers-color-scheme: light) {
  :root {
    --urbot-bg-base: #ffffff;
    --urbot-bg-surface: #f8fafc;
    --urbot-bg-elevated: #f1f5f9;
    --urbot-text-primary: #0f172a;
    --urbot-text-secondary: #475569;
    --urbot-text-muted: #94a3b8;
    --urbot-border: rgba(0, 0, 0, 0.08);
    --urbot-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --urbot-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  }
}
