@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

@tailwind base;
@tailwind components;
@tailwind utilities;

@layer components {
  /* SyndicPro Design System - Component Styles */
  
  /* KPI Card */
  .kpi-card {
    position: relative;
    overflow: hidden;
    transition: all 200ms ease;
  }
  
  /* Button variants helpers */
  .btn-primary {
    background-color: hsl(var(--accent));
    color: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 200ms ease;
  }
  
  .btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-0.5px);
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
  }
  
  .btn-primary:active {
    transform: translateY(0);
  }
  
  .btn-secondary {
    border: 2px solid hsl(var(--foreground));
    background-color: transparent;
    color: hsl(var(--foreground));
    transition: all 200ms ease;
  }
  
  .btn-secondary:hover {
    background-color: hsl(var(--foreground));
    color: hsl(var(--background));
  }
  
  .btn-destructive {
    background-color: hsl(var(--destructive));
    color: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 200ms ease;
  }
  
  .btn-destructive:hover {
    opacity: 0.9;
    transform: translateY(-0.5px);
  }
  
  .btn-destructive:active {
    transform: translateY(0);
  }
  
  /* Badge variants */
  .badge-success {
    border: 1px solid hsl(var(--accent) / 0.3);
    background-color: hsl(var(--accent) / 0.15);
    color: hsl(var(--accent));
  }
  
  .badge-error {
    border: 1px solid hsl(var(--destructive) / 0.3);
    background-color: hsl(var(--destructive) / 0.15);
    color: hsl(var(--destructive));
  }
  
  .badge-warning {
    border: 1px solid rgb(234 179 8 / 0.3);
    background-color: rgb(234 179 8 / 0.15);
    color: rgb(234 179 8);
  }
  
  .badge-info {
    border: 1px solid rgb(59 130 246 / 0.3);
    background-color: rgb(59 130 246 / 0.15);
    color: rgb(59 130 246);
  }
  
  /* Form styles */
  .form-label {
    display: block;
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: hsl(var(--foreground));
    font-size: 0.875rem;
  }
  
  .input {
    display: flex;
    height: 2.75rem;
    min-height: 44px;
    width: 100%;
    border-radius: 0.5rem;
    border: 1px solid hsl(var(--border));
    background-color: hsl(var(--card));
    padding: 0.75rem 1rem;
    font-size: 1rem;
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    color: hsl(var(--foreground));
    transition: all 200ms ease;
  }
  
  .input:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px hsl(var(--accent));
    border-color: hsl(var(--accent));
  }
  
  .input:disabled {
    cursor: not-allowed;
    opacity: 0.5;
  }
  
  /* Table styles */
  .table-container {
    overflow-x: auto;
    border-radius: 0.75rem;
    border: 1px solid hsl(var(--border));
  }
  
  .table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  }
  
  .table thead {
    background-color: hsl(var(--card));
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }
  
  .table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    color: hsl(var(--muted-foreground));
    border-bottom: 1px solid hsl(var(--border));
  }
  
  .table tbody tr {
    background-color: hsl(var(--background));
    transition: background-color 200ms ease;
  }
  
  .table tbody tr:hover {
    background-color: hsl(var(--card) / 0.5);
  }
  
  .table td {
    padding: 1rem;
    border-bottom: 1px solid hsl(var(--border) / 0.5);
    color: hsl(var(--foreground));
  }
  
  .table tbody tr:last-child td {
    border-bottom: 0;
  }
  
  /* Loading states */
  .spinner {
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid hsl(var(--muted));
    border-top-color: hsl(var(--accent));
    border-radius: 9999px;
    animation: spin 0.6s linear infinite;
  }
  
  @keyframes spin {
    to {
      transform: rotate(360deg);
    }
  }
  
  .skeleton {
    background: linear-gradient(
      90deg,
      hsl(var(--muted) / 0.5) 0%,
      hsl(var(--muted)) 50%,
      hsl(var(--muted) / 0.5) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: 0.25rem;
  }
  
  @keyframes shimmer {
    0% {
      background-position: 200% 0;
    }
    100% {
      background-position: -200% 0;
    }
  }
  
  /* Utility classes */
  .text-accent {
    color: hsl(var(--accent));
  }
  
  .text-technical {
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    font-weight: 600;
    letter-spacing: -0.01em;
  }
  
  .cursor-pointer {
    cursor: pointer;
  }
  
  .transition-smooth {
    transition: all 200ms ease-in-out;
  }
}

