/* Respondent pages: www/respond, the admin preview and the GCMS survey includelet (lib/answer-form) */

.survey-progress {
  max-width: 320px;
  margin: 0 auto 20px;
}
.survey-progress-text {
  margin-bottom: 5px;
  text-align: center;
}
.survey-progress .progress {
  margin-bottom: 0;
}

.survey-nav {
  margin-top: 10px;
}
.survey-nav .btn {
  margin-right: 8px;
}
/* the hidden first submit button, so Enter means Next */
.survey-nav-default {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* results summary (lib/summary) */
.survey-summary-totals {
  margin-bottom: 20px;
}
.survey-summary-question {
  margin-bottom: 30px;
}
.survey-summary-answered {
  margin: 4px 0 8px;
}
.survey-summary-bars {
  max-width: 700px;
}
.survey-summary-bars .survey-summary-label {
  font-weight: normal;
  width: 35%;
}
.survey-summary-bars .survey-summary-bar {
  width: 45%;
}
.survey-summary-bars .progress {
  margin: 2px 0 0;
}
.survey-summary-bars .survey-summary-count,
.survey-summary-bars .survey-summary-percent {
  text-align: right;
  white-space: nowrap;
}
.survey-summary-grid {
  width: auto;
}
.survey-summary-grid th,
.survey-summary-grid td {
  text-align: center;
}
.survey-summary-grid th[scope=row] {
  text-align: left;
  font-weight: normal;
}
.survey-summary-stats dt {
  font-weight: normal;
  text-align: left;
}

/* rating, NPS and Likert scales (template::widget::survey_scale) */
/* end labels in their own row under the buttons, at its left and right, so they never wrap beside them */
.survey-scale {
  display: inline-flex;
  flex-direction: column;
  max-width: 100%;
  gap: 4px;
}
.survey-scale-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
/* zero width so long labels wrap to the buttons' width rather than widen the scale */
.survey-scale-ends {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  width: 0;
  min-width: 100%;
  color: #666;
  font-size: 0.9em;
}
.survey-scale-ends span:last-child {
  text-align: right;
}
/* only shown when a long scale stacks on a phone; screen readers always get it */
.survey-scale-end-text {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}
.survey-scale-option {
  margin: 0;
  font-weight: normal;
  cursor: pointer;
}
/* the real radio stays in the page for keyboard and screen readers */
.survey-scale-option input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.survey-scale-option > span {
  display: inline-block;
  min-width: 2.6em;
  padding: 6px 10px;
  text-align: center;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  color: #333;
}
.survey-scale-option:hover > span {
  background: #f0f0f0;
}
.survey-scale-option input:focus + span {
  outline: 2px solid #337ab7;
  outline-offset: 2px;
}
/* chosen: dark fill and an inner ring, not just a colour change (and no bolder text,
   which would widen the label and shift the others along) */
.survey-scale-option input:checked + span {
  background: #337ab7;
  border-color: #23527c;
  box-shadow: inset 0 0 0 2px #23527c;
  color: #fff;
}
@media (max-width: 600px) {
  .survey-scale-labels,
  .survey-scale-long {
    display: flex;
  }
  .survey-scale-labels .survey-scale-options,
  .survey-scale-long .survey-scale-options {
    flex-direction: column;
  }
  .survey-scale-labels .survey-scale-option > span,
  .survey-scale-long .survey-scale-option > span {
    width: 100%;
    text-align: left;
  }
  .survey-scale-long .survey-scale-ends {
    display: none;
  }
  .survey-scale-long .survey-scale-end-text {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
    color: inherit;
  }
}

/* Matrix questions (template::widget::survey_matrix): each row becomes a card on a phone */
.survey-matrix td label {
  display: block;
  margin: 0;
  cursor: pointer;
}
@media (max-width: 600px) {
  .survey-matrix thead {
    display: none;
  }
  .survey-matrix,
  .survey-matrix tbody,
  .survey-matrix tr,
  .survey-matrix th,
  .survey-matrix td {
    display: block;
    width: 100%;
  }
  .survey-matrix tr {
    margin-bottom: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
  }
  table.survey-matrix th[scope=row],
  table.survey-matrix td {
    text-align: left;
    border: 0;
  }
  .survey-matrix td label {
    display: inline-block;
  }
  .survey-matrix td label::after {
    content: attr(data-label);
    margin-left: 8px;
  }
}

/* image or video choices (template::widget::survey_media_choice) */
.survey-media-choices {
  display: grid;
  grid-template-columns: repeat(var(--survey-media-cols, 3), minmax(0, 1fr));
  gap: 16px;
}
.survey-media-cols-2 { --survey-media-cols: 2; }
.survey-media-cols-3 { --survey-media-cols: 3; }
.survey-media-cols-4 { --survey-media-cols: 4; }
@media (max-width: 600px) {
  .survey-media-choices { --survey-media-cols: 1; }
}
.survey-media-card {
  border: 2px solid #ddd;
  border-radius: 6px;
  padding: 8px;
  background: #fff;
}
.survey-media-card:has(input:checked) {
  border-color: #337ab7;
  box-shadow: 0 0 0 2px #337ab7;
}
.survey-media {
  display: block;
  margin: 0 0 8px;
  font-weight: normal;
  cursor: pointer;
}
div.survey-media {
  cursor: auto;
}
.survey-media img,
.survey-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.survey-media-choose {
  display: block;
  margin: 0;
  padding: 6px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-weight: normal;
  cursor: pointer;
}
.survey-media-choose:has(input:checked) {
  background: #337ab7;
  border-color: #23527c;
  box-shadow: inset 0 0 0 2px #23527c;
  color: #fff;
}
.survey-media-choose input:focus {
  outline: 2px solid #337ab7;
  outline-offset: 2px;
}

/* thumbnails beside summary bars */
.survey-summary-label img,
.survey-summary-label video {
  width: 60px;
  height: 40px;
  object-fit: cover;
  margin-right: 6px;
  vertical-align: middle;
}

/* ranking questions (template::widget::survey_ranking, survey.js) */
.survey-ranking {
  padding-left: 0;
  list-style: none;
  max-width: 520px;
}
.survey-ranking-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  margin-bottom: 6px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #fff;
}
.survey-ranking-label {
  flex: 1;
  margin: 0;
  font-weight: normal;
}
.survey-ranking .survey-ranking-rank {
  width: auto;
}
.survey-ranking-badge {
  display: none;
  min-width: 2em;
  padding: 2px 6px;
  border-radius: 10px;
  background: #eee;
  text-align: center;
  font-weight: bold;
}
/* with JavaScript the order is the answer: badges show it, the selects go */
.survey-ranking-js .survey-ranking-badge {
  display: inline-block;
}
.survey-ranking-js .survey-ranking-rank {
  display: none;
}
.survey-ranking-js .survey-ranking-item {
  cursor: move;
}
.survey-ranking-tools {
  white-space: nowrap;
}
.survey-ranking-dragging {
  opacity: 0.5;
}
