/* ============ TWCC - Fomu ya Tathmini ya Wakurugenzi wa Bodi ============ */
/* Rangi za Chapa: Kijani, Bluu, Dhahabu (kutoka logo ya TWCC)              */

:root {
  --twcc-green: #2e9e3f;
  --twcc-green-dark: #1f7a2d;
  --twcc-blue: #1878b4;
  --twcc-blue-dark: #125d8c;
  --twcc-gold: #d99a2b;
  --twcc-bg: #f4f8f6;
  --twcc-text: #2a2f2b;
  --twcc-border: #e0e5e2;
  --twcc-white: #ffffff;
  --radius: 12px;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 6px 24px rgba(0, 0, 0, 0.10);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--twcc-bg);
  color: var(--twcc-text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------------- HEADER ---------------- */
.site-header {
  background: var(--twcc-white);
  border-bottom: 4px solid var(--twcc-green);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-inner {
  max-width: 1000px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo {
  width: 56px;
  height: 56px;
  object-fit: contain;
  flex-shrink: 0;
}

.brand-text { min-width: 0; }

.brand-green {
  color: var(--twcc-green-dark);
  font-size: 15px;
  font-weight: 800;
  margin: 0;
  letter-spacing: 0.3px;
  line-height: 1.25;
}

.brand-blue {
  color: var(--twcc-blue);
  font-size: 12.5px;
  font-weight: 600;
  margin: 2px 0 0;
  letter-spacing: 0.2px;
}

/* ---------------- MAIN / LAYOUT ---------------- */
.site-main {
  flex: 1;
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
  padding: 18px 14px 40px;
}

.card {
  background: var(--twcc-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 22px 18px;
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-title {
  color: var(--twcc-green-dark);
  font-size: 18px;
  font-weight: 800;
  margin: 0 0 14px;
  line-height: 1.35;
  border-bottom: 2px solid var(--twcc-border);
  padding-bottom: 10px;
}

.sub-title {
  color: var(--twcc-blue);
  font-size: 15px;
  font-weight: 700;
  margin: 18px 0 8px;
}

p { margin: 0 0 10px; font-size: 14.5px; }

.intro-list { margin: 6px 0 14px; padding-left: 20px; }
.intro-list li { margin-bottom: 6px; font-size: 14.5px; }

.notice {
  background: #fff8e6;
  border-left: 4px solid var(--twcc-gold);
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13.5px;
  color: #6b5215;
}

/* ---------------- SCALE LEGEND ---------------- */
.scale-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 20px;
}

.scale-legend.small .scale-pill { font-size: 11.5px; padding: 5px 9px; }

.scale-pill {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}

.scale-5 { background: var(--twcc-green-dark); }
.scale-4 { background: var(--twcc-green); }
.scale-3 { background: var(--twcc-gold); }
.scale-2 { background: #e08a3c; }
.scale-1 { background: #d1483f; }

/* ---------------- BUTTONS ---------------- */
.btn {
  display: inline-block;
  border: none;
  border-radius: 30px;
  padding: 13px 28px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--twcc-green), var(--twcc-green-dark));
  color: #fff;
  box-shadow: 0 4px 14px rgba(46, 158, 63, 0.35);
}

.btn-secondary {
  background: #eef1ef;
  color: #555;
}

.btn-submit {
  background: linear-gradient(135deg, var(--twcc-blue), var(--twcc-blue-dark));
  color: #fff;
  box-shadow: 0 4px 14px rgba(24, 120, 180, 0.35);
}

.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.continue-wrap { text-align: center; margin-top: 22px; }
.btn-continue { min-width: 220px; }

/* ---------------- INTRO PAGE ---------------- */
.intro-card p, .intro-card li { font-size: 14.5px; }

/* ---------------- PROGRESS BAR ---------------- */
.progress-wrap { margin-bottom: 18px; }

.progress-bar {
  height: 8px;
  background: var(--twcc-border);
  border-radius: 10px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 11%;
  background: linear-gradient(90deg, var(--twcc-green), var(--twcc-blue));
  border-radius: 10px;
  transition: width 0.3s ease;
}

.progress-text {
  text-align: right;
  font-size: 12px;
  color: #888;
  margin: 6px 0 0;
  font-weight: 600;
}

/* ---------------- FORM STEPS ---------------- */
.step-panel { display: none; }
.step-panel.active { display: block; animation: fadeIn 0.25s ease; }

.field-row { margin-bottom: 18px; }

.field-row label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 6px;
  color: #333;
}

.optional-tag { color: #999; font-weight: 500; font-size: 13px; }

input[type="text"],
textarea,
.text-input {
  width: 100%;
  border: 1.5px solid var(--twcc-border);
  border-radius: 8px;
  padding: 11px 12px;
  font-size: 14.5px;
  font-family: inherit;
  background: #fbfdfc;
  color: var(--twcc-text);
  resize: vertical;
}

input[type="text"]:focus,
textarea:focus {
  outline: none;
  border-color: var(--twcc-green);
  box-shadow: 0 0 0 3px rgba(46, 158, 63, 0.12);
}

/* ---------------- RATING TABLE ---------------- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.rating-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.rating-table thead th {
  text-align: center;
  color: var(--twcc-blue);
  font-size: 12px;
  padding-bottom: 8px;
  font-weight: 700;
}

.rating-table thead th.kigezo-col { text-align: left; }

.rating-table td {
  padding: 12px 6px;
  border-bottom: 1px solid var(--twcc-border);
  vertical-align: middle;
}

.kigezo-col {
  min-width: 210px;
  max-width: 320px;
  font-size: 13.5px;
  color: #333;
}

.rating-group {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.rating-option {
  position: relative;
  cursor: pointer;
}

.rating-input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  margin: 0;
}

.rating-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1.5px solid var(--twcc-border);
  background: #fff;
  font-weight: 700;
  font-size: 13.5px;
  color: #999;
  transition: all 0.15s ease;
}

.rating-input:checked + .rating-number {
  color: #fff;
  transform: scale(1.08);
  border-color: transparent;
}

.rating-option.rating-5 .rating-input:checked + .rating-number { background: var(--twcc-green-dark); }
.rating-option.rating-4 .rating-input:checked + .rating-number { background: var(--twcc-green); }
.rating-option.rating-3 .rating-input:checked + .rating-number { background: var(--twcc-gold); }
.rating-option.rating-2 .rating-input:checked + .rating-number { background: #e08a3c; }
.rating-option.rating-1 .rating-input:checked + .rating-number { background: #d1483f; }

.rating-input:focus-visible + .rating-number { box-shadow: 0 0 0 3px rgba(24, 120, 180, 0.3); }

/* row highlighting when answered */
tr.row-answered .kigezo-col { color: var(--twcc-green-dark); }

/* ---------------- CHECKBOXES (Q31) ---------------- */
.checkbox-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.checkbox-option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  padding: 9px 10px;
  border: 1.5px solid var(--twcc-border);
  border-radius: 8px;
  cursor: pointer;
  background: #fbfdfc;
}

.checkbox-option input { width: 17px; height: 17px; accent-color: var(--twcc-green); flex-shrink: 0; }

/* ---------------- NAV BUTTONS ---------------- */
.nav-buttons {
  display: flex;
  gap: 10px;
  margin-top: 26px;
  position: sticky;
  bottom: 0;
  background: var(--twcc-white);
  padding-top: 10px;
}

.nav-buttons .btn { flex: 1; }
#btnBack { flex: 0 0 auto; min-width: 110px; }

/* ---------------- SUMMARY / COMPLETION BOX ---------------- */
.summary-box {
  background: #f3faf4;
  border: 1.5px solid var(--twcc-green);
  border-radius: 10px;
  padding: 14px;
  margin: 14px 0;
}

.mini-progress {
  height: 8px;
  background: var(--twcc-border);
  border-radius: 10px;
  overflow: hidden;
  margin-top: 8px;
}

.mini-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--twcc-green);
  transition: width 0.3s ease;
}

/* ---------------- MESSAGES ---------------- */
.messages-wrap { margin-bottom: 12px; }

.alert {
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 8px;
  font-weight: 600;
}

.alert-success { background: #e6f7ea; color: var(--twcc-green-dark); border-left: 4px solid var(--twcc-green); }
.alert-error { background: #fdeaea; color: #a3312a; border-left: 4px solid #d1483f; }

/* ---------------- RESULTS PAGE ---------------- */
.result-card { text-align: center; }

.result-icon {
  width: 60px;
  height: 60px;
  line-height: 60px;
  border-radius: 50%;
  background: var(--twcc-green);
  color: #fff;
  font-size: 30px;
  margin: 0 auto 16px;
}

.result-name { font-size: 14.5px; color: #555; }

.score-wrap { margin: 20px 0; }

.score-circle {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  border: 8px solid var(--twcc-green);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  background: #f3faf4;
}

.score-number { font-size: 34px; font-weight: 800; color: var(--twcc-green-dark); line-height: 1; }
.score-max { font-size: 13px; color: #888; margin-top: 2px; }

.score-label {
  margin-top: 14px;
  font-size: 18px;
  font-weight: 800;
  color: var(--twcc-blue);
}

.summary-table { width: 100%; border-collapse: collapse; font-size: 13.5px; margin-top: 10px; }
.summary-table th, .summary-table td { padding: 10px; border-bottom: 1px solid var(--twcc-border); text-align: left; }
.summary-table th { color: var(--twcc-blue); }
.row-active { background: #f3faf4; font-weight: 800; color: var(--twcc-green-dark); }

/* ---------------- DASHBOARD (STAFF) ---------------- */
.dashboard-card { max-width: 100%; }

.dashboard-toolbar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: stretch;
  margin-bottom: 16px;
}

.dashboard-count { font-size: 14.5px; color: #555; margin: 0; }

.btn-export { white-space: nowrap; }

.dashboard-table th, .dashboard-table td { white-space: nowrap; }

@media (min-width: 640px) {
  .dashboard-toolbar { flex-direction: row; justify-content: space-between; align-items: center; }
}

/* ---------------- FOOTER ---------------- */
.site-footer {
  text-align: center;
  padding: 16px;
  font-size: 12px;
  color: #999;
}

/* ================= TABLET / DESKTOP ================= */
@media (min-width: 640px) {
  .header-inner { padding: 16px 24px; }
  .logo { width: 68px; height: 68px; }
  .brand-green { font-size: 19px; }
  .brand-blue { font-size: 14px; }

  .site-main { padding: 30px 20px 50px; }
  .card { padding: 34px 40px; }

  .section-title { font-size: 22px; }
  .sub-title { font-size: 17px; }
  p, .intro-list li { font-size: 15.5px; }

  .checkbox-grid { grid-template-columns: 1fr 1fr; }

  .rating-number { width: 38px; height: 38px; }

  .nav-buttons { position: static; padding-top: 0; }
  #btnBack { min-width: 140px; }
}

@media (min-width: 900px) {
  .card { padding: 40px 56px; }
}
