/* ============================================================================
   ENTERPRISE DESIGN SYSTEM — Violet Security
   ============================================================================
   Tokens + utility classes that bring the UI to Qualys / Tenable / Checkmarx
   level. Apply by swapping your ad-hoc Tailwind strings for these semantic
   classes. Nothing here overrides Tailwind — everything lives under .ent-*
   or CSS custom properties, so it composes with the existing codebase.
   ============================================================================ */

:root {
  /* ── Spacing (4/8 grid) ──────────────────────────────────────────────── */
  --ent-space-1: 4px;
  --ent-space-2: 8px;
  --ent-space-3: 12px;
  --ent-space-4: 16px;
  --ent-space-5: 20px;
  --ent-space-6: 24px;
  --ent-space-8: 32px;
  --ent-space-10: 40px;
  --ent-space-12: 48px;
  --ent-space-16: 64px;

  /* ── Border radius (exactly 3) ───────────────────────────────────────── */
  --ent-radius-sm: 4px;     /* pills, badges */
  --ent-radius-md: 8px;     /* buttons, inputs, cells */
  --ent-radius-lg: 10px;    /* cards, modals, panels */

  /* ── Shadows (exactly 2) ─────────────────────────────────────────────── */
  --ent-shadow-sm: 0 1px 2px 0 rgb(15 23 42 / 0.04), 0 1px 2px 0 rgb(15 23 42 / 0.06);
  --ent-shadow-lg: 0 10px 15px -3px rgb(15 23 42 / 0.08), 0 4px 6px -4px rgb(15 23 42 / 0.08);

  /* ── Gray scale (5 semantic) ─────────────────────────────────────────── */
  --ent-gray-50: #f8fafc;
  --ent-gray-100: #f1f5f9;
  --ent-gray-200: #e2e8f0;
  --ent-gray-300: #cbd5e1;
  --ent-gray-400: #94a3b8;
  --ent-gray-500: #64748b;
  --ent-gray-600: #475569;
  --ent-gray-700: #334155;
  --ent-gray-800: #1e293b;
  --ent-gray-900: #0f172a;

  /* ── Text colors (semantic) ──────────────────────────────────────────── */
  --ent-text-heading: var(--ent-gray-900);
  --ent-text-body: var(--ent-gray-700);
  --ent-text-muted: var(--ent-gray-500);
  --ent-text-subtle: var(--ent-gray-400);
  --ent-text-disabled: var(--ent-gray-300);

  /* ── Severity (one receta per level) ─────────────────────────────────── */
  --ent-crit-bg: #fef2f2;
  --ent-crit-fg: #b91c1c;
  --ent-crit-border: #fecaca;

  --ent-high-bg: #fff7ed;
  --ent-high-fg: #c2410c;
  --ent-high-border: #fed7aa;

  --ent-med-bg: #fefce8;
  --ent-med-fg: #a16207;
  --ent-med-border: #fde68a;

  --ent-low-bg: #f0fdf4;
  --ent-low-fg: #15803d;
  --ent-low-border: #bbf7d0;

  --ent-info-bg: #f1f5f9;
  --ent-info-fg: #475569;
  --ent-info-border: #e2e8f0;

  --ent-success-bg: #f0fdf4;
  --ent-success-fg: #15803d;
  --ent-success-border: #bbf7d0;

  /* ── Motion ──────────────────────────────────────────────────────────── */
  --ent-t-fast: 120ms;
  --ent-t-base: 180ms;
  --ent-t-slow: 280ms;
  --ent-easing: cubic-bezier(0.16, 1, 0.3, 1);

  /* ── Typography scale (5 sizes) ──────────────────────────────────────── */
  --ent-fs-caption: 11px;
  --ent-fs-body: 13px;
  --ent-fs-base: 14px;
  --ent-fs-h3: 16px;
  --ent-fs-h2: 20px;
  --ent-fs-h1: 24px;
}

/* ============================================================================
   BUTTONS — 5 variants, enterprise-grade
   ============================================================================ */

