/* Source Sans Pro is self-hosted (see source-sans-pro.css) to avoid the
   third-party Google Fonts dependency flagged by Qualys QID 150221/150845. */
@import url('source-sans-pro.css');

:root {
  /* ODNR Brand Colors */
  --odnr-green: #527445;
  --odnr-footer-gray: #F2F2F2;
  --odnr-text: #464846;
  --odnr-red: #B52626;
  --odnr-green-medium: #718B64;
  --odnr-green-dark: #4D7343;
  --odnr-blue-dark: #025373;
  --odnr-blue-medium: #6394BF;
  --odnr-charcoal: #2A2F36;
  --odnr-green-light: #8BA87C;
  --odnr-cyan: #2B9EC3;
  --odnr-gray: #4D4D4D;
  --odnr-tan: #C7B074;
  --odnr-gold: #D9B43E;
  --odnr-light-gray: #EAEAEA;

  /* Theme Assignments — swap this block to retheme */
  --color-background: #EAEAEA;    /* odnr-light-gray — page background */
  --color-surface: #F2F2F2;       /* odnr-footer-gray — cards, forms */
  --color-text: #464846;          /* odnr-text — body text (mandatory) */
  --color-border: #4D4D4D;        /* odnr-gray — borders */
  --color-danger: #B52626;        /* odnr-red — delete/error */
  --color-accent: var(--odnr-tan);             /* #C7B074 — headers, title bars, nav bar, focus */
  --color-accent-strong: var(--odnr-charcoal); /* #2A2F36 — buttons, active states */
}

html.loading-results {
  scrollbar-gutter: stable;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}


body {
  font-family: 'Source Sans Pro', sans-serif;
  color: var(--color-text);
  background-color: var(--color-background);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header — desktop uses absolute-positioned logos for true centering,
   mobile switches to flex row via media query */
/* Mobile logo bar — hidden by default, shown at 480px */
.xs-logo-bar {
  display: none;
}

.site-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(12px, 2.5vw, 24px) clamp(12px, 2vw, 32px);
  background-color: #ffffff;
}

.site-header.has-shadow {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.075);
}

.header-left,
.header-right {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}

.header-left {
  left: clamp(12px, 2vw, 32px);
}

.header-right {
  right: clamp(12px, 2vw, 32px);
  display: flex;
  align-items: center;
  gap: clamp(8px, 1vw, 16px);
}

.header-left img {
  height: auto;
  width: auto;
  max-height: clamp(24px, 3.4vw, 52px);
}

.header-right img {
  height: auto;
  width: auto;
  max-height: clamp(32px, 4.5vw, 75px);
}

.header-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.header-home-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  text-decoration: none;
  color: inherit;
}

.header-home-link:hover .header-title {
  text-decoration: underline;
}

.header-title {
  font-size: clamp(0.6rem, 1.25vw, 1.3rem);
  font-weight: 700;
  color: var(--odnr-text);
  margin-bottom: 4px;
  white-space: nowrap;
  line-height: 1.2;
}

.header-subtitle {
  font-size: clamp(0.42rem, 0.85vw, 0.8rem);
  font-weight: 400;
  color: var(--odnr-text);
  white-space: nowrap;
  line-height: 1.2;
}

/* Nav Bar */
.site-nav {
  display: flex;
  justify-content: center;
  gap: 4px;
  background-color: #ffffff;
  padding: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.075);
}

.nav-link {
  color: var(--color-text);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 8px 20px;
  letter-spacing: 0.03em;
  transition: background-color 0.15s;
}

.nav-link:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.nav-link.active {
  background-color: rgba(0, 0, 0, 0.12);
  border-bottom: 2px solid var(--color-text);
}

.nav-link i {
  margin-right: 4px;
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 32px;
  max-width: 1250px;
  margin: 0 auto;
  width: 100%;
}

.admin-page .main-content {
  max-width: 1600px;
}

/* Footer */
.site-footer {
  background-color: #ffffff;
  padding: 16px 32px;
  font-size: 0.875rem;
  color: var(--odnr-text);
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.075);
}

.footer-inner {
  display: flex;
  align-items: center;
  position: relative;
}

.footer-text {
  flex: 1;
  text-align: center;
}

.footer-logo {
  position: absolute;
  right: 0;
}

.footer-text p {
  margin: 4px 0;
}

