@import "tailwindcss";
@import "tw-animate-css";
@import "shadcn/tailwind.css";
@source "../";

@custom-variant dark (&:is(.dark *));

:root {
  --font-size: 16px;
  --background: #ffffff;
  --foreground: oklch(0.145 0 0);
  --card: #ffffff;
  --card-foreground: oklch(0.145 0 0);
  --popover: oklch(1 0 0);
  --popover-foreground: oklch(0.145 0 0);
  --primary: #235287;
  --primary-foreground: oklch(1 0 0);
  --brand-dark-blue: #235287;
  --brand-navy: #2e5c8a;
  --brand-medium-blue: #4a90c4;
  --brand-blue: #019ffa;
  --brand-blue-hover: #0185d6;
  --brand-light-blue: #5eb3d6;
  --brand-cyan: #00a3e0;
  --brand-gray: #8b9da9;
  --brand-solid: #273b7d;
  --brand-solid_hover: #1e2d5c;
  --secondary: oklch(0.95 0.0058 264.53);
  --secondary-foreground: #030213;
  --muted: #ececf0;
  --muted-foreground: #717182;
  --accent: #e9ebef;
  --accent-foreground: #030213;
  --destructive: #d4183d;
  --destructive-foreground: #ffffff;
  --border: rgba(0, 0, 0, 0.1);
  --input: rgba(0, 0, 0, 0.03);
  --input-background: var(--input);
  --switch-background: #cbced4;
  --font-weight-bold: 700;
  --font-weight-semibold: 600;
  --font-weight-medium: 500;
  --font-weight-normal: 400;
  --ring: oklch(0.708 0 0);
  --chart-1: oklch(0.646 0.222 41.116);
  --chart-2: oklch(0.6 0.118 184.704);
  --chart-3: oklch(0.398 0.07 227.392);
  --chart-4: oklch(0.828 0.189 84.429);
  --chart-5: oklch(0.769 0.188 70.08);
  --radius: 0.625rem;
  --sidebar: #235287;
  --sidebar-foreground: #ffffff;
  --sidebar-primary: #030213;
  --sidebar-primary-foreground: oklch(0.985 0 0);
  --sidebar-accent: oklch(0.97 0 0);
  --sidebar-accent-foreground: oklch(0.205 0 0);
  --sidebar-border: oklch(0.922 0 0);
  --sidebar-ring: oklch(0.708 0 0);
}

.dark {
  --background: #0f1d30;
  --foreground: #dde8f5;
  --card: #182d47;
  --card-foreground: #dde8f5;
  --popover: #1e3252;
  --popover-foreground: #dde8f5;
  --primary: #5ba3dc;
  --primary-foreground: #0f1d30;
  --brand-dark-blue: #7ab4e8;
  --secondary: #1e3252;
  --secondary-foreground: #dde8f5;
  --muted: #243c5a;
  --muted-foreground: #90b0cc;
  --accent: #1e3252;
  --accent-foreground: #dde8f5;
  --destructive: oklch(0.55 0.22 25);
  --destructive-foreground: #fee2e2;
  --border: rgba(100, 160, 220, 0.15);
  --input: rgba(100, 160, 220, 0.08);
  --input-background: rgba(100, 160, 220, 0.08);
  --switch-background: #2a4568;
  --ring: #4a7cb8;
  --font-weight-medium: 500;
  --font-weight-normal: 400;
  --chart-1: oklch(0.488 0.243 264.376);
  --chart-2: oklch(0.696 0.17 162.48);
  --chart-3: oklch(0.769 0.188 70.08);
  --chart-4: oklch(0.627 0.265 303.9);
  --chart-5: oklch(0.645 0.246 16.439);
  --sidebar: #235287;
  --sidebar-foreground: #ffffff;
  --sidebar-primary: #030213;
  --sidebar-primary-foreground: oklch(0.985 0 0);
  --sidebar-accent: oklch(0.97 0 0);
  --sidebar-accent-foreground: oklch(0.205 0 0);
  --sidebar-border: oklch(0.922 0 0);
  --sidebar-ring: oklch(0.708 0 0);
}

