/*
 * Base styles for survey pages.  Instances add their own stylesheet on top of this one.
 * Everything here works back to IE11, iOS 9 and Android 4.4; the narrow-screen layout is
 * in the media query at the end.
 */

div.usermsg {
  max-width: 500px;
  margin: 1em auto;
  padding: 10px 6px;
  border: 3px solid #933;
  background: #CCC;
  color: #900;
  font-size: 12pt;
  font-weight: bold;
}
.field_error {
  border: 3px solid #F00;
}

/* Questions */
.internal_label {
  font-family: Courier, "Courier New", monospace;
  color: #84B2FF;
}
.response_prompt {
  font-style: italic;
  font-size: 90%;
}
.after_response_prompt {
  font-style: italic;
  font-size: 90%;
}
.postscript {
  font-size: 90%;
}
div.errortext {
  font-style: italic;
  color: #F00;
}
.question input[type=text],
.question select,
.question textarea {
  max-width: 100%;
  box-sizing: border-box;
}
p.supplemental {
  display: none;
  font-style: italic;
  margin: 0 0 0 30px !important;
}
div.inactivity_message {
  display: none;
  width: 100%;
  padding: 5px;
  color: red;
  font-size: 150%;
  font-style: italic;
  text-align: center;
}
.side_by_side_text {
  float: left;
  max-width: 60%;
}
.side_by_side_responses {
  float: right;
}
.side_by_side_clear {
  clear: both;
  height: 1px;
}

/* Tables of responses */
table.matrix {
  border: 3px solid white;
  border-collapse: collapse;
}
table.matrix th, table.matrix td {
  padding: 2px 7px;
  border: 1px solid #999;
  text-align: left;
}
table.columns {
  border: 3px solid white;
  border-collapse: collapse;
  empty-cells: show;
}
table.columns > th, table.columns > td {
  padding: 2px 10px;
  border-left: 1px solid #999;
  text-align: left;
}
table.columnated {
  empty-cells: show;
}
table.columnated td {
  padding: 0px 10px;
}
.centered {
  text-align: center !important;
}
label.table_choice {
  display: block;
  cursor: pointer;
}
/* a cell's column heading, and a column's heading in a list; shown only when stacked */
.table_caption,
.column_caption {
  display: none;
}
.column_caption {
  font-weight: bold;
}
input.qty-table-input {
  width: 50px !important;
  margin-right: 1em !important;
}

/* Rating scales: radio buttons drawn as a row of buttons */
.rating-scale {
  display: inline-block;
  white-space: nowrap;
}
.rating-option {
  display: inline-block;
  position: relative;
  vertical-align: top;
  min-width: 3em;
  margin: 1px;
  text-align: center;
  cursor: pointer;
}
.rating-option input {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
}
.rating-number {
  display: block;
  padding: 0.4em 0.6em;
  border: 1px solid #E3E3E3;
  background: #FFF;
  color: #646464;
}
.rating-option:hover .rating-number {
  background: #EEE;
  color: #333;
}
.rating-option input:checked + .rating-number {
  border-color: #296EF6;
  background: #296EF6;
  color: #FFF;
}
.rating-option input:focus + .rating-number {
  outline: 2px solid #84B2FF;
}
.rating-text {
  display: block;
  font-size: 10px;
  white-space: normal;
}
.rating-option-zero {
  margin-left: 2em;
}
.single-rating-scale-wide .rating-option {
  min-width: 6em;
}
.rating-scale-labels .rating-option {
  cursor: default;
}
/* in a multi-rating table, the labels head the table instead of repeating in every row */
table.multi-rating .rating-scale .rating-text {
  display: none;
}
table.multi-rating .rating-scale-labels .rating-text {
  display: block;
}
table.multi-rating td.response_label {
  padding-right: 10px;
}
table.multi-rating tr.prior_text_table td {
  padding-top: 20px;
}

/* Navigation buttons (survey-engine.js shows the Next button when the page allows it).
   Moving on (Next, Begin, Submit, Resume) is a solid button, going back is an outlined one,
   and saving for later is a quieter text button.  The engine's own buttons put Previous and
   Next at either end of a row, with Save underneath. */