.footer-logo img {
  height: 40px;
}

/* Search Form */
.search-form {
  background: var(--color-surface);
  border-radius: 6px;
  padding: 0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  margin-bottom: 24px;
  overflow: hidden;
}

.filter-details summary.results-header {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  user-select: none;
}

.filter-details summary.results-header::-webkit-details-marker {
  display: none;
}

.filter-details summary.results-header::after {
  content: '\25BC';
  position: absolute;
  right: 12px;
  font-size: 0.65rem;
  transition: transform 0.2s;
}

.filter-details[open] summary.results-header::after {
  transform: rotate(180deg);
}

.filter-details .filter-collapse {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.3s ease;
}

.filter-details[open] .filter-collapse {
  grid-template-rows: 1fr;
}

.filter-details .filter-collapse > .filter-inner {
  overflow: hidden;
}

.search-form .filter-grid {
  padding: 24px 24px 0;
}

.search-form .form-actions {
  padding-bottom: 24px;
}

.filter-grid {
  display: flex;
  flex-wrap: nowrap;
  gap: 16px;
  margin-bottom: 20px;
  align-items: stretch;
}


.filter-group + .filter-group {
  padding-left: 16px;
  border-left: 1px solid rgba(0, 0, 0, 0.12);
}

.filter-group {
  flex: 1 1 auto;
  border: none;
  padding: 0;
  margin: 0;
}

.filter-group legend,
.filter-group > label:first-child:not(:has(input)) {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--odnr-charcoal);
  margin-bottom: 6px;
  display: block;
}

.filter-group label {
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-right: 10px;
  cursor: pointer;
}

.filter-group--stacked label {
  display: flex;
  margin-right: 0;
  white-space: nowrap;
  margin-bottom: 4px;
}

.filter-group--stacked > label:first-child:not(:has(input)) {
  white-space: normal;
}

.score-controls label {
  margin-bottom: 0;
}

.filter-group select,
.filter-group input[type="text"],
.filter-group input[type="number"] {
  width: 100%;
  height: 36px;
  padding: 6px 10px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--color-text);
  background: var(--color-surface);
  box-sizing: border-box;
  -webkit-appearance: none;
  -moz-appearance: none;
}

.filter-group select:focus,
.filter-group input:focus {
  outline: 2px solid var(--color-accent);
  outline-offset: -1px;
}

/* Score controls */
.score-controls {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.score-inputs {
  display: flex;
  align-items: center;
  gap: 4px;
}

.score-dot {
  font-weight: 700;
  font-size: 1.1rem;
}

.score-whole {
  width: 80px !important;
  height: 36px !important;
}

.score-eighths {
  width: 70px !important;
  height: 36px !important;
  box-sizing: border-box;
}

/* Form actions */
.form-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.form-actions .btn {
  height: 34px;
  padding: 0 20px;
  font-size: 0.82rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 28px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1;
  border-radius: 32px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s, box-shadow 0.15s;
}

.btn-primary {
  background-color: var(--color-accent-strong);
  color: #ffffff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  padding-left: 24px;
  padding-right: 28px;
}

.btn-primary:hover {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  filter: brightness(1.1);
}

.btn-secondary {
  background-color: var(--color-surface);
  color: var(--color-text);
  border-color: var(--color-border);
}

.btn-secondary:hover {
  background-color: var(--color-background);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(0.1);
}

.btn-danger {
  background-color: var(--color-danger);
  color: #ffffff;
}

.btn-danger:hover {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.btn-edit {
  background: none;
  border: none;
  color: var(--odnr-charcoal);
  font: inherit;
  cursor: pointer;
  padding: 0;
  font-weight: 600;
  text-decoration: underline;
  margin-right: 14px;
}

.btn-edit:hover {
  opacity: 0.7;
}

.btn-delete {
  background: none;
  border: none;
  color: var(--color-danger);
  font: inherit;
  cursor: pointer;
  padding: 0;
  font-weight: 600;
  text-decoration: underline;
}

.btn-delete:hover {
  color: var(--odnr-charcoal);
}

/* Results container transition */
#results-container {
  transition: opacity 0.25s ease, transform 0.25s ease;
}

#results-container.fading {
  opacity: 0;
  transform: scale(0.97);
}

#results-container.loading {
  position: relative;
  min-height: 120px;
}

