/* ===== Test page (test.html) styles ===== */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Test search ---------- */
.test-search {
  margin-top: 6px;
  padding: 25px 16px 16px;
  background: #eee;
}

.test-search__form {
  max-width: 947px;
  margin: 0 auto;
}

.test-search__bar {
  display: flex;
}

.test-search__input {
  flex: 1;
  min-width: 0;
  height: 34px;
  padding: 0 12px;
  border: 1px solid #333;
  border-right: 0;
  background: #fff;
  font-family: inherit;
  font-size: 14px;
  color: #333;
  text-align: center;
  outline: none;
  transition: box-shadow 0.2s;
}

.test-search__input::placeholder {
  color: #9e9e9e;
}

.test-search__input:focus {
  box-shadow: inset 0 0 0 1px #00a2e8;
  border-color: #00a2e8;
}

.test-search__input:focus::placeholder {
  color: transparent;
}

.test-search__input.is-invalid {
  border-color: #e53935;
  box-shadow: inset 0 0 0 1px #e53935;
}

.test-search__btn {
  flex: 0 0 271px;
  height: 34px;
  border: 0;
  background: #000;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  transition: background 0.2s;
}

.test-search__btn:hover,
.test-search__btn:focus-visible {
  background: #00a2e8;
}

/* Radio filters */
.test-search__filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 0;
  padding: 8px 0 0 100px;
  border: 0;
}

.radio {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
}

.radio input {
  width: 13px;
  height: 13px;
  margin: 0;
  accent-color: #1a73e8;
  cursor: pointer;
}

.radio span {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  color: #333;
  transition: color 0.2s;
}

.radio:hover span,
.radio input:checked + span {
  color: #00a2e8;
}

.test-search__error {
  margin: 6px 0 0;
  font-size: 13px;
  color: #e53935;
  text-align: center;
}

.test-search__error:empty {
  display: none;
}

/* ---------- Test list ---------- */
.test-list-section {
  padding: 26px 16px 40px;
  background: #fff;
}

.test-list-wrap {
  max-width: 947px;
  margin: 0 auto;
}

/* Sort by */
.sort-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 14px;
  font-size: 12px;
}

.sort-bar__label {
  margin-right: 8px;
  color: #00a2e8;
}

.sort-bar__btn {
  padding: 0 12px;
  border: 0;
  border-left: 1px solid #00a2e8;
  background: none;
  font-family: inherit;
  font-size: 12px;
  line-height: 1.1;
  color: #333;
  cursor: pointer;
}

.sort-bar__label + .sort-bar__btn {
  border-left: 0;
  padding-left: 4px;
}

.sort-bar__btn:hover {
  color: #00a2e8;
}

.sort-bar__btn.is-active {
  color: #00a2e8;
  font-weight: 700;
}

/* List */
.test-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.test-row {
  margin-bottom: 8px;
  border: 1px solid #ccc;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.test-row:hover {
  border-color: #00a2e8;
  box-shadow: 0 2px 8px rgba(0, 162, 232, 0.15);
}

.test-row.is-open {
  border-color: #00a2e8;
}

/* Row header */
.test-row__head {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 110px 210px 130px;
  align-items: center;
  gap: 10px;
  padding: 10px 8px 10px 6px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.test-row.is-open .test-row__head {
  background: #00a2e8;
  color: #fff;
}

.test-row__toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
}

.test-row__toggle svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: #555;
  transition: transform 0.25s;
}

.test-row.is-open .test-row__toggle svg {
  color: #fff;
  transform: rotate(90deg);
}

.test-row__title {
  display: block;
  overflow: hidden;
  font-size: 15px;
  color: #333;
  text-decoration: none;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.test-row__title:hover {
  text-decoration: underline;
}

.test-row.is-open .test-row__title {
  font-weight: 600;
  color: #fff;
}

.test-row__posted {
  margin: 2px 0 0;
  font-size: 11px;
  color: #333;
}

.test-row__posted a {
  color: inherit;
}

.test-row.is-open .test-row__posted {
  font-weight: 600;
  color: #fff;
}

/* Stars */
.stars {
  display: flex;
  gap: 1px;
}

.stars svg {
  width: 18px;
  height: 18px;
  stroke-width: 1;
  stroke-linejoin: round;
}

.stars .is-empty {
  fill: none;
  stroke: #888;
}

.stars .is-full {
  stroke: #f7931e;
}

.stars .is-full {
  fill: #f7931e;
}

.test-row.is-open .stars svg {
  stroke: #fff;
}

.test-row.is-open .stars .is-empty {
  fill: none;
}

.test-row.is-open .stars .is-full {
  fill: #fff;
}

/* Question / attempt counts */
.test-row__stats {
  display: grid;
  grid-template-columns: auto 20px 1fr;
  margin: 0;
  font-size: 11px;
  line-height: 1.5;
}

.test-row__stats dt,
.test-row__stats dd {
  margin: 0;
}

.test-row__stats dd::before {
  content: ":";
  display: inline-block;
  width: 20px;
  margin-left: -20px;
  text-align: center;
}

.test-row__stats dd {
  grid-column: 3;
  padding-left: 0;
}

.test-row.is-open .test-row__stats {
  font-weight: 600;
}

/* Action button */
.test-row__action {
  display: block;
  padding: 6px 8px;
  background: #00a2e8;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  text-align: center;
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
}

.test-row__action:hover {
  background: #0088c4;
}

.test-row.is-open .test-row__action {
  background: #fff;
  color: #00a2e8;
}

.test-row.is-open .test-row__action:hover {
  background: #e6f6fd;
}

/* Row details (smooth open/close) */
.test-row__body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.35s ease;
}