.ent-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--ent-space-2);
  padding: 8px 14px;
  font-size: var(--ent-fs-body);
  font-weight: 600;
  line-height: 1;
  border: 1px solid transparent;
  border-radius: var(--ent-radius-md);
  cursor: pointer;
  transition: background-color var(--ent-t-fast) var(--ent-easing),
              border-color var(--ent-t-fast) var(--ent-easing),
              color var(--ent-t-fast) var(--ent-easing),
              box-shadow var(--ent-t-fast) var(--ent-easing),
              transform var(--ent-t-fast) var(--ent-easing);
  white-space: nowrap;
  user-select: none;
  text-decoration: none;
}
.ent-btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}
.ent-btn:disabled,
.ent-btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}
.ent-btn i { font-size: 11px; }

.ent-btn-sm { padding: 6px 10px; font-size: var(--ent-fs-caption); }

/* Primary — brand color, for THE action */
.ent-btn-primary {
  background: var(--color-primary);
  color: #fff;
  box-shadow: var(--ent-shadow-sm);
}
.ent-btn-primary:hover { background: color-mix(in srgb, var(--color-primary) 88%, #000); }
.ent-btn-primary:active { transform: translateY(0.5px); }

/* Secondary — white with border, for secondary actions */
.ent-btn-secondary {
  background: #fff;
  color: var(--ent-gray-700);
  border-color: var(--ent-gray-200);
}
.ent-btn-secondary:hover {
  background: var(--ent-gray-50);
  border-color: var(--ent-gray-300);
  color: var(--ent-gray-900);
}

/* Ghost — no border, for toolbars and dense UIs */
.ent-btn-ghost {
  background: transparent;
  color: var(--ent-gray-600);
}
.ent-btn-ghost:hover {
  background: var(--ent-gray-100);
  color: var(--ent-gray-900);
}

/* Link — text only */
.ent-btn-link {
  background: transparent;
  border: none;
  padding: 4px 6px;
  color: var(--color-primary);
  font-weight: 500;
}
.ent-btn-link:hover { text-decoration: underline; }

/* ============================================================================
   BADGES — semantic severity + status, ONE receta per level
   ============================================================================ */

.ent-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: var(--ent-fs-caption);
  font-weight: 600;
  line-height: 16px;
  border-radius: var(--ent-radius-sm);
  border: 1px solid transparent;
  white-space: nowrap;
  letter-spacing: 0.01em;
}
.ent-badge-very-critical {
  background: #fecaca;
  color: #7f1d1d;
  border-color: #f87171;
}
.ent-badge-critical {
  background: var(--ent-crit-bg);
  color: var(--ent-crit-fg);
  border-color: var(--ent-crit-border);
}
.ent-badge-high {
  background: var(--ent-high-bg);
  color: var(--ent-high-fg);
  border-color: var(--ent-high-border);
}
.ent-badge-medium {
  background: var(--ent-med-bg);
  color: var(--ent-med-fg);
  border-color: var(--ent-med-border);
}
.ent-badge-low {
  background: var(--ent-low-bg);
  color: var(--ent-low-fg);
  border-color: var(--ent-low-border);
}
.ent-badge-info,
.ent-badge-informational,
.ent-badge-neutral {
  background: var(--ent-info-bg);
  color: var(--ent-info-fg);
  border-color: var(--ent-info-border);
}
.ent-badge-success {
  background: var(--ent-success-bg);
  color: var(--ent-success-fg);
  border-color: var(--ent-success-border);
}

/* ============================================================================
   CARDS
   ============================================================================ */

.ent-card {
  background: #fff;
  border: 1px solid var(--ent-gray-200);
  border-radius: var(--ent-radius-lg);
  box-shadow: var(--ent-shadow-sm);
  overflow: hidden;
}

/* ============================================================================
   KPI WIDGET — only the label survives; the tile, the value, the deltas and
   the four tone modifiers were never used by a template.
   ============================================================================ */

.ent-kpi-label {
  font-size: var(--ent-fs-caption);
  font-weight: 600;
  color: var(--ent-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ============================================================================
   INPUTS
   ============================================================================ */

.ent-input,
.ent-select {
  display: block;
  width: 100%;
  padding: 9px 12px;
  font-size: var(--ent-fs-body);
  color: var(--ent-text-heading);
  background: #fff;
  border: 1px solid var(--ent-gray-200);
  border-radius: var(--ent-radius-md);
  transition: border-color var(--ent-t-fast) var(--ent-easing),
              box-shadow var(--ent-t-fast) var(--ent-easing);
}
.ent-input::placeholder { color: var(--ent-text-subtle); }
.ent-input:hover,
.ent-select:hover { border-color: var(--ent-gray-300); }
.ent-input:focus,
.ent-select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 18%, transparent);
}
.ent-input[aria-invalid="true"] {
  border-color: var(--ent-crit-fg);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ent-crit-fg) 18%, transparent);
}
/* ============================================================================
   SKELETONS
   ============================================================================ */

