/*
  WTSI Apps - Custom Styles
  Built with Tabler UI Kit (https://tabler.io)
*/

/* Custom variables and overrides */
:root {
  --tblr-primary: #0054a6;
  --tblr-secondary: #626976;
}

/* Tabler page-loader pattern within the existing application shell. */
.app-page-loader { min-height: min(65vh, 36rem); }
@media (prefers-reduced-motion: reduce) {
  .app-page-loader .progress-bar-indeterminate { animation: none; width: 100%; }
}

/* Improved text selection visibility for light and dark modes */
::selection {
  background-color: #0ea5e9;
  color: #ffffff;
}

::-moz-selection {
  background-color: #0ea5e9;
  color: #ffffff;
}

[data-bs-theme="dark"] ::selection {
  background-color: #3b82f6;
  color: #ffffff;
}

[data-bs-theme="dark"] ::-moz-selection {
  background-color: #3b82f6;
  color: #ffffff;
}

/* Shared, framework-independent request activity at the viewport edge. */
.wtsi-busy {
  position: fixed;
  inset: 0 0 auto;
  height: 3px;
  z-index: 9999;
  pointer-events: none;
  overflow: hidden;
  background: color-mix(in srgb, var(--tblr-primary) 15%, transparent);
}
.wtsi-busy[hidden] { display: none; }
.wtsi-busy::after {
  content: '';
  position: absolute;
  width: 45%;
  height: 100%;
  background: var(--tblr-primary);
  box-shadow: 0 0 8px 2px var(--tblr-primary);
  animation: wtsi-request-glow 1.2s ease-in-out infinite;
}
@keyframes wtsi-request-glow {
  from { transform: translateX(-110%); }
  to { transform: translateX(330%); }
}
@media (prefers-reduced-motion: reduce) {
  .wtsi-busy::after { animation: none; width: 100%; }
}

/* HTMX loading indicator */
.htmx-request .htmx-indicator {
  display: inline-block;
}

.htmx-indicator {
  display: none;
}

/* Alpine.js transitions */
[x-cloak] {
  display: none !important;
}

/* Custom utilities */
.cursor-pointer {
  cursor: pointer;
}

/* Smooth dark mode transitions */
body {
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Custom card styles */
.card-interactive:hover {
  transform: translateY(-2px);
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
  transition: all 0.2s ease-in-out;
}

/* Choices.js styling to match Tabler theme */
.choices {
  margin-bottom: 0;
}

.choices__inner {
  background-color: var(--tblr-bg-forms);
  border: 1px solid var(--tblr-border-color);
  border-radius: var(--tblr-border-radius);
  color: var(--tblr-body-color);
  font-size: 0.875rem;
  min-height: calc(1.4285714em + 0.875rem + 2px);
  padding: 0.4375rem 0.625rem;
  vertical-align: middle;
}

.choices__inner:focus {
  border-color: var(--tblr-primary);
  box-shadow: 0 0 0 0.25rem rgba(32, 107, 196, 0.25);
}

.choices__list--dropdown,
.choices__list[aria-expanded] {
  background-color: var(--tblr-bg-surface);
  border: 1px solid var(--tblr-border-color);
  border-radius: var(--tblr-border-radius);
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
  color: var(--tblr-body-color);
  margin-top: 0.25rem;
  z-index: 1000;
}

.choices__list--dropdown .choices__item--selectable,
.choices__list[aria-expanded] .choices__item--selectable {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.choices__list--dropdown .choices__item--selectable.is-highlighted,
.choices__list[aria-expanded] .choices__item--selectable.is-highlighted {
  background-color: var(--tblr-primary);
  color: #fff;
}

.choices__input {
  background-color: transparent;
  color: var(--tblr-body-color);
  font-size: 0.875rem;
  margin-bottom: 0;
  padding: 0.25rem 0;
}

.choices__input::placeholder {
  color: var(--tblr-secondary);
  opacity: 0.6;
}

/* Dark mode adjustments for Choices.js */
[data-bs-theme="dark"] .choices__inner {
  background-color: var(--tblr-bg-forms);
  border-color: var(--tblr-border-color);
}

[data-bs-theme="dark"] .choices__list--dropdown,
[data-bs-theme="dark"] .choices__list[aria-expanded] {
  background-color: var(--tblr-bg-surface);
  border-color: var(--tblr-border-color);
}

[data-bs-theme="dark"] .choices__input {
  color: var(--tblr-body-color);
}

/* Form validation customizations */
/* Hide validation checkmark on date inputs - it obscures the calendar icon */
input[type="date"].is-valid {
  background-image: none;
  padding-right: 0.75rem;
}
