:root {
  --ub-gap: 1rem;
  --ub-gap-sm: 0.5rem;
  --ub-radius: 6px;
  --ub-border: #ddd;
  --ub-bg: #fafafa;
  --ub-blue: #0073aa;
  --ub-blue-hover: #006298;
  --ub-text-muted: #666;
  --ub-page-font: 13px;
  --ub-anchor-offset: 5rem; /* base offset under sticky header */
}

/* --- Form container --- */
.ub-search {
  padding: var(--ub-gap);
  border: 1px solid var(--ub-border);
  border-radius: var(--ub-radius);
  background: var(--ub-bg);
  font: inherit;
}

.ub-search h3 {
  margin: var(--ub-gap) 0 var(--ub-gap-sm);
  font-size: 1.1rem;
  font-weight: 600;
}

.ub-margin-top { margin-top: 1.5rem !important; }

/* --- Fields --- */
.ub-field { margin-bottom: var(--ub-gap); }

.ub-field label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.ub-field input[type="text"] {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.95rem;
  box-sizing: border-box;
}

/* --- Actions (buttons & links) --- */
.ub-actions { margin-top: var(--ub-gap); }

.ub-actions a.ub-button,
.ub-actions button,
a.ub-button {                /* extra selector in case it's outside .ub-actions */
  display: inline-block;
  padding: 0.6rem 1.2rem;
  border-radius: 4px;
  background-color: #93901D;
  color: #fff !important;
  border: 0;
  font: 500 16px/1.2 "Poppins", Sans-serif; /* set line-height to avoid squashing */
  text-decoration: none;
  cursor: pointer;
}

/* Hover/Focus */
.ub-actions a.ub-button:hover,
.ub-actions a.ub-button:focus,
.ub-actions button:hover,
.ub-actions button:focus,
a.ub-button:hover,
a.ub-button:focus {
  border-radius: 4px;
  background-color: #807D20 ;
  color: #fff;
}

/* --- Results / headings --- */
.ub-results h2,
.ub-detail h2 {
  margin: var(--ub-gap) 0 var(--ub-gap-sm);
  font-size: 1.2rem;
  font-weight: 700;
}

.ub-detail h1 {
  margin: 0 0 .5rem;
  font-size: 1.4rem;
}

.ub-message { margin: 0.25rem 0 1rem; }

/* --- Tables (results & detail) --- */
.ub-table,
.ub-detail-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.75rem;
}

.ub-table td,
.ub-detail-table td {
  padding: 0.5rem 0.25rem;
  vertical-align: top;
}

.ub-col-name { width: 50%; }
.ub-item { width: 25%; font-weight: 600; }
.ub-muted { color: var(--ub-text-muted); }

/* --- Pagination --- */
.ub-pagination { margin-top: 0.75rem; }

.ub-page-link,
.ub-page-current {
  font-size: var(--ub-page-font);
  margin-right: 0.25rem;
  text-decoration: none;
}
.ub-page-current { font-weight: 700; }

/* --- Anchor offset for sticky headers --- */
#ub-results,
#ub-view { scroll-margin-top: var(--ub-anchor-offset); }
html { scroll-behavior: smooth; }

/* WP admin bar adjustments */
body.admin-bar #ub-results,
body.admin-bar #ub-view {
  scroll-margin-top: calc(var(--ub-anchor-offset) + 32px);
}
@media (max-width: 782px) {
  body.admin-bar #ub-results,
  body.admin-bar #ub-view {
    scroll-margin-top: calc(var(--ub-anchor-offset) + 46px);
  }
}

/* Fallback for older browsers that ignore scroll-margin-top */
#ub-results:target::before,
#ub-view:target::before {
  content: "";
  display: block;
  height: var(--ub-anchor-offset);
  margin-top: calc(-1 * var(--ub-anchor-offset));
  visibility: hidden;
}