.nav_buttons {
  max-width: 700px;
  margin: 2em auto;
  text-align: center;
}
.nav_row_main {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.nav_row + .nav_row {
  margin-top: 0.5em;
}
.nav_buttons input {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  margin: 0 6px 8px 6px;
  padding: 10px 24px;
  border: 1px solid #296EF6;
  border-radius: 6px;
  background: #FFF;
  color: #296EF6;
  font-family: inherit;
  font-size: 15px;
  font-weight: bold;
  line-height: 1.2;
  cursor: pointer;
  -webkit-transition: background-color 0.15s, border-color 0.15s, box-shadow 0.15s;
  transition: background-color 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.nav_row_main input {
  margin-left: 0;
  margin-right: 0;
}
.nav_buttons input:hover {
  background: #EEF4FF;
}
.nav_buttons input:active {
  background: #DCE8FF;
}
/* the transparent outline still shows in Windows high-contrast mode, which drops box-shadows */
.nav_buttons input:focus {
  outline: 2px solid transparent;
  box-shadow: 0 0 0 3px #84B2FF;
}
.nav_buttons input[name=next],
.nav_buttons input[name=launch],
.nav_buttons input[name=finish],
.nav_buttons input[name=start],
.nav_buttons input[name=submit] {
  background: #296EF6;
  color: #FFF;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
.nav_buttons input[name=next]:hover,
.nav_buttons input[name=launch]:hover,
.nav_buttons input[name=finish]:hover,
.nav_buttons input[name=start]:hover,
.nav_buttons input[name=submit]:hover {
  border-color: #1F5BD6;
  background: #1F5BD6;
}
.nav_buttons input[name=next]:active,
.nav_buttons input[name=launch]:active,
.nav_buttons input[name=finish]:active,
.nav_buttons input[name=start]:active,
.nav_buttons input[name=submit]:active {
  border-color: #1A4EB8;
  background: #1A4EB8;
  box-shadow: none;
}
.nav_buttons input[name=next]:focus,
.nav_buttons input[name=launch]:focus,
.nav_buttons input[name=finish]:focus,
.nav_buttons input[name=start]:focus,
.nav_buttons input[name=submit]:focus {
  box-shadow: 0 0 0 3px #84B2FF;
}
.nav_buttons input[name=save] {
  border-color: transparent;
  background: transparent;
  color: #555;
  font-weight: normal;
  text-decoration: underline;
}
.nav_buttons input[name=save]:hover {
  background: transparent;
  color: #296EF6;
}
.nav_buttons input[name=save]:active {
  background: #EEE;
}
.btn_hidden {
  display: none;
}

/* Progress bar made of page segments */
div.progress table {
  empty-cells: show;
  width: 100%;
}
div.progress tr {
  height: 20px;
}
div.progress th {
  height: 20px;
}
div.progress th.divider {
  background: url(/common/images/statusbar-divider.gif);
  width: 4px !important;
  height: 20px;
}
div.progress th.past {
  background: url(/common/images/statusbar-past.gif) repeat-x;
}
div.progress th.present {
  background: url(/common/images/statusbar-present.gif) repeat-x;
}
div.progress th.incomplete {
  background: url(/common/images/statusbar-present.gif) repeat-x;
}
div.progress th.future {
  background: url(/common/images/statusbar-future.gif) repeat-x;
}
th.progress_link {
  cursor: default;
}
th.progress_link:hover {
  cursor: pointer;
}

/* Percentage progress bar (survey-engine.js adds and sizes the fill) */
div.progressbar_container {
  display: inline-block;
  width: 700px;
  max-width: 100%;
  border: 1px solid #ddd;
  border-radius: 5px;
  overflow: hidden;
  padding: 0;
  margin: 0;
}
div.progressbar_fill {
  height: 25px;
  line-height: 25px;
  width: 0;
  text-align: right;
  color: #fff;
  white-space: nowrap;
  border-radius: 3px;
  background-color: #296EF6;
}

/* Narrow screens: tables stack into one column, and each input shows its column heading */
@media screen and (max-width: 600px) {
  input, select, textarea {
    font-size: 16px;            /* keeps iOS from zooming in on focus */
  }
  .side_by_side_text,
  .side_by_side_responses {
    float: none;
    max-width: none;
  }
  table.stackable,
  table.stackable > tbody,
  table.stackable > tbody > tr,
  table.stackable > tbody > tr > td,
  table.stackable > tbody > tr > th {
    display: block;
    width: auto !important;
  }
  table.stackable {
    border: none;
  }
  table.stackable > tbody > tr {
    margin-bottom: 0.75em;
  }
  table.stackable > tbody > tr > td {
    border: none;
    padding: 2px 0;
    text-align: left !important;
  }
  table.stackable > tbody > tr.table_header_row > th,
  table.multi-rating tr.table_header_row {
    display: none;
  }
  table.stackable td.response_table_cell,
  table.stackable td.response_label {
    font-weight: bold;
  }
  table.stackable .table_caption {
    display: inline;
    font-weight: normal;
  }
  table.stackable label.table_choice {
    padding: 0.4em 0 0.4em 1em;
  }
  table.stackable .column_caption {
    display: block;
  }
  .rating-scale {
    white-space: normal;
  }
  table.multi-rating .rating-scale .rating-text {
    display: block;
  }
  .question li label {
    display: inline-block;
    padding: 0.3em 0;
  }
  .nav_buttons input {
    min-height: 44px;
    padding: 10px 14px;
  }
  /* Previous and Next share the row equally, so both are easy to reach with a thumb */
  .nav_row_main input {
    flex: 1 1 0%;
    max-width: 50%;
    margin: 0 4px 8px 4px;
  }
}