.test-row.is-open .test-row__body {
  grid-template-rows: 1fr;
}

.test-row__body-inner {
  overflow: hidden;
}

.test-details {
  display: grid;
  grid-template-columns: repeat(3, auto);
  justify-content: start;
  gap: 4px 40px;
  margin: 0;
  padding: 16px 34px;
  border-bottom: 1px solid #ccc;
  font-size: 12px;
  color: #333;
}

.test-details div {
  display: grid;
  grid-template-columns: 118px 20px auto;
}

.test-details dt,
.test-details dd {
  margin: 0;
}

.test-details dd::before {
  content: ":";
  display: inline-block;
  width: 20px;
  margin-left: -20px;
  text-align: center;
}

.test-details dd {
  grid-column: 3;
}

.test-details a {
  color: inherit;
}

.test-info {
  margin: 0;
  padding: 12px 34px 6px;
  border-bottom: 1px solid #ccc;
  font-size: 12px;
}

.test-info div {
  display: grid;
  grid-template-columns: 150px 20px 1fr;
  margin-bottom: 8px;
}

.test-info dt,
.test-info dd {
  margin: 0;
}

.test-info dt {
  color: #333;
}

.test-info dd {
  grid-column: 3;
  color: #555;
}

.test-info dd::before {
  content: ":";
  display: inline-block;
  width: 20px;
  margin-left: -20px;
  text-align: center;
  color: #333;
}

.test-info div:last-child dd {
  color: #999;
}

.test-row__foot {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  position: relative;
  padding: 8px 12px 10px;
}

.start-btn {
  padding: 8px 26px;
  background: #00a2e8;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  text-decoration: none;
  text-transform: uppercase;
  transition: background 0.2s;
}

.start-btn:hover {
  background: #0088c4;
}

.share {
  position: absolute;
  right: 4px;
  bottom: 6px;
  text-align: right;
}

.share p {
  margin: 0 0 2px;
  font-size: 11px;
  color: #555;
}

.share__links {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.share__links a {
  display: flex;
  color: #999;
  transition: color 0.2s;
}

.share__links a:hover {
  color: #00a2e8;
}

.share__links svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* Pagination */
.pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: 22px;
}

.pagination button,
.pagination span {
  min-width: 27px;
  height: 30px;
  padding: 0 6px;
  border: 1px solid #ccc;
  background: #fff;
  font-family: inherit;
  font-size: 14px;
  color: #333;
}

.pagination span {
  display: flex;
  align-items: center;
  justify-content: center;
}

.pagination button {
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.pagination button:hover {
  border-color: #00a2e8;
  color: #00a2e8;
}

.pagination button[aria-current="page"] {
  border-color: #00a2e8;
  background: #00a2e8;
  color: #fff;
}

.test-list__empty {
  padding: 30px;
  border: 1px solid #ccc;
  text-align: center;
  color: #666;
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .test-row__head {
    grid-template-columns: 28px minmax(0, 1fr) auto;
    grid-template-areas:
      "toggle title title"
      ".      stars stats"
      ".      action action";
    row-gap: 8px;
  }

  .test-row__toggle { grid-area: toggle; }
  .test-row__main   { grid-area: title; }
  .stars            { grid-area: stars; }
  .test-row__stats  { grid-area: stats; }
  .test-row__action { grid-area: action; justify-self: start; padding-inline: 18px; }

  .test-details {
    grid-template-columns: repeat(2, auto);
    padding-inline: 16px;
  }

  .test-info {
    padding-inline: 16px;
  }

  .test-row__foot {
    flex-direction: column;
    align-items: center;
    gap: 10px;
  }

  .share {
    position: static;
    text-align: center;
  }

  .share__links {
    justify-content: center;
  }
}

@media (max-width: 700px) {
  .test-search__filters {
    justify-content: center;
    padding-left: 0;
  }
}

@media (max-width: 480px) {
  .test-search__bar {
    flex-direction: column;
    gap: 8px;
  }

  .test-search__input {
    flex: none;
    height: 40px;
    border-right: 1px solid #333;
  }

  .test-search__btn {
    flex: none;
    height: 40px;
  }

  .radio {
    gap: 6px;
  }

  .test-details,
  .test-info div {
    grid-template-columns: 1fr;
  }

  .test-info div {
    grid-template-columns: 110px 20px 1fr;
  }
}
