/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* Consistent inset chevron caret on all <select> dropdowns across browsers.
 * Kept here (outside Tailwind's LightningCSS pipeline) so vendor-prefixed
 * -webkit-appearance: none and modern ::picker(select) rules are preserved. */
select:not([multiple]) {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2364748b'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z' clip-rule='evenodd'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  background-size: 1rem 1rem;
  padding-right: 2.25rem;
  cursor: pointer;
}

select:not([multiple])::picker-icon {
  display: none;
}

/* Styled dropdown menu for modern browsers supporting CSS customizable <select> */
@supports (appearance: base-select) {
  select:not([multiple]),
  select:not([multiple])::picker(select) {
    appearance: base-select;
  }

  select:not([multiple]) {
    align-items: center;
  }

  select:not([multiple])::picker-icon {
    display: none;
  }

  select:not([multiple])::picker(select) {
    margin-top: 0.35rem;
    padding: 0.3rem;
    min-width: anchor-size(width);
    max-height: 18rem;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    background-color: #ffffff;
    box-shadow: 0 12px 28px -6px rgb(15 23 42 / 0.14), 0 4px 10px -4px rgb(15 23 42 / 0.08);
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
  }

  select:not([multiple]) option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.45rem 0.65rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    color: #334155;
    cursor: pointer;
    transition: background-color 100ms ease, color 100ms ease;
  }

  select:not([multiple]) option:hover,
  select:not([multiple]) option:focus-visible {
    background-color: #f1f5f9;
    color: #0f172a;
    outline: none;
  }

  select:not([multiple]) option:checked {
    background-color: #eef2ff;
    color: #4338ca;
    font-weight: 600;
  }

  select:not([multiple]) option::checkmark {
    order: 1;
    margin-left: auto;
    color: #4f46e5;
    font-size: 0.8rem;
    font-weight: 700;
  }
}

/* WCAG 2.1 AA: clear keyboard focus indicators and reduced-motion respect */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 2px solid #4f46e5;
  outline-offset: 2px;
}

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