/* =========================================================
   TTB Result — public page
   Clean, professional UI aligned with UCT brand
   ========================================================= */

.ttb-hub {
  --ttb-dark: #002935;
  --ttb-green: #3d8f6b;
  --ttb-green-soft: #e8f3ec;
  --ttb-border: #dce8e0;
  --ttb-muted: #5c6b6f;
  --ttb-bg: #f8fbf9;
  --ttb-radius: 12px;
  --ttb-shadow: 0 2px 16px rgba(0, 41, 53, 0.06);
  margin: 4px 0 56px;
  font-family: 'Jost', sans-serif;
}

.ttb-hub *,
.ttb-hub *::before,
.ttb-hub *::after {
  box-sizing: border-box;
}

/* Year selector */
.ttb-year-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding: 16px 20px;
  background: #fff;
  border: 1px solid var(--ttb-border);
  border-radius: var(--ttb-radius);
  box-shadow: var(--ttb-shadow);
}

.ttb-year-bar > label {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ttb-muted);
  white-space: nowrap;
}

.ttb-year-bar__field {
  flex: 1;
  min-width: 220px;
  max-width: 420px;
}

.ttb-year-bar--nested {
  margin: 28px auto 0;
  max-width: 560px;
  justify-content: center;
  box-shadow: none;
  background: rgba(255, 255, 255, 0.72);
}

.ttb-archive-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  max-width: 720px;
  margin: 8px auto 0;
}

.ttb-archive-choice {
  appearance: none;
  border: 1px solid var(--ttb-border);
  background: #fff;
  border-radius: 12px;
  padding: 18px 16px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, transform 0.15s ease;
  box-shadow: 0 1px 4px rgba(0, 41, 53, 0.04);
}

.ttb-archive-choice:hover {
  border-color: #b7cfc3;
  box-shadow: 0 4px 14px rgba(0, 41, 53, 0.08);
}

.ttb-archive-choice.is-active {
  border-color: var(--ttb-green);
  background: #f3faf6;
  box-shadow: 0 0 0 3px rgba(61, 143, 107, 0.12);
}

.ttb-archive-choice__title {
  display: block;
  font-size: 16px;
  font-weight: 600;
  color: var(--ttb-dark);
  margin-bottom: 4px;
  line-height: 1.3;
}

.ttb-archive-choice__meta {
  display: block;
  font-size: 13px;
  color: var(--ttb-muted);
  line-height: 1.4;
}

@media (max-width: 640px) {
  .ttb-archive-choices {
    grid-template-columns: 1fr;
  }
}

.ttb-year-select {
  display: block;
  width: 100%;
  padding: 12px 40px 12px 14px;
  border: 1px solid var(--ttb-border);
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
  font-weight: 500;
  color: var(--ttb-dark);
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23002935' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 14px center;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.ttb-year-select:hover {
  border-color: #b7cfc3;
}

.ttb-year-select:focus {
  outline: none;
  border-color: var(--ttb-green);
  box-shadow: 0 0 0 3px rgba(61, 143, 107, 0.14);
}

.ttb-hub-panel {
  animation: ttbFadeIn 0.28s ease;
}

.ttb-hub-panel[hidden],
.ttb-archive-panel[hidden] {
  display: none !important;
}

@keyframes ttbFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Main module */
.ttb-result-module {
  margin-bottom: 0;
  border-radius: var(--ttb-radius);
  overflow: hidden;
  border: 1px solid var(--ttb-border);
  box-shadow: var(--ttb-shadow);
  background: #fff;
}

.ttb-search-header {
  background: linear-gradient(180deg, #f8fbf9 0%, #eef5f1 100%);
  color: var(--ttb-dark);
  padding: 42px 28px 34px;
  text-align: center;
  border-bottom: 1px solid var(--ttb-border);
}

.ttb-search-header h3 {
  font-size: 28px;
  font-weight: 600;
  color: var(--ttb-dark) !important;
  margin: 0 0 10px;
  line-height: 1.3;
}

.ttb-search-header .ttb-search-desc {
  font-size: 15px;
  color: var(--ttb-muted);
  margin: 0 auto 26px;
  font-weight: 400;
  max-width: 640px;
  line-height: 1.65;
}

.ttb-search-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
  max-width: 640px;
  margin: 0 auto;
}

.ttb-search-wrap {
  flex: 1;
  position: relative;
  margin: 0;
  max-width: none;
}