@layer utilities {
  @keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    33%       { transform: translateY(-18px) rotate(1deg); }
    66%       { transform: translateY(-8px) rotate(-1deg); }
  }
  @keyframes float-delayed {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    33%       { transform: translateY(-12px) rotate(-1deg); }
    66%       { transform: translateY(-22px) rotate(1deg); }
  }
  @keyframes fade-in-up {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
  }
  @keyframes fade-in-right {
    from { opacity: 0; transform: translateX(-24px); }
    to   { opacity: 1; transform: translateX(0); }
  }
  @keyframes fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
  }
  @keyframes scale-in {
    from { opacity: 0; transform: scale(0.92); }
    to   { opacity: 1; transform: scale(1); }
  }
  @keyframes shake {
    0%, 100% { transform: translateX(0); }
    15%      { transform: translateX(-6px); }
    30%      { transform: translateX(6px); }
    45%      { transform: translateX(-4px); }
    60%      { transform: translateX(4px); }
    75%      { transform: translateX(-2px); }
    90%      { transform: translateX(2px); }
  }
  @keyframes orb-pulse {
    0%, 100% { opacity: 0.18; transform: scale(1); }
    50%       { opacity: 0.28; transform: scale(1.08); }
  }
  @keyframes orb-pulse-2 {
    0%, 100% { opacity: 0.12; transform: scale(1); }
    50%       { opacity: 0.22; transform: scale(1.12); }
  }
  @keyframes shimmer-line {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(400%); }
  }

  .animate-float         { animation: float 6s ease-in-out infinite; }
  .animate-float-delayed { animation: float-delayed 8s ease-in-out infinite; }
  .animate-fade-in-up    { animation: fade-in-up 0.6s cubic-bezier(.22,1,.36,1) both; }
  .animate-fade-in-right { animation: fade-in-right 0.6s cubic-bezier(.22,1,.36,1) both; }
  .animate-fade-in       { animation: fade-in 0.5s ease both; }
  .animate-scale-in      { animation: scale-in 0.5s cubic-bezier(.22,1,.36,1) both; }
  .animate-shake         { animation: shake 0.45s ease both; }
  .animate-orb-pulse     { animation: orb-pulse 4s ease-in-out infinite; }
  .animate-orb-pulse-2   { animation: orb-pulse-2 6s ease-in-out infinite; }

  .delay-100 { animation-delay: 100ms; }
  .delay-150 { animation-delay: 150ms; }
  .delay-200 { animation-delay: 200ms; }
  .delay-300 { animation-delay: 300ms; }
  .delay-400 { animation-delay: 400ms; }
  .delay-500 { animation-delay: 500ms; }
  .delay-600 { animation-delay: 600ms; }
  .delay-700 { animation-delay: 700ms; }
}

@layer base {
  :root {
    /* SyndicPro Design System - Light Mode (fallback) */
    --background: 210 40% 98%;
    --foreground: 222 47% 11%;
    --card: 0 0% 100%;
    --card-foreground: 222 47% 11%;
    --primary: 217 91% 35%;
    --primary-foreground: 0 0% 100%;
    --secondary: 217 33% 17%;
    --secondary-foreground: 210 40% 98%;
    --muted: 210 40% 96%;
    --muted-foreground: 215 16% 47%;
    --accent: 142 71% 45%;
    --accent-foreground: 0 0% 100%;
    --destructive: 0 84% 60%;
    --destructive-foreground: 210 40% 98%;
    --border: 214 32% 91%;
    --input: 214 32% 91%;
    --ring: 217 91% 35%;
    --radius: 0.75rem;

    /* SyndicPro Spacing System (8dp grid) */
    --space-xs: 0.25rem;   /* 4px */
    --space-sm: 0.5rem;    /* 8px */
    --space-md: 1rem;      /* 16px */
    --space-lg: 1.5rem;    /* 24px */
    --space-xl: 2rem;      /* 32px */
    --space-2xl: 3rem;     /* 48px */
    --space-3xl: 4rem;     /* 64px */

    /* SyndicPro Shadow Depths */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.15);
  }

  .bg-green-600 {
    background-color: #16a34a;
  }

  .bg-red-600 {
    background-color : #dc2626;
  }

  .bg-gray-600 {
    background-color: #6b7280;
  }

  .bg-pink-600 {
    background-color: #ec4899;
  }

  .bg-blue-800 {
    background-color: #2563eb;
  }

  .dark {
    /* SyndicPro Design System - Dark Mode (Primary) */
    --background: 222 84% 5%;      /* #020617 */
    --foreground: 210 40% 98%;     /* #F8FAFC */
    --card: 222 47% 11%;           /* #0F172A */
    --card-foreground: 210 40% 98%;
    --primary: 217 91% 35%;        /* #0946aa */
    --primary-foreground: 0 0% 100%;
    --secondary: 217 33% 17%;      /* #1E293B */
    --secondary-foreground: 210 40% 98%;
    --muted: 225 30% 14%;          /* #1A1E2F */
    --muted-foreground: 215 20% 65%;
    --accent: 142 71% 45%;         /* #22C55E - Green accent */
    --accent-foreground: 0 0% 100%;
    --destructive: 0 84% 60%;      /* #EF4444 */
    --destructive-foreground: 210 40% 98%;
    --border: 215 25% 27%;         /* #334155 */
    --input: 215 25% 27%;
    --ring: 217 91% 35%;
  }

  * {
    @apply border-border;
  }

  body {
    @apply bg-background text-foreground antialiased;
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  }

  /* SyndicPro Design System - Global Interactions */
  button, a, [role="button"] {
    cursor: pointer;
    transition: all 200ms ease;
  }

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

  /* Typography scale */
  h1, h2, h3, h4, h5, h6 {
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    font-weight: 700;
    letter-spacing: -0.02em;
  }

  /* Focus states for accessibility */
  :focus-visible {
    outline: 2px solid hsl(var(--ring));
    outline-offset: 2px;
  }
}
