/*
 * This is a manifest file that'll be compiled into application.css, which will include all the files
 * listed below.
 *
 * Any CSS (and SCSS, if configured) file within this directory, lib/assets/stylesheets, or any plugin's
 * vendor/assets/stylesheets directory can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the bottom of the
 * compiled file so the styles you add here take precedence over styles defined in any other CSS
 * files in this directory. Styles in this file should be added after the last require_* statement.
 * It is generally better to create a new file per style scope.
 *
 *= require_tree .
 *= require_self
 */

.athlete-link .athlete-hovercard {
  display: none;
}

.athlete-link:hover .athlete-hovercard {
  position: absolute;
  display: inline-block;
}

a.athlete-link {
  color: rgb(34 197 94);
  text-decoration-line: underline;
}

a.club-link {
  color: rgb(70, 70, 70);
  text-decoration-line: underline;
}

/* ---------------------------------------------------------------------------
 * Hotwire Combobox
 *
 * The gem is driven entirely by --hw-* custom properties, so we retheme it by
 * overriding those rather than by fighting its selectors. `combobox_style_tag`
 * is loaded before this file in the layouts, so no !important is needed.
 * ------------------------------------------------------------------------- */
.hw-combobox {
  --hw-active-bg-color: #f0fdf4; /* green-50 */
  --hw-border-color: #d1d5db; /* gray-300 */
  --hw-focus-color: #16a34a; /* green-600, matches focus:ring-green-600 */
  --hw-border-radius: 0.375rem; /* rounded-md, matches sibling inputs */

  /* 1rem keeps iOS Safari from zooming on focus; shrink to match sm:text-sm */
  --hw-font-size: 1rem;
  --hw-line-height: 1.5rem;
  --hw-listbox-z-index: 200; /* above turbo modals */

  display: flex;
  width: 100%;
}

@media (min-width: 640px) {
  .hw-combobox {
    --hw-font-size: 0.875rem;
  }
}

/* Match the Tailwind label styling used on sibling form fields */
.hw-combobox__label:not([hidden]) {
  color: #111827; /* gray-900 */
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.5rem;
}