.ttb-search-wrap input {
  width: 100%;
  height: 52px;
  padding: 0 48px 0 20px;
  font-size: 15px;
  font-family: inherit;
  border: 1px solid var(--ttb-border);
  border-radius: 50px;
  outline: none;
  box-shadow: 0 2px 8px rgba(0, 41, 53, 0.05);
  color: var(--ttb-dark);
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.ttb-search-wrap input::placeholder {
  color: #95a3a8;
}

.ttb-search-wrap input:focus {
  border-color: var(--ttb-green);
  box-shadow: 0 2px 14px rgba(61, 143, 107, 0.14);
}

.ttb-search-wrap .ttb-search-icon {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ttb-green);
  font-size: 17px;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.ttb-search-wrap.is-filled .ttb-search-icon {
  opacity: 0;
  visibility: hidden;
}

.ttb-search-clear {
  appearance: none;
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #eef2f3;
  color: #5a6a70;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.ttb-search-clear:hover {
  background: #dfe6e8;
  color: var(--ttb-dark);
}

.ttb-search-clear:focus-visible {
  outline: 2px solid var(--ttb-green);
  outline-offset: 2px;
}

.ttb-search-clear[hidden] {
  display: none !important;
}

.ttb-search-btn {
  appearance: none;
  border: 0;
  height: 52px;
  padding: 0 26px;
  border-radius: 50px;
  background: var(--ttb-dark);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  min-width: 118px;
  transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
  box-shadow: 0 2px 10px rgba(0, 41, 53, 0.18);
}

.ttb-search-btn:hover {
  background: #0a3d4a;
}

.ttb-search-btn:active {
  transform: translateY(1px);
}

.ttb-search-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

.ttb-search-hint {
  text-align: center;
  font-size: 13px;
  color: #8a989c;
  margin: 14px 0 0;
}

.ttb-module-loading,
.ttb-module-error {
  padding: 36px 20px;
  text-align: center;
  font-size: 15px;
  color: var(--ttb-muted);
  background: #fff;
}

.ttb-module-error {
  color: #c0392b;
}

.ttb-stats-bar {
  display: flex;
  justify-content: center;
  gap: 28px;
  padding: 22px 20px;
  background: #fff;
  border-bottom: 1px solid var(--ttb-border);
  flex-wrap: wrap;
}

.ttb-stat {
  text-align: center;
  min-width: 88px;
}

.ttb-stat-num {
  font-size: 26px;
  font-weight: 600;
  color: var(--ttb-dark);
  line-height: 1.2;
}

.ttb-stat-num.ttb-stat-pass { color: var(--ttb-green); }
.ttb-stat-num.ttb-stat-absent { color: #c75c5c; }

.ttb-stat-label {
  font-size: 11px;
  color: #8a989c;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  margin-top: 4px;
  font-weight: 500;
}

.ttb-result-body {
  padding: 24px 20px 20px;
  background: #fff;
}

.ttb-idle-msg {
  text-align: center;
  color: var(--ttb-muted);
  font-size: 14px;
  padding: 8px 12px 4px;
  margin: 0;
  line-height: 1.6;
}

.ttb-idle-msg[hidden] {
  display: none !important;
}

.ttb-idle-msg strong {
  color: var(--ttb-dark);
}

/* Result cards */
.ttb-result-card {
  background: #fff;
  border-radius: 14px;
  margin-bottom: 16px;
  overflow: hidden;
  border: 1px solid #e6eee9;
  box-shadow: 0 4px 20px rgba(0, 41, 53, 0.06);
  transition: box-shadow 0.22s ease, transform 0.22s ease;
}

.ttb-result-card:hover {
  box-shadow: 0 10px 32px rgba(0, 41, 53, 0.1);
  transform: translateY(-1px);
}

.ttb-result-card.ttb-absent {
  border-color: #f0d2d0;
}

.ttb-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px;
  background: linear-gradient(180deg, #f7fbf8 0%, #eef5f1 100%);
  border-bottom: 1px solid #e6eee9;
}

.ttb-card-identity {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.ttb-card-avatar {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--ttb-dark);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.ttb-result-card.ttb-absent .ttb-card-avatar {
  background: #a94442;
}

.ttb-card-identity__text {
  min-width: 0;
}

.ttb-card-name {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--ttb-dark);
  line-height: 1.3;
  word-break: break-word;
}

.ttb-card-reg {
  margin: 4px 0 0;
  font-size: 13px;
  color: #6f8086;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  word-break: break-all;
}

.ttb-badge {
  flex-shrink: 0;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ttb-badge-pass {
  background: #e5f4ea;
  color: #1f7a45;
}

.ttb-badge-absent {
  background: #fdecea;
  color: #c0392b;
}

.ttb-card-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  padding: 4px 8px;
}

.ttb-card-field {
  padding: 14px 12px;
  border-bottom: 1px solid #f0f4f2;
}

.ttb-card-field:nth-child(odd) {
  border-right: 1px solid #f0f4f2;
}

.ttb-card-field__label {
  display: block;
  font-size: 11px;
  color: #8a989c;
  text-transform: uppercase;
  letter-spacing: 0.55px;
  margin-bottom: 5px;
  font-weight: 500;
}

.ttb-card-field__value {
  display: block;
  font-size: 14px;
  color: var(--ttb-dark);
  font-weight: 600;
  line-height: 1.45;
  word-break: break-word;
}

.ttb-card-scores {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 16px 16px 18px;
  background: #fbfcfc;
  border-top: 1px solid #eef2f0;
}

.ttb-card-scores--two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ttb-card-scores--absent {
  display: block;
  padding: 16px 20px;
}

.ttb-card-scores--absent p {
  margin: 0;
  font-size: 14px;
  color: #c0392b;
  font-weight: 500;
}

.ttb-score-item {
  text-align: center;
  background: #fff;
  border: 1px solid #e7efe9;
  border-radius: 12px;
  padding: 14px 10px;
}

.ttb-score-item--total {
  background: linear-gradient(180deg, #f3faf6 0%, #e8f4ec 100%);
  border-color: #cfe6d7;
}

.ttb-score-item__label {
  display: block;
  font-size: 11px;
  color: #8a989c;
  text-transform: uppercase;
  letter-spacing: 0.55px;
  font-weight: 500;
  margin-bottom: 6px;
}

.ttb-score-item__value {
  display: block;
  font-size: 26px;
  font-weight: 700;
  color: var(--ttb-green);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.ttb-score-item--total .ttb-score-item__value {
  color: var(--ttb-dark);
}

.ttb-no-result {
  text-align: center;
  padding: 36px 16px;
  color: var(--ttb-muted);
}

.ttb-no-result p {
  margin: 12px 0 6px;
  font-size: 16px;
  color: var(--ttb-dark);
}

.ttb-no-result small {
  font-size: 13px;
  color: #8a989c;
}

.ttb-search-summary {
  font-size: 14px;
  color: var(--ttb-muted);
  margin: 0 0 16px;
}

.ttb-search-summary strong {
  color: var(--ttb-dark);
}

/* Archive / images */
.ttb-archive-header {
  padding-bottom: 28px;
}

.ttb-archive-note {
  margin: 0;
  padding: 16px 20px 0;
  font-size: 14px;
  color: var(--ttb-muted);
  text-align: center;
}

.ttb-archive-gallery {
  padding: 16px 20px 22px;
  display: grid;
  gap: 14px;
}

.ttb-batch-images {
  border-top: 1px solid var(--ttb-border);
  padding: 16px 20px 20px;
  background: #f7faf8;
}

.ttb-batch-images__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.ttb-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}

.ttb-filter-bar select {
  padding: 8px 12px;
  border: 1px solid var(--ttb-border);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  color: var(--ttb-dark);
  background: #fff;
}

.ttb-result-count {
  font-size: 13px;
  color: var(--ttb-muted);
  margin-left: auto;
}

.ttb-section-block {
  margin-bottom: 22px;
}

.ttb-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--ttb-dark);
  color: #fff;
  padding: 12px 16px;
  border-radius: 8px 8px 0 0;
  font-size: 14px;
  font-weight: 600;
}

.ttb-section-count {
  font-size: 12px;
  font-weight: 500;
  opacity: 0.8;
}

.ttb-table-scroll {
  overflow-x: auto;
  border: 1px solid var(--ttb-border);
  border-top: 0;
  border-radius: 0 0 8px 8px;
}

.ttb-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.ttb-data-table th,
.ttb-data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #eef2f4;
  text-align: left;
  vertical-align: middle;
  color: var(--ttb-dark);
}