@theme inline {
  --color-background: var(--background);
  --color-foreground: var(--foreground);
  --color-card: var(--card);
  --color-card-foreground: var(--card-foreground);
  --color-popover: var(--popover);
  --color-popover-foreground: var(--popover-foreground);
  --color-primary: var(--primary);
  --color-primary-foreground: var(--primary-foreground);
  --color-brand-dark-blue: var(--brand-dark-blue);
  --color-brand-navy: var(--brand-navy);
  --color-brand-medium-blue: var(--brand-medium-blue);
  --color-brand-blue: var(--brand-blue);
  --color-brand-blue-hover: var(--brand-blue-hover);
  --color-brand-light-blue: var(--brand-light-blue);
  --color-brand-cyan: var(--brand-cyan);
  --color-brand-gray: var(--brand-gray);
  --color-brand-solid: var(--brand-solid);
  --color-brand-solid_hover: var(--brand-solid_hover);
  --color-secondary: var(--secondary);
  --color-secondary-foreground: var(--secondary-foreground);
  --color-muted: var(--muted);
  --color-muted-foreground: var(--muted-foreground);
  --color-accent: var(--accent);
  --color-accent-foreground: var(--accent-foreground);
  --color-destructive: var(--destructive);
  --color-destructive-foreground: var(--destructive-foreground);
  --color-border: var(--border);
  --color-input: var(--input);
  --color-input-background: var(--input-background);
  --color-switch-background: var(--switch-background);
  --color-ring: var(--ring);
  --color-chart-1: var(--chart-1);
  --color-chart-2: var(--chart-2);
  --color-chart-3: var(--chart-3);
  --color-chart-4: var(--chart-4);
  --color-chart-5: var(--chart-5);
  --radius-sm: calc(var(--radius) - 4px);
  --radius-md: calc(var(--radius) - 2px);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) + 4px);
  --color-sidebar: var(--sidebar);
  --color-sidebar-foreground: var(--sidebar-foreground);
  --color-sidebar-primary: var(--sidebar-primary);
  --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
  --color-sidebar-accent: var(--sidebar-accent);
  --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
  --color-sidebar-border: var(--sidebar-border);
  --color-sidebar-ring: var(--sidebar-ring);
  --font-heading: var(--font-sans);
  --font-sans: var(--font-sans);
  --radius-2xl: calc(var(--radius) * 1.8);
  --radius-3xl: calc(var(--radius) * 2.2);
  --radius-4xl: calc(var(--radius) * 2.6);
}

@layer base {
  * {
    @apply border-border outline-ring/50;
  }

  body {
    @apply bg-background text-foreground;
  }

  /* Make all clickable elements show pointer cursor */
  button,
  a,
  [role="button"],
  [type="button"],
  [type="submit"],
  [type="reset"],
  label[for],
  select,
  summary,
  [onclick],
  .cursor-pointer {
    cursor: pointer;
  }

  /* Disabled elements should not show pointer */
  button:disabled,
  a:disabled,
  [disabled] {
    cursor: not-allowed;
  }
}

html {
  @apply font-sans;
}
/**
 * Base typography. This is not applied to elements which have an ancestor with a Tailwind text class.
 */