/* The gem sizes the field with fixed rem widths; we always want the container */
.hw-combobox__main__wrapper {
  width: 100%;
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.hw-combobox--multiple .hw-combobox__main__wrapper {
  width: 100%;
}

.hw-combobox__listbox {
  background-color: var(--hw-component-bg-color);
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

.hw-combobox__option {
  cursor: pointer;
}

/* Comfortable tap targets on touch devices */
@media (pointer: coarse) {
  .hw-combobox__option {
    align-items: center;
    display: flex;
    min-height: 2.75rem;
  }
}

.hw-combobox__option[aria-selected="true"] {
  background-color: var(--hw-active-bg-color);
  color: #15803d; /* green-700 */
  font-weight: 500;
}

.hw-combobox__chip {
  background-color: #f0fdf4; /* green-50 */
  border-color: #bbf7d0; /* green-200 */
  color: #15803d; /* green-700 */
}

/* Normalize multiselect height to match single select */
.hw-combobox--multiple .hw-combobox__input {
  line-height: var(--hw-line-height);
}

/* Let the dropdown escape scrollable modal bodies */
.overflow-y-auto:has(.hw-combobox) {
  overflow: visible !important;
}

/* Small-viewport dialog: sit closer to the top and read as a sheet */
.hw-combobox__dialog {
  --hw-dialog-font-size: 1rem;
  --hw-dialog-top-offset: 10vh;

  background-color: var(--hw-component-bg-color);
  border-radius: 0.75rem 0.75rem 0 0;
}

/* Grabber, so the sheet reads as dismissable */
.hw-combobox__dialog[open]::before {
  background-color: #d1d5db; /* gray-300 */
  border-radius: 9999px;
  content: '';
  flex: none;
  height: 0.25rem;
  margin-bottom: 0.5rem;
  width: 2.25rem;
}

.hw-combobox__dialog__input {
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);

  &:focus,
  &:focus-visible {
    border-color: var(--hw-focus-color);
    box-shadow: 0 0 0 var(--hw-border-width--thick) var(--hw-focus-color);
    outline: none;
  }
}

/* Dark theme, used by the admin modals */
.hw-combobox[data-theme="dark"] {
  --hw-active-bg-color: #475569; /* slate-600 */
  --hw-border-color: #475569; /* slate-600 */
  --hw-component-bg-color: #334155; /* slate-700 */
  --hw-dialog-label-color: #e2e8f0; /* slate-200 */
  --hw-focus-color: #f59e0b; /* amber-500 */
  --hw-group-bg-color: #334155; /* slate-700 */
  --hw-group-color: #94a3b8; /* slate-400 */
  --hw-option-bg-color: #334155; /* slate-700 */

  color: #e2e8f0; /* slate-200 */
}

.hw-combobox[data-theme="dark"] .hw-combobox__input {
  background-color: transparent;
  color: #ffffff;
}

.hw-combobox[data-theme="dark"] .hw-combobox__input::placeholder {
  color: #64748b; /* slate-500 */
  opacity: 1;
}

.hw-combobox[data-theme="dark"] .hw-combobox__option[aria-selected="true"] {
  background-color: #f59e0b; /* amber-500 */
  color: #0f172a; /* slate-900 */
}

.hw-combobox[data-theme="dark"] .hw-combobox__chip {
  background-color: #f59e0b; /* amber-500 */
  border-color: #f59e0b;
  color: #0f172a; /* slate-900 */
}

/* Small-viewport sheet: the dialog is its own surface, so retheme it too */
.hw-combobox[data-theme="dark"] .hw-combobox__dialog__input {
  background-color: #1e293b; /* slate-800 */
  border-color: #475569; /* slate-600 */
  color: #ffffff;
}

.hw-combobox[data-theme="dark"] .hw-combobox__dialog__input::placeholder {
  color: #64748b; /* slate-500 */
  opacity: 1;
}

.hw-combobox[data-theme="dark"] .hw-combobox__dialog[open]::before {
  background-color: #64748b; /* slate-500 */
}

/* Utility to hide scrollbar while allowing scroll */
.scrollbar-hide {
  -ms-overflow-style: none;  /* IE and Edge */
  scrollbar-width: none;  /* Firefox */
}

.scrollbar-hide::-webkit-scrollbar {
  display: none;  /* Chrome, Safari and Opera */
}

/* Tailwind Override */
.trix-editor {
  width: 100%;
}

.trix-editor h1 {
  font-size: 1.25rem !important;
  line-height: 1.25rem !important;
  margin-bottom: 1rem;
  font-weight: 600;
}

.trix-editor a:not(.no-underline) {
  text-decoration: underline;
}

.trix-editor a:visited {
  color: green;
}

.trix-editor ul {
  list-style-type: disc;
  padding-left: 1rem;
}

.trix-editor ol {
  list-style-type: decimal;
  padding-left: 1rem;
}

.trix-editor pre {
  display: inline-block;
  width: 100%;
  vertical-align: top;
  font-family: monospace;
  font-size: 1.5em;
  padding: 0.5em;
  white-space: pre;
  background-color: #eee;
  overflow-x: auto;
}

.trix-editor blockquote {
  border: 0 solid #ccc;
  border-left-width: 0px;
  border-left-width: 0.3em;
  margin-left: 0.3em;
  padding-left: 0.6em;
}

/* Flash notification animations */
@keyframes slide-in-right {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slide-out-right {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

.animate-slide-in-right {
  animation: slide-in-right 0.3s ease-out forwards;
}

.animate-slide-out-right {
  animation: slide-out-right 0.3s ease-out forwards;
}

/* Print styles */
@media print {
  /* Hide navigation and UI chrome */
  nav,
  footer,
  #flash_messages,
  .mobile-navigation,
  .desktop-navigation,
  [data-controller="mobile-menu"],
  [data-controller="dropdown"] {
    display: none !important;
  }

  /* Remove all padding and margins */
  main {
    padding: 0 !important;
    margin: 0 !important;
    background: white !important;
  }

  .p-4,
  .p-6,
  .lg\:p-6 {
    padding: 0.5rem !important;
  }

  footer {
    display: none !important;
  }

  /* Hide grouped view sidebar */
  .print\:hidden {
    display: none !important;
  }

  /* Full width for print content */
  .print\:w-full {
    width: 100% !important;
  }

  /* Show columns hidden on smaller screens */
  .print\:table-cell {
    display: table-cell !important;
  }

  /* Remove decorative styling */
  .rounded-xl,
  .rounded-lg {
    border-radius: 0 !important;
  }

  .shadow-sm,
  .shadow {
    box-shadow: none !important;
  }

  .ring-1 {
    box-shadow: none !important;
  }

  /* Remove borders */
  .border,
  .border-slate-200 {
    border: none !important;
  }

  /* Ensure tables print well */
  table {
    width: 100% !important;
    font-size: 10pt !important;
  }

  th, td {
    padding: 2px 4px !important;
  }

  /* Page break handling */
  tr {
    page-break-inside: avoid;
  }

  thead {
    display: table-header-group;
  }

  /* Set white background */
  body,
  .bg-gray-100,
  .bg-slate-50,
  .bg-white {
    background: white !important;
  }

  /* Compact header section */
  .mb-4 {
    margin-bottom: 0.5rem !important;
  }

  /* Remove gap spacing */
  .gap-2,
  .gap-3 {
    gap: 0.25rem !important;
  }
}
