/* 260425 researcher-style workspace: projects table + Edit/Result + task tabs */

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.panel-head h2 {
  margin: 0;
}

/* Match 260425 researcher: section title sits in panel-head without extra bottom margin */
.page.researcher-page .panel--su-projects .panel-head h2 {
  margin: 0;
}

.page.researcher-page .panel--su-projects #status {
  margin: 8px 0 10px;
}

/* PostgREST schema cache missing project_country — warn admin (see superuserApi probe). */
.su-catalog-country-banner {
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #7a3a3a;
  background: #3a2222;
  color: #ffd4cf;
  font-size: 13px;
  line-height: 1.45;
}

.su-catalog-country-banner code {
  font-size: 12px;
}

.su-catalog-country-banner a {
  color: #8ec5ff;
  font-weight: 600;
}

/* Projects list: name + country filters (admin-only; public form still uses combined label in task.html). */
.su-project-filters {
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #3d3d3d;
  background: var(--surface-2, #2a2a2a);
}

.su-project-filters__row {
  display: grid;
  grid-template-columns: 1fr minmax(10rem, 14rem);
  gap: 12px;
  align-items: end;
}

@media (max-width: 640px) {
  .su-project-filters__row {
    grid-template-columns: 1fr;
  }
}

.su-project-filters__field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.su-project-filters__label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted, #a3a3a3);
}

.su-project-filters__field input,
.su-project-filters__field select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.panel-head-actions {
  flex-shrink: 0;
}

.panel--workspace {
  margin-bottom: 0;
}

/* Match 260425 Studies scroll + sticky action column (subset: one sticky “Duplicate” on the right). */
.panel--su-projects .studies-table-scroll {
  --su-sticky-duplicate: 7.75rem;
  --su-sticky-selected-bg: #2c3848;
  max-width: 100%;
  min-width: 0;
  max-height: min(276px, 55vh);
  overflow-x: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 10px;
  border: 1px solid #3d3d3d;
}

/* Fewer columns than full Studies table — avoid forcing 46rem min-width from `.table--studies` alone. */
.page.researcher-page .panel--su-projects .table.table--studies.table--su-projects {
  table-layout: auto;
  width: 100%;
  min-width: 28rem;
}

.page.researcher-page .panel--su-projects .table.table--studies.table--su-projects thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
  box-shadow: 0 1px 0 #4d4d4d;
}

.page.researcher-page .panel--su-projects .table.table--studies.table--su-projects tbody tr.su-project-row {
  cursor: pointer;
}

.page.researcher-page .panel--su-projects .table.table--studies.table--su-projects tbody tr.su-project-row--selected,
.page.researcher-page .panel--su-projects .table.table--studies.table--su-projects tbody tr.studies-row--selected {
  background: rgba(22, 119, 255, 0.12);
}

.page.researcher-page .panel--su-projects .table.table--studies.table--su-projects tbody tr.su-project-row--selected td,
.page.researcher-page .panel--su-projects .table.table--studies.table--su-projects tbody tr.studies-row--selected td {
  border-bottom-color: #3d5a80;
}

.page.researcher-page .panel--su-projects .table.table--studies.table--su-projects th,
.page.researcher-page .panel--su-projects .table.table--studies.table--su-projects td {
  border-bottom: 1px solid #4d4d4d;
  padding: 10px 8px;
  text-align: left;
  vertical-align: middle;
}