@keyframes ent-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.ent-skeleton {
  background: linear-gradient(
    90deg,
    var(--ent-gray-100) 0%,
    var(--ent-gray-200) 50%,
    var(--ent-gray-100) 100%
  );
  background-size: 200% 100%;
  animation: ent-shimmer 1.6s linear infinite;
  border-radius: var(--ent-radius-sm);
}
.ent-skeleton-text { height: 12px; margin: 6px 0; }
.ent-skeleton-title { height: 20px; width: 40%; margin-bottom: 12px; }
.ent-skeleton-row { height: 44px; border-bottom: 1px solid var(--ent-gray-100); background-size: 200% 44px; }
.ent-skeleton-avatar { width: 36px; height: 36px; border-radius: 50%; }

/* ============================================================================
   MISC
   ============================================================================ */

/* Tabular nums for numeric columns (aligns digits) */
.ent-num { font-variant-numeric: tabular-nums; }

/* ============================================================================
   GLOBAL ENHANCEMENTS — apply a lift to existing Tailwind patterns without
   asking every template to change its markup
   ============================================================================ */

/* Soften the page background so white cards pop */
body, main {
  background-color: #f8fafc;
}

/* The `bg-white rounded-xl border border-gray-200 shadow-sm` pattern is used
   hundreds of times as a card. Upgrade its visual density to match enterprise
   without touching markup. */
.content-area .bg-white.rounded-xl.border.border-gray-200.shadow-sm,
.content-area .bg-white.rounded-xl.border.shadow-sm {
  border-color: #e2e8f0 !important;
  box-shadow: var(--ent-shadow-sm) !important;
  border-radius: 12px !important;
}
.content-area .bg-white.rounded-xl.border.border-gray-200.shadow-sm:hover,
.content-area .bg-white.rounded-xl.border.shadow-sm:hover {
  border-color: #cbd5e1 !important;
}

/* Any Tailwind button with bg-[var(--color-primary)] gets the shared timing.
   No shadow: the primary button is flat, and components.css normalises the
   same selector — two rules each adding one would have compounded. */
.content-area button[class*="bg-[var(--color-primary)]"],
.content-area a[class*="bg-[var(--color-primary)]"] {
  transition: background-color var(--ent-t-fast) var(--ent-easing),
              transform var(--ent-t-fast) var(--ent-easing);
}

/* Slightly tighter letter-spacing on headings (keeps whatever color the
   markup set — NEVER forces a color, to avoid breaking dark hero banners
   and coloured cards where the h1 is white). */
.content-area h1,
.content-area h2,
.content-area h3 {
  letter-spacing: -0.01em;
}

/* Inputs — unify focus ring */
.content-area input[type="text"]:focus,
.content-area input[type="email"]:focus,
.content-area input[type="number"]:focus,
.content-area input[type="date"]:focus,
.content-area input[type="search"]:focus,
.content-area input[type="password"]:focus,
.content-area textarea:focus,
.content-area select:focus {
  outline: none;
  border-color: var(--color-primary) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 18%, transparent) !important;
}