#results-container.loading::after {
  content: '';
  position: absolute;
  top: 40px;
  left: 50%;
  width: 40px;
  height: 40px;
  margin-left: -20px;
  border: 4px solid var(--odnr-light-gray);
  border-top-color: var(--odnr-gray);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  #results-container {
    transition: none !important;
    transform: none !important;
  }
  #results-container.loading::after {
    animation: none;
    content: 'Loading\2026';
    width: auto;
    height: auto;
    border: none;
    margin-left: 0;
    transform: translateX(-50%);
    font-size: 0.85rem;
    color: var(--color-text);
  }
}

/* Results */
.results-section {
  background: var(--color-surface);
  border-radius: 6px;
  padding: 0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.results-header {
  background-color: var(--color-accent);
  color: #ffffff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 8px 20px;
  text-align: center;
  border-bottom: 2px solid rgba(0, 0, 0, 0.15);
}

.results-count {
  font-size: 0.85rem;
  color: var(--color-text);
  margin: 0;
  white-space: nowrap;
}

.results-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
}

.table-wrap.scroll-hint::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: 40px;
  background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.85));
  pointer-events: none;
  z-index: 1;
}

.results-table {
  table-layout: auto;
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.results-table th,
.results-table td {
  padding: 6px 8px;
  text-align: center;
  border-bottom: 1px solid var(--color-border);
  border-left: 1px solid rgba(0, 0, 0, 0.15);
  border-right: 1px solid rgba(0, 0, 0, 0.15);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.results-table td:empty:not(.filter-row td)::after {
  content: "\2014";
  opacity: 0.35;
}
.filter-row td:empty::after {
  content: none;
}

.results-table--public th,
.results-table--public td {
  border-bottom: none;
}

.results-table--public thead th {
  border-bottom: 1px solid var(--color-border);
}

.results-table thead th {
  background-color: var(--color-surface);
  color: var(--odnr-charcoal);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  text-align: center;
  white-space: normal;
  overflow: visible;
}

.filter-row td {
  padding: 4px 3px;
  background-color: var(--color-surface);
  border-bottom: 2px solid var(--color-border);
}

.filter-row input,
.filter-row select {
  width: 100%;
  height: 24px;
  padding: 2px 4px;
  border: 1px solid var(--color-border);
  border-radius: 3px;
  font-family: inherit;
  font-size: 0.7rem;
  color: var(--color-text);
  background: #fff;
  box-sizing: border-box;
}

.filter-row input:focus,
.filter-row select:focus {
  outline: 2px solid var(--color-accent);
  outline-offset: -1px;
}

.results-table tbody tr:nth-child(odd) {
  background-color: rgba(199, 176, 116, 0.15);
}

.results-table tbody tr:hover {
  background-color: rgba(199, 176, 116, 0.28);
}

.sort-link {
  color: inherit;
  text-decoration: none;
  display: inline;
}

.sort-link:hover {
  color: var(--color-accent);
}

.sort-active {
  color: var(--color-accent);
}

.sort-arrow {
  font-size: 0.7rem;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
}

.page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 7px;
  border-radius: 4px;
  font-size: 0.8rem;
  text-decoration: none;
  color: var(--color-text);
  border: 1px solid transparent;
}

.page-link:hover {
  background-color: rgba(113, 139, 100, 0.3);
  border-color: var(--color-accent);
}

.page-disabled {
  opacity: 0.4;
  pointer-events: none;
}

.page-current,
.page-current:hover {
  background-color: var(--color-accent-strong);
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  border-color: var(--color-accent-strong);
}

.page-ellipsis {
  padding: 0 4px;
  color: var(--color-text);
}

.page-icon {
  width: 11px;
  height: 11px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.page-size-label {
  font-size: 0.8rem;
  color: var(--color-text);
  margin-left: 12px;
}

.page-size-select {
  height: 28px;
  padding: 0 7px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.8rem;
  color: var(--color-text);
  margin-left: 4px;
}

/* Results footer meta row */
.results-footer-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Export: desktop shows meta-row button, mobile shows pagination-row button */
.btn-export {
  display: none;
}


.btn-sm {
  height: 28px;
  padding: 0 14px;
  font-size: 0.75rem;
  border-radius: 32px;
  gap: 5px;
}

/* Export Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  background: var(--color-accent);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  max-width: 92vw;
  overflow: hidden;
}

.modal-header {
  background-color: var(--color-accent);
  color: #ffffff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 8px 20px;
  text-align: center;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.modal-body {
  background: var(--color-surface);
  padding: 16px 20px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.export-picker {
  position: relative;
  width: 100%;
}

#export-limit-select {
  width: 100%;
  height: 36px;
  padding: 6px 10px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--color-text);
  background: var(--color-surface);
}

#export-limit-select:focus {
  outline: 2px solid var(--color-accent);
  outline-offset: -1px;
}

.export-custom-overlay {
  position: absolute;
  top: 1px;
  left: 1px;
  width: calc(100% - 24px);
  height: calc(100% - 2px);
  border: none;
  border-radius: 3px 0 0 3px;
  background: var(--color-surface);
  display: none;
  align-items: center;
  padding: 0 10px;
  gap: 6px;
}

.export-custom-overlay.active {
  display: flex;
}

.export-custom-label {
  font-size: 0.9rem;
  color: var(--color-text);
  white-space: nowrap;
}

#export-custom-input {
  width: 80px;
  height: 26px;
  padding: 2px 6px;
  border: 1px solid var(--color-border);
  border-radius: 3px;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--color-text);
  background: #fff;
  outline: none;
}

#export-custom-input:focus {
  border-color: var(--color-accent);
}

#export-custom-input.input-error {
  border-color: var(--color-danger);
}

.modal-error {
  font-size: 0.78rem;
  color: var(--color-danger);
  text-align: center;
}

.modal-error:empty {
  display: none;
}

.export-all-warning {
  display: none;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--odnr-text);
  text-align: left;
  margin: 0;
  padding: 6px 10px;
  border-left: 3px solid var(--odnr-gold);
  background: rgba(217, 180, 62, 0.12);
  border-radius: 3px;
}

.export-all-warning.visible {
  display: flex;
}

.export-all-warning i {
  color: var(--odnr-gold);
  flex-shrink: 0;
}

.modal-footer {
  background: var(--color-surface);
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 16px 20px;
}

.modal-footer .btn {
  height: 32px;
  padding: 0 18px;
  font-size: 0.8rem;
}


/* Clear filters button in action column */
.admin-header {
  display: flex;
  align-items: center;
  position: relative;
}

.admin-header span {
  flex: 1;
  text-align: center;
}

.btn-clear-filters {
  position: absolute;
  right: 6px;
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.4);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  padding: 3px 12px;
  border-radius: 3px;
}

.btn-clear-filters:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Add row at bottom of admin table */
.add-row td {
  padding: 4px 8px;
  text-align: center;
}

.add-row .btn-add-new {
  background: #ffffff;
  color: var(--odnr-charcoal);
  border: 1px dashed var(--odnr-charcoal);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  padding: 0px 8px;
  border-radius: 3px;
  line-height: 1.4;
}

.add-row .btn-add-new:hover {
  opacity: 0.85;
}

.add-row:hover {
  background-color: transparent !important;
}

/* Edit/Add modal */
.edit-modal {
  width: 620px;
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

.edit-modal .modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-align: left;
  background-color: var(--color-accent);
  color: #ffffff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  padding: 12px 16px;
  font-size: 0.95rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: #ffffff;
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
  padding: 0;
}

.modal-close:hover {
  opacity: 0.7;
}

.edit-body {
  background: var(--color-surface);
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.edit-row {
  display: flex;
  gap: 10px;
}

.edit-row .edit-field {
  flex: 1;
}

.edit-field {
  display: flex;
  flex-direction: column;
}

.edit-field label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--odnr-charcoal);
  margin-bottom: 4px;
}