.page.researcher-page .panel--su-projects .table.table--studies.table--su-projects th {
  color: var(--muted, #a3a3a3);
  font-weight: 600;
}

.page.researcher-page .panel--su-projects .table.table--studies.table--su-projects td {
  color: var(--fg, #f2f2f2);
}

.page.researcher-page .panel--su-projects .table.table--studies.table--su-projects th.su-col-duplicate,
.page.researcher-page .panel--su-projects .table.table--studies.table--su-projects td.su-duplicate-cell {
  position: sticky;
  right: 0;
  z-index: 3;
  width: var(--su-sticky-duplicate);
  min-width: var(--su-sticky-duplicate);
  max-width: var(--su-sticky-duplicate);
  box-sizing: border-box;
  text-align: left;
  vertical-align: middle;
  background-color: var(--surface, #2f2f2f);
  box-shadow: -8px 0 14px -8px rgba(0, 0, 0, 0.42);
}

.page.researcher-page .panel--su-projects .table.table--studies.table--su-projects thead th.su-col-duplicate {
  z-index: 4;
}

.page.researcher-page
  .panel--su-projects
  .table.table--studies.table--su-projects
  tbody
  tr.su-project-row--selected
  td.su-duplicate-cell,
.page.researcher-page
  .panel--su-projects
  .table.table--studies.table--su-projects
  tbody
  tr.studies-row--selected
  td.su-duplicate-cell {
  background-color: var(--su-sticky-selected-bg);
}

.page.researcher-page .panel--su-projects .table.table--studies.table--su-projects td.su-duplicate-cell {
  cursor: default;
}

.page.researcher-page .panel--su-projects .table.table--studies.table--su-projects .su-project-dup-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  position: relative;
  z-index: 1;
  pointer-events: auto;
}

.page.researcher-page .panel--su-projects .table.table--studies.table--su-projects .su-dup-btn {
  flex: 0 0 auto;
  box-sizing: border-box;
  width: 100%;
  max-width: 6.75rem;
  min-width: 5.5rem;
  padding: 5px 6px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  white-space: nowrap;
}

.su-col-numeric {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.workspace-tabs-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 8px 12px;
  margin: 0 0 12px;
  border-bottom: 1px solid #4a4a4a;
}

.workspace-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
}

.workspace-tab {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  padding: 10px 16px;
  margin-bottom: -1px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  border-radius: 8px 8px 0 0;
}

.workspace-tab:hover:not(:disabled) {
  color: var(--fg);
}

.workspace-tab--active {
  color: var(--fg);
  border-bottom-color: var(--primary);
}

.workspace-panel-title {
  margin: 0 0 12px;
  font-size: clamp(16px, 2.5vw, 20px);
}

.su-create-project {
  margin-top: 4px;
}

.workspace-panel {
  min-height: 0;
}

.workspace-empty {
  margin: 8px 0 4px;
  padding: 20px 12px;
  border-radius: 10px;
  border: 1px dashed #4a4a4a;
  color: var(--muted);
  text-align: center;
}

.workspace-empty p {
  margin: 0;
}

.su-project-workspace {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.su-project-head-fields,
.su-create-project-head-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: start;
}

@media (max-width: 640px) {
  .su-project-head-fields,
  .su-create-project-head-fields {
    grid-template-columns: 1fr;
  }
}

/* Task tabs: same underline pattern as Edit / Result workspace tabs */
.su-task-tabs-row {
  margin: 0;
}

.su-task-tabs-row .workspace-tabs {
  flex-wrap: wrap;
  align-items: flex-end;
}

.workspace-tab--add {
  min-width: 44px;
  padding: 10px 12px;
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  color: var(--muted);
}

.workspace-tab--add:hover {
  color: var(--fg);
}

.workspace-tab--draft {
  color: var(--muted);
}

.workspace-tab--draft::after {
  content: " · draft";
  font-weight: 500;
  font-size: 11px;
  color: var(--muted);
}

.study-editor-section {
  border: 1px solid #3d3d3d;
  border-radius: 12px;
  padding: 14px 14px 12px;
  background: var(--surface-2, #2a2a2a);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.su-task-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.su-task-footer__right {
  margin-left: auto;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.panel-inset {
  background: #2a2a2a;
  border-radius: 10px;
  padding: 12px;
  border: 1px solid #3d3d3d;
  margin-bottom: 12px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Result tab: align with 260425 researcher “By respondent / By scene” pattern */
.workspace-panel--result {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

.result-subtabs-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px 12px;
  margin: 0 0 4px;
  border-bottom: 1px solid #4a4a4a;
}

.result-subtabs-row .result-subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin: 0;
  border-bottom: none;
}

.result-subtabs__actions {
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  flex: 0 0 auto;
  margin: 0 2px 6px 8px;
  align-self: flex-end;
}

.result-subtab {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted, #9a9a9a);
  font: inherit;
  font-weight: 600;
  padding: 8px 14px 10px;
  margin-bottom: -1px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  border-radius: 8px 8px 0 0;
}

.result-subtab:hover:not(:disabled) {
  color: var(--fg, #f2f2f2);
}

.result-subtab--active {
  color: var(--fg, #f2f2f2);
  border-bottom-color: var(--primary, #1677ff);
}

.result-subtabs__export-link {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--primary, #1677ff);
  font: inherit;
  font-weight: 600;
  font-size: 13px;
  padding: 6px 4px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.result-subtabs__export-link:hover {
  color: #4096ff;
}

.result-subpanel {
  min-height: 0;
}

.result-subpanel[hidden] {
  display: none !important;
}

.su-result-footnote {
  margin: 0 0 6px;
}

.studies-table-scroll--result {
  max-height: min(560px, 72vh);
}

.table.su-result-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table.su-result-table th,
.table.su-result-table td {
  border-bottom: 1px solid #444;
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}

.table.su-result-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface, #2f2f2f);
  box-shadow: 0 1px 0 #4d4d4d;
  color: var(--muted, #a3a3a3);
  font-weight: 600;
}

.table.su-result-table td {
  color: var(--fg, #f2f2f2);
}

/* Intro images: 16:9 strip + gray “+” upload tile (admin create / edit only) */
.intro-media-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-start;
}

.intro-media-row > .intro-thumb-row {
  display: contents;
}

.su-project-workspace .intro-thumb,
.su-create-project .intro-thumb {
  width: 168px;
  max-width: min(42vw, 220px);
  aspect-ratio: 16 / 9;
  height: auto;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid #4a4a4a;
  background: #1e1e1e;
}

.intro-upload-add {
  position: relative;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 168px;
  max-width: min(42vw, 220px);
  aspect-ratio: 16 / 9;
  flex-shrink: 0;
  border-radius: 10px;
  border: 1px dashed #4a4a4a;
  background: #333;
  cursor: pointer;
}

.intro-upload-add:hover {
  border-color: #6b6b6b;
  background: #3a3a3a;
}

.intro-upload-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  font-size: 0;
}

.intro-upload-face {
  font-size: 2rem;
  font-weight: 300;
  line-height: 1;
  color: var(--muted, #a3a3a3);
  pointer-events: none;
  user-select: none;
}
