/* =========================================================
   V2 Rounds page — toolbar dropdowns + grid view
   ========================================================= */

.toolbar-dropdown {
  z-index: 100;
  background: var(--bg-elev-2);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  padding: 6px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.4);
  max-height: 300px;
  overflow-y: auto;
  min-width: 180px;
}

.toolbar-dropdown .dropdown-option {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 8px 12px;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  text-align: left;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background .1s ease;
}

.toolbar-dropdown .dropdown-option:hover {
  background: var(--bg-elev);
}

.toolbar-dropdown .dropdown-option.active {
  color: var(--accent);
  font-weight: 600;
}

.toolbar-dropdown .dropdown-option.danger {
  color: var(--clay);
}
.toolbar-dropdown .dropdown-option.danger:hover {
  background: rgba(226,122,91,0.1);
}

/* Round rows need an extra grid column for the 3-dot menu.
   Base .browse-item is "64px 1fr auto" — extend to add a 4th. */
.browse-item[data-round-href] {
  grid-template-columns: 64px 1fr auto auto;
}

.browse-item .item-menu {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
  align-self: center;
  justify-self: end;
}
.browse-item .item-menu:hover {
  background: var(--bg-elev-2);
  color: var(--ink);
  border-color: var(--hairline);
}

/* Make the row div behave like a clickable link */
.browse-item[data-round-href] {
  cursor: pointer;
}
.browse-item[data-round-href]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* The .item-chips-grid is only used in grid view — hide in list view */
.browse-list:not(.grid-view) .item-chips-grid {
  display: none;
}

/* Show the selected filter value inside the toolbar-select button */
.toolbar-select .v {
  font-weight: 600;
  color: var(--ink);
  margin-right: 4px;
}

/* ---------- GRID VIEW ---------- */
.browse-list.grid-view {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

.browse-list.grid-view .month-divider {
  grid-column: 1 / -1;
}

/* Grid-view row: 2-row CSS grid with fixed columns so long course
   names truncate rather than forcing score onto a new line. */
.browse-list.grid-view .browse-item,
.browse-list.grid-view .browse-item[data-round-href] {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  grid-template-areas:
    "date main score"
    "chips chips chips";
  column-gap: 12px;
  row-gap: 4px;
  padding: 14px 16px 12px;
  align-items: start;
  position: relative;
}

.browse-list.grid-view .item-date {
  grid-area: date;
  padding: 4px 0;
}
.browse-list.grid-view .item-date .day { font-size: 15px; }
.browse-list.grid-view .item-date .mon { font-size: 8px; margin-top: 2px; }

.browse-list.grid-view .item-main {
  grid-area: main;
  min-width: 0;
}
.browse-list.grid-view .item-name {
  font-size: 15px;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 4px;
  max-width: 100%;
}
.browse-list.grid-view .item-meta {
  font-size: 11px;
  color: var(--ink-muted);
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  line-height: 1.4;
}
/* Hide the <span class="sep"></span> spacers — they rendered as stray line breaks */
.browse-list.grid-view .item-meta .sep { display: none; }
.browse-list.grid-view .item-meta > span:not(.sep):not(:last-child)::after {
  content: "·";
  margin-left: 6px;
  color: var(--ink-muted);
  opacity: 0.5;
}
/* The .item-chips inside .item-main: hide here; we render full-width below */
.browse-list.grid-view .item-main .item-chips { display: none; }

.browse-list.grid-view .item-score {
  grid-area: score;
  text-align: right;
  min-width: auto;
  padding-right: 36px; /* clear the 3-dot menu in the corner */
}
.browse-list.grid-view .item-score .val { font-size: 26px; line-height: 1; }
.browse-list.grid-view .item-score .delta { font-size: 9px; margin-top: 4px; padding: 2px 6px; }

/* Full-width chips row — takes the entire bottom of the card */
.browse-list.grid-view .browse-item::after {
  /* placeholder; chips injected via JS are the real content */
}

/* We can't easily hoist .item-chips out of .item-main with CSS alone,
   so the JS will render a twin copy at card level. See rounds-page.js. */
.browse-list.grid-view .item-chips-grid {
  grid-area: chips;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--hairline);
}
.browse-list.grid-view .item-chips-grid .chip {
  font-size: 10px;
  padding: 3px 8px;
}

/* 3-dot menu: top-right corner */
.browse-list.grid-view .item-menu {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  font-size: 12px;
  margin-left: 0;
  justify-self: auto;
}