.edit-field input,
.edit-field select {
  height: 34px;
  padding: 4px 8px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--color-text);
  background: #fff;
  box-sizing: border-box;
  width: 100%;
}

.edit-field input:focus,
.edit-field select:focus {
  outline: 2px solid var(--color-accent);
  outline-offset: -1px;
}

.score-inputs {
  display: flex;
  gap: 8px;
}

.score-inputs input,
.score-inputs select {
  height: 34px;
  padding: 4px 8px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--color-text);
  background: #fff;
  box-sizing: border-box;
}

.score-inputs input {
  flex: 1;
  min-width: 0;
}

.score-inputs select {
  width: 70px;
  flex-shrink: 0;
}

.modal-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 16px 24px 20px;
  background: var(--color-surface);
}

.modal-actions .btn {
  height: 36px;
  padding: 0 28px;
  font-size: 0.85rem;
  min-width: 110px;
}

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.btn-secondary:hover {
  background: var(--odnr-light-gray);
}

.edit-error {
  color: var(--color-danger);
  font-size: 0.8rem;
  text-align: center;
  padding: 0 24px 12px;
  background: var(--color-surface);
}

/* Clickable rows */
.admin-page tbody tr {
  cursor: default;
}

.admin-page tbody tr:hover {
  background-color: rgba(0, 0, 0, 0.08) !important;
}