@layer base {
  /* Apply defaults to common typography elements unless *they* have Tailwind text-* classes.
     We intentionally do not use :has() here, because a container might include other text-* descendants
     (e.g. a header subtitle) which would prevent applying the defaults to a bare <h1>. */
  h1:not([class*="text-"]) {
    font-size: var(--text-2xl);
    font-weight: var(--font-weight-semibold);
    line-height: 1.5;
    color: var(--brand-dark-blue);
  }

  h2:not([class*="text-"]) {
    font-size: var(--text-xl);
    font-weight: var(--font-weight-semibold);
    line-height: 1.5;
    color: var(--brand-dark-blue);
  }

  h3:not([class*="text-"]) {
    font-size: var(--text-lg);
    font-weight: var(--font-weight-semibold);
    line-height: 1.5;
    color: var(--brand-dark-blue);
  }

  h4:not([class*="text-"]) {
    font-size: var(--text-base);
    font-weight: var(--font-weight-semibold);
    line-height: 1.5;
    color: var(--brand-dark-blue);
  }

  p:not([class*="text-"]) {
    font-size: var(--text-base);
    font-weight: var(--font-weight-normal);
    line-height: 1.5;
  }

  label:not([class*="text-"]) {
    font-size: var(--text-base);
    font-weight: var(--font-weight-medium);
    line-height: 1.5;
  }

  button:not([class*="text-"]) {
    font-size: var(--text-base);
    font-weight: var(--font-weight-medium);
    line-height: 1.5;
  }

  input:not([class*="text-"]) {
    font-size: var(--text-base);
    font-weight: var(--font-weight-normal);
    line-height: 1.5;
  }
}

html {
  font-size: var(--font-size);
}

/* Custom animations */
@keyframes flash-attention {
  0%,
  100% {
    background-color: var(--brand-medium-blue);
    box-shadow: 0 0 0 0 rgba(74, 144, 196, 0.7);
  }
  50% {
    background-color: var(--brand-light-blue);
    box-shadow: 0 0 0 4px rgba(94, 179, 214, 0.4);
  }
}

.animate-flash-attention {
  animation: flash-attention 1.5s ease-in-out infinite;
}

@keyframes pulsate-chevron {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.6;
    transform: scale(1.1);
  }
}

.animate-pulsate-chevron {
  animation: pulsate-chevron 2s ease-in-out infinite;
}

@keyframes pulsate-glow {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(74, 144, 196, 0.2);
    border-color: #4a90c4;
  }
  50% {
    box-shadow: 0 0 10px 2px rgba(94, 179, 214, 0.3);
    border-color: #5eb3d6;
  }
}

.animate-pulsate-glow {
  animation: pulsate-glow 2s ease-in-out infinite;
}

@keyframes gentle-pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.03);
    opacity: 0.95;
  }
}

.animate-gentle-pulse {
  animation: gentle-pulse 2.5s ease-in-out infinite;
}

/* Brand styling utilities */
.text-brand-dark-blue {
  color: var(--brand-dark-blue);
}

.text-brand-navy {
  color: var(--brand-navy);
}

.text-brand-medium-blue {
  color: var(--brand-medium-blue);
}

.text-brand-blue {
  color: var(--brand-blue);
}

.text-brand-light-blue {
  color: var(--brand-light-blue);
}

.text-brand-cyan {
  color: var(--brand-cyan);
}

.text-brand-gray {
  color: var(--brand-gray);
}

.bg-brand-dark-blue {
  background-color: var(--brand-dark-blue);
}

.bg-brand-navy {
  background-color: var(--brand-navy);
}

.bg-brand-medium-blue {
  background-color: var(--brand-medium-blue);
}

.bg-brand-blue {
  background-color: var(--brand-blue);
}

.bg-brand-light-blue {
  background-color: var(--brand-light-blue);
}

.bg-brand-cyan {
  background-color: var(--brand-cyan);
}

.bg-brand-gray {
  background-color: var(--brand-gray);
}

.bg-brand-blue-hover:hover {
  background-color: var(--brand-blue-hover);
}

.bg-brand-destructive {
  background-color: var(--destructive);
}
.bg-brand-destructive:hover {
  background-color: var(--destructive);
}
.bg-brand-warning {
  background-color: var(--brand-medium-blue);
}
.bg-brand-warning:hover {
  background-color: var(--brand-medium-blue);
}

.text-brand-destructive {
  color: var(--destructive);
}
.text-brand-warning {
  color: var(--brand-medium-blue);
}

