/* =========================================================
   Training Q&A Block
   Clean, readable, responsive
   ========================================================= */

/* Safer box model */
.tcbqa,
.tcbqa *,
.tcbqa *::before,
.tcbqa *::after {
  box-sizing: border-box;
}

/* Keep typography readable inside the block */
.tcbqa,
.tcbqa * {
  color: #111;
}

/* Section wrapper */
.tcbqa {
  width: 100%;
  margin: 32px 0;
}

/* Main container */
.tcbqa__container {
  width: min(80%, 980px);
  margin: 0 auto;
  padding: 22px;
  border: 1px solid #d9d9d9;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.04);
}

/* Headings */
.tcbqa__h3 {
  margin: 0 0 14px;
  font-size: 22px;
  line-height: 1.25;
  font-weight: 700;
}

/* Form card */
.tcbqa__form-card {
  padding: 18px;
  border: 1px solid #e7e7e7;
  border-radius: 14px;
  background: #fafafa;
  margin-bottom: 20px;
}

/* Optional logged user line */
.tcbqa__who {
  display: flex;
  gap: 8px;
  align-items: baseline;
  font-size: 14px;
  margin-bottom: 12px;
  opacity: 0.95;
}

/* Form layout */
.tcbqa__form {
  display: grid;
  gap: 14px;
}

/* Labels */
.tcbqa__label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}

/* Inputs + textarea */
.tcbqa__input,
.tcbqa__textarea {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 12px 14px;
  border: 1px solid #cfcfcf;
  border-radius: 10px;
  background: #fff;
  font-size: 15px;
  line-height: 1.45;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  appearance: none;
}

.tcbqa__input::placeholder,
.tcbqa__textarea::placeholder {
  color: #777;
}

.tcbqa__input:focus,
.tcbqa__textarea:focus {
  border-color: rgba(4, 118, 107, 0.989);
  box-shadow: 0 0 0 3px rgba(4, 118, 107, 0.12);
  background: #fff;
}

.tcbqa__textarea {
  min-height: 120px;
  resize: vertical;
}

/* Upload area */
.tcbqa__upload {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px dashed #d7d7d7;
  border-radius: 12px;
  background: #fff;
}

.tcbqa__upload-hint {
  grid-column: 1 / -1;
  font-size: 13px;
  font-weight: 600;
  opacity: 0.95;
}

.tcbqa__file {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.tcbqa__filebtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid #cfcfcf;
  background: #f2f2f2;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  user-select: none;
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.1s ease;
}

.tcbqa__filebtn:hover {
  background: #ebebeb;
  border-color: #b9b9b9;
}

.tcbqa__filebtn:active {
  transform: translateY(1px);
}

.tcbqa__filename {
  min-width: 0;
  font-size: 13px;
  color: #555;
  opacity: 0.95;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tcbqa__hint {
  grid-column: 1 / -1;
  font-size: 12px;
  color: #666;
  opacity: 0.9;
}

/* Submit button */
.tcbqa__submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: start;
  min-height: 46px;
  padding: 12px 18px;
  border: 1px solid rgba(4, 118, 107, 0.989);
  border-radius: 10px;
  background: rgba(4, 118, 107, 0.989);
  color: #fff !important;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  transition: opacity 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
}

.tcbqa__submit:hover {
  opacity: 0.94;
  box-shadow: 0 8px 18px rgba(4, 118, 107, 0.18);
}

.tcbqa__submit:active {
  transform: translateY(1px);
}

.tcbqa__submit:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  box-shadow: none;
}

/* Message area */
.tcbqa__msg {
  min-height: 20px;
  margin-top: 2px;
  font-size: 13px;
  line-height: 1.4;
}

.tcbqa__msg.is-ok {
  color: #0b5a2a;
}

.tcbqa__msg.is-error {
  color: #8a1f1f;
}

/* List card */
.tcbqa__list-card {
  margin-top: 6px;
}

.tcbqa__list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.tcbqa__badge {
  font-size: 13px;
  line-height: 1;
  padding: 9px 12px;
  border-radius: 999px;
  border: 1px solid #e1e1e1;
  background: #f7f7f7;
  white-space: nowrap;
}

/* Question list */
.tcbqa__items {
  display: grid;
  gap: 12px;
}

/* Single item */
.tcbqa__item {
  border: 1px solid #e6e6e6;
  border-radius: 14px;
  padding: 16px;
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.tcbqa__item:hover {
  border-color: #d8d8d8;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.035);
}

/* Meta row */
.tcbqa__meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.tcbqa__meta-left {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
}

.tcbqa__date {
  font-size: 13px;
  color: #666;
  opacity: 1;
}

.tcbqa__author {
  font-size: 14px;
  font-weight: 600;
}

/* Question */
.tcbqa__question {
  margin-top: 4px;
}

.tcbqa__question p {
  margin: 0;
  font-size: 15px;
  line-height: 1.65;
  font-weight: 600;
  white-space: pre-wrap;
  word-break: break-word;
}

.tcbqa__question p + p {
  margin-top: 10px;
}

/* Image */
.tcbqa__image {
  margin-top: 12px;
}

.tcbqa__image img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  border: 1px solid #ededed;
}

/* Pending state */
.tcbqa__pending {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fff7e6;
  border: 1px solid #ffe2aa;
  color: #5b4200;
  font-size: 13px;
  line-height: 1.45;
}

/* Answer */
.tcbqa__answer {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #f3f6ff;
  border: 1px solid #d9e2ff;
  color: #0b1b4a;
}

.tcbqa__answer-title {
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 700;
  color: #0b1b4a;
}

.tcbqa__answer-body {
  font-size: 14px;
  line-height: 1.65;
  color: #0b1b4a;
}

.tcbqa__answer-body p {
  margin: 0;
}

.tcbqa__answer-body p + p {
  margin-top: 10px;
}

/* Delete button */
.tcbqa__delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 10px;
  border: 1px solid #d6d6d6;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease, opacity 0.2s ease;
}

.tcbqa__delete:hover {
  border-color: #bdbdbd;
  background: #f8f8f8;
}

.tcbqa__delete:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Empty / Note */
.tcbqa__empty,
.tcbqa__login-note {
  padding: 14px;
  border-radius: 12px;
  border: 1px dashed #d9d9d9;
  background: #fbfbfb;
  font-size: 14px;
  line-height: 1.55;
}

/* Accessibility helper for invalid fields if JS adds classes */
.tcbqa__input.is-error,
.tcbqa__textarea.is-error {
  border-color: #c62828;
  box-shadow: 0 0 0 3px rgba(198, 40, 40, 0.1);
}

/* Responsive */
@media (max-width: 720px) {
  .tcbqa {
    margin: 24px 0;
  }

  .tcbqa__container {
    width: 92%;
    padding: 16px;
    border-radius: 14px;
  }

  .tcbqa__form-card {
    padding: 14px;
  }

  .tcbqa__h3 {
    font-size: 20px;
  }

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

  .tcbqa__filebtn {
    width: 100%;
  }

  .tcbqa__meta {
    flex-direction: column;
    align-items: stretch;
  }

  .tcbqa__delete {
    align-self: flex-start;
  }

  .tcbqa__question p {
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  .tcbqa__container {
    width: 94%;
    padding: 14px;
  }

  .tcbqa__item {
    padding: 14px;
  }

  .tcbqa__submit {
    width: 100%;
  }

  .tcbqa__badge {
    width: 100%;
    text-align: center;
  }
}