/* ═══════════════════════════════════════════════════════════
   BridgeHub Results — Display Styles
   Modern, fast, CSS-variable driven. Dark-mode aware.
   ═══════════════════════════════════════════════════════════ */

/* ── Variables ── */
.bhr-results-wrap {
  --bhr-head-bg:     var(--wp--preset--color--theme-palette-1, #0073aa);
  --bhr-head-fg:     #ffffff;
  --bhr-bg:          #ffffff;
  --bhr-row-odd:     #ffffff;
  --bhr-row-even:    #f5f7fa;
  --bhr-row-hover:   #e8f0fe;
  --bhr-border:      #dce1e8;
  --bhr-text:        #1d2327;
  --bhr-text-muted:  #6b7280;
  --bhr-accent:      var(--wp--preset--color--vivid-green-cyan, #00d084);
  --bhr-radius:      8px;
  --bhr-cell-px:     12px;
  --bhr-cell-py:     10px;
  --bhr-font:        -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  margin: 1em 0;
  font-family: var(--bhr-font);
  color: var(--bhr-text);
  background: var(--bhr-bg);
  border: 1px solid var(--bhr-border);
  border-radius: var(--bhr-radius);
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* ── Dark mode ── */
@media (prefers-color-scheme: dark) {
  .bhr-results-wrap {
    --bhr-head-bg:    #19324f;
    --bhr-head-fg:    #e9eef6;
    --bhr-bg:         #0f1724;
    --bhr-row-odd:    #111827;
    --bhr-row-even:   #0b1220;
    --bhr-row-hover:  #1b2a41;
    --bhr-border:     #22324a;
    --bhr-text:       #e0e6ee;
    --bhr-text-muted: #8899aa;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  }
}
/* Kadence dark-mode class fallback */
.color-switch-dark .bhr-results-wrap,
.bhr-results-wrap.bhr-theme-dark {
  --bhr-head-bg:    #19324f;
  --bhr-head-fg:    #e9eef6;
  --bhr-bg:         #0f1724;
  --bhr-row-odd:    #111827;
  --bhr-row-even:   #0b1220;
  --bhr-row-hover:  #1b2a41;
  --bhr-border:     #22324a;
  --bhr-text:       #e0e6ee;
  --bhr-text-muted: #8899aa;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
/* JS-detected light — override prefers-color-scheme:dark media query */
.bhr-results-wrap.bhr-theme-light {
  --bhr-head-bg:     var(--wp--preset--color--theme-palette-1, #0073aa);
  --bhr-head-fg:     #ffffff;
  --bhr-bg:          #ffffff;
  --bhr-row-odd:     #ffffff;
  --bhr-row-even:    #f5f7fa;
  --bhr-row-hover:   #e8f0fe;
  --bhr-border:      #dce1e8;
  --bhr-text:        #1d2327;
  --bhr-text-muted:  #6b7280;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* ── Table ── */
.bhr-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 15px;
}

.bhr-table th,
.bhr-table td {
  padding: var(--bhr-cell-py) var(--bhr-cell-px);
  border-bottom: 1px solid var(--bhr-border);
  vertical-align: middle;
}

.bhr-table thead th {
  background: var(--bhr-head-bg);
  color: var(--bhr-head-fg);
  font-weight: 600;
  text-align: center;
  user-select: none;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 2;
}

.bhr-table tbody tr:nth-child(odd)  { background: var(--bhr-row-odd); }
.bhr-table tbody tr:nth-child(even) { background: var(--bhr-row-even); }
.bhr-table tbody tr:hover           { background: var(--bhr-row-hover); }

/* ── Column widths ── */
.bhr-col-date     { width: 100px; max-width: 120px; text-align: center; }
.bhr-col-image    { width: 64px; text-align: center; }
.bhr-col-category { width: 110px; max-width: 130px; text-align: center; }
.bhr-col-name     { width: auto; }
.bhr-col-type     { width: 80px; max-width: 100px; text-align: center; }
.bhr-col-user     { width: 110px; max-width: 130px; font-size: 13px; color: var(--bhr-text-muted); }
.bhr-col-delete   { width: 50px; text-align: center; }

/* ── Thumb ── */
.bhr-thumb {
  max-width: 44px;
  max-height: 44px;
  object-fit: cover;
  border-radius: 8px;
  display: block;
  margin: 0 auto;
}

/* ── Link ── */
.bhr-link {
  color: var(--wp--preset--color--theme-palette-2, var(--global-palette-highlight, #0073aa));
  text-decoration: none;
  font-weight: 400;
}
.bhr-link:hover { text-decoration: underline; }

/* ── Location sub-line ── */
.bhr-location {
  font-size: 0.8em;
  color: var(--bhr-text-muted);
  margin-top: 0;
  line-height: 1.3;
}

/* ── Category badge (matches BridgeHub Events .bh-badge) ── */
.bhr-cat-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 4px;
  color: #fff;
  white-space: nowrap;
}

/* ── Sort arrow ── */
.bhr-sort-arrow {
  font-size: 0.8em;
  margin-left: 4px;
  opacity: 0.6;
}

/* ── Skeleton loading ── */
.bhr-skeleton {
  background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%);
  background-size: 200% 100%;
  animation: bhr-shimmer 1.2s ease-in-out infinite;
  border-radius: 4px;
  display: block;
}
@keyframes bhr-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.bhr-skeleton-row td { padding: 6px var(--bhr-cell-px); }

/* ── Loading state ── */
.bhr-results-wrap.bhr-loading { opacity: 0.7; transition: opacity 0.15s ease; }
.bhr-results-wrap[aria-busy="true"] .bhr-search-box { cursor: wait; }

/* ── Meta bar ── */
.bhr-meta {
  font-size: 13px;
  color: var(--bhr-text-muted);
  margin: 6px 0;
}

/* ── Search box ── */
.bhr-search-box {
  display: block;
  width: 100%;
  max-width: 360px;
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 15px;
  border: 1px solid var(--bhr-border);
  border-radius: var(--bhr-radius);
  background: var(--bhr-row-even);
  color: var(--bhr-text);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
.bhr-search-box:focus {
  border-color: var(--bhr-accent);
  box-shadow: 0 0 0 2px rgba(0, 208, 132, 0.2);
  background: var(--bhr-bg);
}

/* ── Year navigation ── */
.bhr-year-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}
.bhr-year-btn {
  padding: 6px 14px;
  border-radius: var(--bhr-radius);
  border: 1px solid var(--bhr-border);
  background: var(--bhr-row-even);
  color: var(--bhr-text);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s ease;
}
.bhr-year-btn:hover {
  background: var(--bhr-accent);
  color: #fff;
  border-color: var(--bhr-accent);
}
.bhr-year-btn.is-active {
  background: var(--bhr-accent);
  color: #fff;
  border-color: var(--bhr-accent);
  font-weight: 700;
}

/* ── Load more button ── */
.bhr-load-more {
  display: block;
  margin: 16px auto;
  padding: 10px 32px;
  font-size: 15px;
  font-weight: 600;
  border: 1px solid var(--bhr-border);
  border-radius: var(--bhr-radius);
  background: var(--bhr-row-even);
  color: var(--bhr-text);
  cursor: pointer;
  transition: all 0.15s ease;
}
.bhr-load-more:hover {
  background: var(--bhr-accent);
  color: #fff;
  border-color: var(--bhr-accent);
}
.bhr-load-more:disabled { opacity: 0.6; cursor: wait; }

/* ── Delete button ── */
.bhr-delete-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: #d63638;
  transition: opacity 0.15s;
  display: inline-flex;
  align-items: center;
}
.bhr-delete-btn:hover { opacity: 0.7; }

/* ── Delete flash animation ── */
.bhr-flash-delete {
  animation: bhr-flash-del 450ms ease-in-out;
}
@keyframes bhr-flash-del {
  0%   { background-color: #fee; }
  50%  { background-color: #f72e2e; color: #fff; }
  100% { background-color: transparent; }
}
.bhr-flash-error {
  animation: bhr-flash-err 900ms ease-in-out;
}
@keyframes bhr-flash-err {
  0%   { background-color: #fff2f2; }
  50%  { background-color: #ffe0e0; }
  100% { background-color: transparent; }
}

/* ── Overalls ── */
.bhr-overalls-wrap {
  text-align: center;
  margin: 0 0 16px;
}
.bhr-overalls-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--bhr-text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.bhr-overalls-links {
  padding: 8px 0;
  border-top: 1px dashed var(--bhr-border);
  border-bottom: 1px dashed var(--bhr-border);
  font-size: 14px;
}
.bhr-overalls-links a {
  color: var(--wp--preset--color--theme-palette-2, #0073aa);
  text-decoration: none;
  font-weight: 500;
}
.bhr-overalls-links a:hover { text-decoration: underline; }
.bhr-overalls-links .bhr-overalls-text { color: var(--bhr-text); font-weight: 500; }
.bhr-overalls-links span { margin: 0 6px; color: var(--bhr-text-muted); }

/* ── Responsive ── */
@media (max-width: 768px) {
  .bhr-col-image,
  .bhr-col-category { display: none; }

  .bhr-col-user { display: none; }

  .bhr-table { font-size: 14px; }

  .bhr-search-box { max-width: 100%; }
}

@media (max-width: 480px) {
  .bhr-col-type { display: none; }
  .bhr-col-date { width: 80px; font-size: 13px; }
}