/* Filter operator UI */
.filter-cell {
  display: flex;
  align-items: center;
  gap: 2px;
}

.filter-cell .col-filter {
  flex: 1;
  min-width: 30px;
  width: 0;
  box-sizing: border-box;
}

.filter-op-btn {
  flex-shrink: 0;
  width: 20px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: 3px;
  background: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #999;
  transition: color 0.15s, border-color 0.15s;
}

.filter-op-btn:hover {
  color: var(--color-text);
  border-color: var(--color-text);
}

.filter-op-btn.active {
  color: var(--color-accent-strong);
  border-color: var(--color-accent-strong);
  background: var(--odnr-light-gray);
}

.filter-op-btn i {
  font-size: 10px;
}

#filter-op-menu {
  display: none;
  position: fixed;
  z-index: 1000;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  min-width: 180px;
  max-height: 70vh;
  overflow-y: auto;
  padding: 4px 0;
}

#filter-op-menu.open {
  display: block;
}

#filter-op-menu a {
  display: block;
  padding: 4px 12px;
  font-size: 0.72rem;
  color: var(--color-text);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

#filter-op-menu a:hover {
  background: var(--color-background);
}

#filter-op-menu a.selected {
  font-weight: 700;
  color: var(--color-accent-strong);
  background: var(--odnr-light-gray);
}


/* Excel Upload page */
.upload-page .main-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 40px;
}

.upload-card {
  width: 700px;
  max-width: calc(100% - 40px);
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.upload-header {
  padding: 24px 28px 20px;
}

.upload-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--odnr-charcoal);
  margin: 0 0 8px;
}

.upload-instructions {
  font-size: 0.85rem;
  color: var(--color-text);
  margin: 0 0 10px;
  line-height: 1.5;
}

.upload-columns {
  display: block;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.78rem;
  color: var(--color-text);
  background: var(--color-surface);
  padding: 8px 12px;
  border-radius: 4px;
  line-height: 1.6;
  word-break: break-word;
}

.upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin: 0 28px 24px;
  padding: 24px 20px;
  border: 2px dashed var(--color-border);
  border-radius: 6px;
  background: var(--color-surface);
}

.upload-zone.drag-over {
  border-color: var(--color-accent-strong);
  background: var(--odnr-light-gray);
}

.upload-drop-hint {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-text);
  margin: 0;
}

.upload-or {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text);
  opacity: 0.5;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.upload-select-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 12px;
}

.upload-select-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text);
}

.upload-file-label {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  height: 32px;
  padding: 0 14px;
  font-size: 0.85rem;
  border-radius: 4px;
}

.upload-filename {
  font-size: 0.85rem;
  color: var(--color-text);
  opacity: 0.7;
}

.upload-filename.has-file {
  opacity: 1;
  font-weight: 600;
}

.upload-message {
  margin: 0 28px 20px;
  padding: 8px 14px;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.upload-message-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: inherit;
  padding: 0 2px;
  line-height: 1;
}

.upload-message-close:hover {
  opacity: 0.7;
}

.upload-error {
  background: #fde8e8;
  color: var(--color-danger);
  border: 1px solid var(--color-danger);
}

.upload-success {
  background: #ecf2ea;
  color: var(--color-accent-strong);
  border: 1px solid var(--color-accent-strong);
}

/* Preview area */
.upload-preview {
  width: 100%;
  max-width: 1600px;
  margin-top: 24px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

.upload-preview .results-header {
  margin-bottom: 0;
}

.upload-preview .results-footer {
  background: #ffffff;
}

.upload-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
  margin-bottom: 16px;
}

/* Error pages */
.error-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 50vh;
}

.error-card {
  text-align: center;
  background: var(--color-surface);
  border-radius: 10px;
  padding: 48px 40px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  max-width: 480px;
}