.border-brand-destructive {
  border-color: var(--destructive);
}

/*
 * Mapping-risk / sync-failure alert — Status, BillingMode, and other lookup catalogs.
 * Used by #syncWarning, Setup empty-catalog notes, and populate status.
 * !important so it wins inside the lookup modal (font-size:11px on container).
 */
.mapping-risk-alert {
  display: block;
  font-size: 13px !important;
  font-weight: 600 !important;
  line-height: 1.35;
  letter-spacing: 0.01em;
  color: var(--destructive) !important;
  background-color: var(--muted) !important;
  border: 1px solid var(--destructive) !important;
  border-radius: var(--radius);
  padding: 0.625rem 0.75rem !important;
  margin-bottom: 0.5rem;
}

/* Milder sync note (rarely used; prefer mapping-risk-alert for catalog issues). */
.mapping-sync-note {
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.35;
  color: var(--brand-medium-blue);
  background-color: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.625rem;
  margin-bottom: 0.5rem;
}

/* Primary Process outcome: central API upload succeeded */
.upload-success-alert {
  display: block;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  color: #ffffff;
  background-color: var(--brand-blue, #019ffa);
  border: 2px solid var(--brand-dark-blue, #235287);
  border-radius: 6px;
  padding: 12px 14px;
  margin-bottom: 10px;
}

.border-brand-dark-blue {
  border-color: var(--brand-dark-blue);
}

.border-brand-blue {
  border-color: var(--brand-blue);
}

/* ========== Import tab (simple) polish ========== */
.import-card {
  background: var(--card);
  color: var(--card-foreground);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  padding: 1.5rem 1.5rem 1.25rem;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.04) inset,
    0 8px 28px rgba(0, 0, 0, 0.18);
}
.dark .import-card {
  border-color: rgba(100, 160, 220, 0.22);
  box-shadow:
    0 0 0 1px rgba(1, 159, 250, 0.08),
    0 0 40px rgba(1, 159, 250, 0.06),
    0 12px 32px rgba(0, 0, 0, 0.35);
}

.import-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--brand-dark-blue);
}
.import-label-icon {
  display: inline-flex;
  color: var(--brand-blue, #019ffa);
  opacity: 0.95;
}

.import-select {
  width: 100%;
  min-width: 0;
  background: var(--input-background);
  color: var(--foreground);
  font-size: 0.875rem;
  padding: 0.55rem 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.import-select:hover {
  border-color: color-mix(in srgb, var(--brand-blue) 45%, var(--border));
}
.import-select:focus,
.import-select:focus-visible {
  outline: none;
  border-color: var(--brand-blue, #019ffa);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-blue, #019ffa) 35%, transparent);
}

.import-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 7.5rem;
  padding: 1.25rem 1rem;
  border-radius: 0.65rem;
  border: 1.5px dashed color-mix(in srgb, var(--brand-blue, #019ffa) 45%, var(--border));
  background: color-mix(in srgb, var(--muted) 70%, transparent);
  color: var(--foreground);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.import-dropzone:hover,
.import-dropzone:focus-visible {
  outline: none;
  border-color: var(--brand-blue, #019ffa);
  background: color-mix(in srgb, var(--brand-blue, #019ffa) 8%, var(--muted));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-blue, #019ffa) 22%, transparent);
}
.import-dropzone.is-dragover {
  border-style: solid;
  border-color: var(--brand-blue, #019ffa);
  background: color-mix(in srgb, var(--brand-blue, #019ffa) 14%, var(--muted));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-blue, #019ffa) 30%, transparent);
}
.import-dropzone.has-file {
  border-style: solid;
  border-color: color-mix(in srgb, var(--brand-blue, #019ffa) 55%, var(--border));
}
.import-dropzone-icon {
  color: var(--brand-blue, #019ffa);
  margin-bottom: 0.15rem;
}
.import-dropzone-title {
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.35;
  max-width: 100%;
  word-break: break-word;
}
.import-dropzone-hint {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted-foreground);
}

.import-process-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-width: 9rem;
  padding: 0.65rem 1.35rem;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: 0.55rem;
  border: none;
  cursor: pointer;
  color: #fff;
  background: var(--brand-blue, #019ffa);
  box-shadow: 0 2px 10px color-mix(in srgb, var(--brand-blue, #019ffa) 40%, transparent);
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}
.import-process-btn:hover {
  background: var(--brand-blue-hover, #0185d6);
}
.import-process-btn:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 2px var(--background),
    0 0 0 4px var(--brand-blue, #019ffa);
}
.import-process-btn:active {
  transform: translateY(1px);
}
.import-process-btn:disabled,
.import-process-btn.import-process-btn--disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
  pointer-events: none;
  transform: none;
}
.import-process-btn:disabled:hover,
.import-process-btn.import-process-btn--disabled:hover {
  background: var(--brand-blue, #019ffa);
}
.import-process-icon {
  display: inline-flex;
}

.import-status {
  text-align: center;
  padding-top: 0.25rem;
}
.import-status .font-semibold {
  font-size: 1rem;
}

.border-brand-light-blue {
  border-color: var(--brand-light-blue);
}

/* Override upstream component defaults for form control visibility.
   Placed at end of file and uses !important to beat Tailwind v4 utility
   layer specificity (e.g. bg-transparent set on component classNames). */
[data-slot="input"],
[data-slot="textarea"],
[data-slot="select-trigger"] {
  border-color: var(--border) !important;
  background-color: var(--input-background) !important;
  color: var(--foreground) !important;
}

/* Tailwind-v4-safe surface utility (upgrade-safe).
   Apply via our wrapper components instead of brittle attribute selectors. */
@utility ui-input-surface {
  background-color: var(--input-background) !important;
  border-color: var(--border) !important;
  color: var(--foreground) !important;
}

/* Sonner (v2): same selectors as Radix-era setups — toast root is [data-sonner-toast], type is data-type
   Title uses color: inherit; description must be overridden too — otherwise in dark *toaster* theme
   Sonner sets [data-description] to ~white, which washes out on our light success/error surfaces. */
[data-sonner-toast][data-type="error"] {
  border: 2px solid var(--color-red-400, #f87171) !important;
  background-color: var(--color-red-50, #fef2f2) !important;
  color: var(--color-red-800, #991b1b) !important;
}

[data-sonner-toast][data-type="error"] [data-description] {
  color: var(--color-red-900, #7f1d1d) !important;
  opacity: 1 !important;
}

[data-sonner-toast][data-type="success"] {
  border: 2px solid var(--color-blue-400, #60a5fa) !important;
  background-color: var(--color-blue-50, #eff6ff) !important;
  color: var(--color-blue-800, #1e40af) !important;
}

[data-sonner-toast][data-type="success"] [data-description] {
  color: var(--color-blue-900, #1e3a8a) !important;
  opacity: 1 !important;
}

.dark [data-sonner-toast][data-type="error"] {
  border-color: var(--color-red-400, #f87171) !important;
  background-color: color-mix(
    in oklch,
    var(--color-red-950, #450a0a) 90%,
    transparent
  ) !important;
  color: var(--color-red-100, #fee2e2) !important;
}

.dark [data-sonner-toast][data-type="error"] [data-description] {
  color: var(--color-red-200, #fecaca) !important;
  opacity: 1 !important;
}

.dark [data-sonner-toast][data-type="success"] {
  border-color: var(--color-blue-400, #60a5fa) !important;
  background-color: color-mix(
    in oklch,
    var(--color-blue-950, #172554) 90%,
    transparent
  ) !important;
  color: var(--color-blue-100, #dbeafe) !important;
}

.dark [data-sonner-toast][data-type="success"] [data-description] {
  color: var(--color-blue-200, #bfdbfe) !important;
  opacity: 1 !important;
}