.ttb-data-table th {
  background: #f5f8f9;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b8791;
  white-space: nowrap;
}

.ttb-pass-badge,
.ttb-absent-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.ttb-pass-badge {
  background: var(--ttb-green-soft);
  color: #2d7a4a;
}

.ttb-absent-badge {
  background: #fdecea;
  color: #c0392b;
}

@media (max-width: 767px) {
  .ttb-year-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .ttb-year-bar__field {
    max-width: none;
  }

  .ttb-search-header {
    padding: 30px 18px 26px;
  }

  .ttb-search-header h3 {
    font-size: 22px;
  }

  .ttb-search-row {
    flex-direction: column;
  }

  .ttb-search-btn {
    width: 100%;
    border-radius: 12px;
  }

  .ttb-search-wrap input {
    border-radius: 12px;
  }

  .ttb-stats-bar {
    gap: 18px;
    padding: 18px 12px;
  }

  .ttb-stat-num {
    font-size: 22px;
  }

  .ttb-card-top {
    flex-wrap: wrap;
  }

  .ttb-card-details {
    grid-template-columns: 1fr;
  }

  .ttb-card-field:nth-child(odd) {
    border-right: 0;
  }

  .ttb-card-scores {
    grid-template-columns: 1fr;
  }

  .ttb-stat-num {
    font-size: 22px;
  }
}