.error-code {
  font-size: 4rem;
  font-weight: 700;
  color: var(--color-accent);
  margin: 0 0 8px;
  line-height: 1;
}

.error-title {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--odnr-charcoal);
  margin: 0 0 12px;
}

.error-message {
  font-size: 0.95rem;
  color: var(--color-text);
  margin: 0 0 24px;
  line-height: 1.5;
}

/* ============================================
   Cookie Consent Banner
   ============================================ */

.cookie-consent-banner {
  position: fixed;
  bottom: 20px;
  right: 0;
  width: auto;
  background-color: var(--color-surface);
  color: var(--color-text);
  padding: 1.5rem 1.75rem;
  border-radius: 0;
  border-left: 4px solid var(--color-accent);
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.2), 0 0 10px rgba(0, 0, 0, 0.1);
  z-index: 9998;
  display: none;
  flex-direction: column;
  align-items: stretch;
  gap: 1rem;
  white-space: nowrap;
  animation: cookieSlideIn 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.cookie-close-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background-color: var(--color-surface);
  border: none;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--color-text);
  opacity: 0.5;
  cursor: pointer;
  padding: 0.25rem;
  font-family: 'Source Sans Pro', sans-serif;
  transition: opacity 0.2s ease;
}

.cookie-close-btn:hover {
  opacity: 1;
}

