@import "tailwindcss";

/* Touch feedback: active/pressed states for all interactive elements */
@layer utilities {
  /* Buttons and links with button-like appearance get press feedback */
  button:active:not(:disabled),
  [role="button"]:active:not(:disabled),
  a[class*="rounded-lg"]:active,
  a[class*="btn"]:active,
  input[type="submit"]:active:not(:disabled) {
    transform: scale(0.97);
    opacity: 0.85;
  }

  /* Smooth transition for press feedback — max 150ms ease-out */
  button,
  [role="button"],
  a[class*="rounded-lg"],
  a[class*="btn"],
  input[type="submit"] {
    transition: transform 0.1s ease-out, opacity 0.1s ease-out, background-color 0.15s ease-out, color 0.15s ease-out;
  }

  /* Sidebar nav items get subtle feedback */
  nav a:active {
    transform: scale(0.98);
    opacity: 0.9;
  }
}

/* Accessibility: visible focus indicators for keyboard navigation */
@layer base {
  a:focus-visible,
  button:focus-visible,
  input:focus-visible,
  select:focus-visible,
  textarea:focus-visible,
  [tabindex]:focus-visible {
    outline: 2px solid #c2410c;
    outline-offset: 2px;
  }
}

/* Global animation speed cap — all transitions max 200ms ease-out */
@layer base {
  *,
  *::before,
  *::after {
    transition-timing-function: ease-out;
  }

  /* Constrain all Tailwind transition-colors / transition-all to 150ms */
  .transition-colors,
  .transition-all,
  .transition-opacity,
  .transition-shadow,
  .transition {
    transition-duration: 150ms !important;
    transition-timing-function: ease-out !important;
  }

  /* Reduce card shadows — prefer subtle borders over heavy shadows */
  .shadow-sm {
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.04) !important;
  }

  /* Table sticky header needs background to prevent see-through */
  thead.sticky {
    box-shadow: 0 1px 0 0 rgb(0 0 0 / 0.06);
  }
}

/* Density: Compact mode */
@layer utilities {
  /* Cards */
  [data-density="compact"] .bg-white.rounded-xl {
    padding: 0.75rem;
  }
  [data-density="compact"] .bg-white.rounded-xl .p-5,
  [data-density="compact"] .bg-white.rounded-xl .p-6 {
    padding: 0.75rem;
  }
  [data-density="compact"] .bg-white.rounded-xl .p-4 {
    padding: 0.5rem 0.75rem;
  }

  /* Table rows */
  [data-density="compact"] table tbody td {
    padding-top: 0.375rem;
    padding-bottom: 0.375rem;
  }
  [data-density="compact"] table thead th {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
  }

  /* Text sizing */
  [data-density="compact"] .text-2xl {
    font-size: 1.25rem;
    line-height: 1.75rem;
  }
  [data-density="compact"] .text-3xl {
    font-size: 1.5rem;
    line-height: 2rem;
  }

  /* Grid gaps */
  [data-density="compact"] .gap-5 {
    gap: 0.75rem;
  }
  [data-density="compact"] .gap-6 {
    gap: 1rem;
  }

  /* Spacing */
  [data-density="compact"] .space-y-6 > * + * {
    margin-top: 1rem;
  }

  /* Main content padding */
  [data-density="compact"] main .p-6 {
    padding: 1rem;
  }
}