/* Tables that use the common Tailwind pattern — give them sticky headers and
   consistent row heights without needing to rewrite them. Targets tables
   wrapped in a container with rounded-xl + overflow-hidden. */
.content-area .rounded-xl.overflow-hidden > table thead th,
.content-area .rounded-xl.overflow-hidden > div > table thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--ent-gray-50);
  border-bottom: 1px solid var(--ent-gray-200);
}
.content-area .rounded-xl.overflow-hidden > table tbody tr,
.content-area .rounded-xl.overflow-hidden > div > table tbody tr {
  transition: background-color var(--ent-t-fast) var(--ent-easing);
}

/* Unify FA icon rendering weight */
.content-area i.fa-solid { font-weight: 900; }

/* Scrollbar polish (webkit) */
.content-area ::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
.content-area ::-webkit-scrollbar-track { background: transparent; }
.content-area ::-webkit-scrollbar-thumb {
  background: var(--ent-gray-200);
  border-radius: 5px;
  border: 2px solid #f8fafc;
}
.content-area ::-webkit-scrollbar-thumb:hover { background: var(--ent-gray-300); }

/* Sidebar polish — denser, enterprise-feel */
aside nav a,
aside nav button {
  transition: background-color var(--ent-t-fast) var(--ent-easing),
              color var(--ent-t-fast) var(--ent-easing);
}

/* Pagination existing in project.css — unify the feel */
.pagination {
  gap: 4px;
}

/* Prevent font "bounce" on webfont load */
body { text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; }

/* ============================================================================
   LOCKABLE SECTION — greys out + blocks interaction when not applicable
   ============================================================================
   Usage: <div class="ent-lockable ent-lockable--locked" title="...">...</div>
   Applies a grey overlay, reduces opacity, disables pointer events on the
   inputs and shows a "not-allowed" cursor. The section is still visible so
   the user knows the feature exists; they just can't use it.
*/
.ent-lockable {
  position: relative;
  transition: opacity var(--ent-t-base) var(--ent-easing),
              filter var(--ent-t-base) var(--ent-easing);
}
.ent-lockable--locked {
  cursor: not-allowed;
  filter: grayscale(0.6);
}
.ent-lockable--locked > *:not(h3):not(h2):not(h1) {
  opacity: 0.45;
  pointer-events: none;
  user-select: none;
}
.ent-lockable--locked h3 {
  opacity: 0.75;
}
.ent-lockable--locked input,
.ent-lockable--locked select,
.ent-lockable--locked textarea,
.ent-lockable--locked button {
  background-color: var(--ent-gray-100) !important;
  border-color: var(--ent-gray-200) !important;
  color: var(--ent-gray-400) !important;
  cursor: not-allowed !important;
}
.ent-lockable--locked::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(100, 116, 139, 0.04);
  pointer-events: none;
  border-radius: var(--ent-radius-lg);
}
/* Hover: stronger visual cue + cursor */
.ent-lockable--locked:hover {
  filter: grayscale(0.8);
}

/* ============================================================================
   PAGE TABS ROW — tabs + inline actions that share the full-width underline
   ============================================================================
   Usage: wrap a nav.page-tabs and a div of action buttons inside an element
   with class .ent-page-tabs-row. The underline (from .page-tabs) is
   promoted to the row so it spans the whole page width, and the actions
   sit aligned to the right on the same visual baseline.
*/
.ent-page-tabs-row {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: var(--ent-space-4);
  border-bottom: 2px solid var(--ent-gray-200);
  margin-bottom: var(--ent-space-6);
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--page-bg, var(--color-background, #fbfaff));
  box-shadow: 0 6px 8px -8px rgba(15, 23, 42, 0.12);
  flex-wrap: wrap;
}
/* Inside the row, the nested nav.page-tabs loses its own chrome — the row
   now owns the underline, sticky and background. */
.ent-page-tabs-row > .page-tabs {
  border-bottom: 0;
  margin-bottom: 0;
  position: static;
  top: auto;
  z-index: auto;
  background: transparent;
  box-shadow: none;
  flex: 0 1 auto;
}