.cookie-close-btn:focus {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

@keyframes cookieSlideIn {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.cookie-consent-title {
  margin: 0 0 0.5rem 0;
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.4;
  font-family: 'Source Sans Pro', sans-serif;
}

.cookie-consent-description {
  margin: 0;
  font-size: 1rem;
  line-height: 1.5;
  opacity: 0.85;
  font-family: 'Source Sans Pro', sans-serif;
}

.cookie-consent-buttons {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.5rem;
}

.cookie-btn {
  padding: 0.4rem 1.75rem !important;
  min-height: unset !important;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 32px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Source Sans Pro', sans-serif;
  text-decoration: none;
  text-align: center;
}

.cookie-btn-accept {
  background-color: var(--color-accent-strong);
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.cookie-btn-accept:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.cookie-link-secondary {
  color: var(--color-accent-strong);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: underline;
  font-family: 'Source Sans Pro', sans-serif;
}

.cookie-link-secondary:hover {
  filter: brightness(1.15);
  text-decoration: underline;
}

.cookie-btn:focus {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

@media (max-width: 768px) {
  .cookie-consent-banner {
    bottom: 0;
    right: 0;
    left: 0;
    max-width: none;
    border-left: none;
    border-top: none;
    padding: 1rem;
    animation: cookieSlideUp 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  }
}

@media (max-width: 480px) {
  .cookie-consent-buttons {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  .cookie-btn {
    width: 100%;
  }
}

@keyframes cookieSlideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .cookie-consent-banner {
    animation: none;
  }
}

/* ============================================
   Responsive Breakpoints
   ============================================ */

/* --- Medium: tablets (<=900px) --- */
@media (max-width: 900px) {
  /* Footer: keep absolute logo for true centering, just scale down */
  .site-footer {
    padding: clamp(8px, 1.5vw, 16px) 2vw;
    font-size: clamp(0.65rem, 1.2vw, 0.875rem);
  }

  .footer-logo img {
    height: clamp(25px, 3.5vw, 40px);
  }

  /* Main content: fluid padding */
  .main-content {
    padding: clamp(6px, 1.5vw, 16px);
  }

  /* Reduce gap between search form and results */
  .search-form {
    margin-bottom: clamp(6px, 1.5vw, 14px);
  }

  /* Table text and padding */
  .results-table {
    font-size: 0.85rem;
  }

  .results-table th,
  .results-table td {
    padding: 8px 10px;
  }

  .results-table thead th {
    font-size: 0.75rem;
  }

  /* Section header bars (Search Filters, Results, Buck Records) */
  .results-header {
    font-size: 0.85rem;
    padding: 10px;
  }

  /* Filter panel labels and inputs */
  .filter-group legend,
  .filter-group > label:first-child:not(:has(input)) {
    font-size: 0.85rem;
  }

  .filter-group label {
    font-size: 0.95rem;
  }

  .filter-group select,
  .filter-group input[type="text"],
  .filter-group input[type="number"] {
    height: 44px;
    font-size: 1rem;
  }

  .search-form .filter-grid {
    padding: 16px 16px 0;
  }

  .search-form .form-actions {
    padding-bottom: 16px;
  }

  /* Buttons */
  .form-actions .btn {
    font-size: 0.95rem;
    height: 44px;
    padding: 0 20px;
  }

  /* Results count */
  .results-count {
    font-size: 0.85rem;
  }

  /* Pagination — keep compact so page-size fits on the same row */
  .pagination {
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
  }

  /* Show only 5 page numbers on mobile */
  .page-num:nth-child(n+6 of .page-num) {
    display: none;
  }

  .page-link {
    font-size: 0.9rem;
    min-width: 36px;
    height: 36px;
    padding: 0 6px;
  }

  .page-icon {
    width: 12px;
    height: 12px;
  }

  .page-size-label {
    font-size: 0.85rem;
    margin-left: 8px;
  }

  .page-size-select {
    font-size: 0.85rem;
    height: 32px;
    padding: 0 6px;
  }

  /* Results footer: pagination row + meta row */
  .results-footer {
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
    padding: 12px 16px;
  }

  /* Meta row: centered count only on mobile */
  .results-footer-meta {
    display: flex;
    justify-content: center;
  }

  .results-footer-meta .results-count {
    text-align: center;
    font-size: 0.8rem;
  }

  /* Score inputs: match other filter fields */
  .score-whole,
  .score-eighths {
    width: 100% !important;
    height: 44px !important;
    flex: 1 1 0;
  }

  .score-inputs {
    width: 100%;
  }

  /* Export: swap to pagination-row button on mobile */
  .btn-export {
    display: inline-flex;
    margin-left: 8px;
  }

  .btn-export-desktop {
    display: none;
  }

  .btn-sm {
    font-size: 0.85rem;
    height: 32px;
    padding: 0 12px;
  }

  /* Nav bar */
  .nav-link {
    font-size: 0.85rem;
    padding: 10px 16px;
  }

  /* Edit modal: responsive width */
  .edit-modal {
    width: calc(100% - 32px);
    max-width: 620px;
  }

  .edit-row {
    flex-wrap: wrap;
  }

  .edit-row .edit-field {
    min-width: 120px;
  }

  /* Upload preview */
  .upload-preview {
    max-width: 100%;
  }
}

/* --- Mobile: search page (<=768px) --- */
@media (max-width: 768px) {
  /* Filter panel: 2-column grid */
  .filter-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: clamp(8px, 1.5vw, 12px) clamp(10px, 2vw, 16px);
  }

  /* Drop the desktop's vertical divider/padding between filter groups —
     it doesn't translate to a wrapped grid layout. */
  .filter-group + .filter-group {
    padding-left: 0;
    border-left: none;
  }

  /* Radio groups inline (Rack Type, Rank, Sex — not Score) */
  .filter-group--stacked:not(.filter-group--score) {
    display: flex;
    flex-wrap: wrap;
    gap: 0 8px;
    align-items: center;
  }

  .filter-group--stacked:not(.filter-group--score) > label:first-child:not(:has(input)) {
    width: 100%;
    margin-bottom: 2px;
  }

  .filter-group--stacked:not(.filter-group--score) label {
    margin-bottom: 0;
  }

  /* Search/Reset buttons: side by side */
  .search-form .form-actions {
    flex-direction: row;
    gap: 8px;
  }

  .search-form .form-actions .btn {
    flex: 1;
  }
}

/* --- Small: phones (<=600px) --- */
@media (max-width: 600px) {
  /* Results table: ensure minimum readable size */
  .results-table {
    min-width: 700px;
  }

  .admin-page .results-table {
    min-width: 1100px;
  }

  /* Edit modal: full width */
  .edit-modal {
    width: calc(100% - 16px);
    max-height: 90vh;
    overflow-y: auto;
  }

  .edit-body {
    padding: 16px;
    gap: 14px;
  }

  .edit-row {
    flex-direction: column;
    gap: 10px;
  }

  .edit-row .edit-field {
    min-width: 0;
  }

  .modal-actions {
    padding: 12px 16px 16px;
  }

  /* Upload card */
  .upload-card {
    width: 100%;
    max-width: none;
  }

  .upload-header {
    padding: 20px 20px 16px;
  }

  .upload-zone {
    margin: 0 16px 20px;
    padding: 20px 16px;
  }


  /* Export modal */
  .modal {
    max-width: calc(100% - 16px);
  }

  /* Direct login button: reposition on small screens */
  .direct-login-form {
    position: fixed;
    top: auto;
    bottom: 16px;
    right: 16px;
    transform: none;
  }

  .btn-direct {
    padding: 10px 16px;
    font-size: 13px;
  }

  .btn-direct span {
    display: none;
  }
}


/* --- Small screens: two-row header layout --- */
@media (max-width: 480px) {
  .header-left,
  .header-right {
    display: none !important;
  }

  .site-header {
    display: block;
    padding: 0;
    box-shadow: 0 2vw 3vw rgba(0, 0, 0, 0.08);
  }

  .xs-logo-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 16vw;
    padding: 1.5vw 3vw 0 3vw;
    background: #ffffff;
    border-bottom: 0.5vw solid #c0c0c0;
  }

  .xs-logo-bar img {
    height: 12vw;
    width: auto;
  }

  .header-center {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 18vw;
    text-align: center;
    padding: 0;
  }

  .header-title {
    font-size: 5vw;
    white-space: nowrap;
    margin: 0;
  }

  .header-subtitle {
    font-size: 2.8vw;
    white-space: nowrap;
    margin: 0.5vw 0 0 0;
  }

  /* Footer */
  .site-footer {
    padding: 1.25rem 0.75rem;
    font-size: clamp(0.7rem, 3vw, 0.875rem);
  }

  .footer-logo {
    position: static;
  }

  .footer-inner {
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
  }

  .footer-logo img {
    height: clamp(25px, 8vw, 40px);
  }

  /* Filter grid: stack to one column on phones for full-width touch targets.
     The order tricks from the 768px rule are preserved (frequently-used
     filters first), so the stacked vertical order matches mobile expectations. */
  .filter-grid {
    grid-template-columns: 1fr;
  }
}

@media print {
  .cookie-consent-banner {
    display: none !important;
  }
}

/* ---------------------------------------------------------------------------
   Utility classes used to replace inline style="" attributes so we can drop
   'unsafe-inline' from the style-src CSP directive (Qualys QID 150207). Each
   class targets one previous inline-style use site; JS still toggles them
   with .style.display or class swaps, which CSP allows.
   --------------------------------------------------------------------------- */
.is-hidden { display: none; }
.table-wrap--rel { position: relative; }
.th-w-3  { width: 3%;  }
.th-w-4  { width: 4%;  }
.th-w-5  { width: 5%;  }
.th-w-6  { width: 6%;  }
.th-w-8  { width: 8%;  }
.th-w-10 { width: 10%; }
.icon-m-r-4 { margin-right: 4px; }
.username-info-icon {
  cursor: pointer;
  vertical-align: -1px;
  margin-left: 2px;
}
.user-modal-field--center { align-items: center; }
.label-nowrap { white-space: nowrap; }

/* login.html specifics — used to be in an inline <style> block. */
.ohid-inline-logo {
  height: 18px;
  width: auto;
  vertical-align: middle;
}
.login-create-account {
  text-align: center;
  margin-top: 10px;
  margin-bottom: 0;
}
.login-create-account a {
  color: #0e3f75;
  font-size: 14px;
  text-decoration: none;
}
.login-return-home {
  text-align: center;
  margin-top: 20px;
}
.login-return-home a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #464846;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}

/* Admin edit-modal row/field sizing — was inline style="width:70%" etc. */
.edit-row--w70 { width: 70%; }
.edit-row--w65 { width: 65%; }
.edit-field--f05  { flex: 0.5; }
.edit-field--f07  { flex: 0.7; }
.edit-field--f045 { flex: 0.45; }
.edit-field--f035 { flex: 0.35; }

/* Sortable-column widths for the search-results and admin tables. Both
   templates now render <th class="col-w-XX"> instead of inline width. */
.col-w-3  { width: 3%;  }
.col-w-4  { width: 4%;  }
.col-w-5  { width: 5%;  }
.col-w-6  { width: 6%;  }
.col-w-8  { width: 8%;  }
.col-w-9  { width: 9%;  }
.col-w-10 { width: 10%; }
.col-w-12 { width: 12%; }
.col-w-15 { width: 15%; }
