.qb-dashboard {
  padding: 24px;
  padding-top: 0;
  background: var(--bg-page);
  min-height: 100%;
  box-sizing: border-box;
  font-family: var(--app-font-family);
}

.qb-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}

.qb-title-block {
  h2 {
    margin: 0 0 4px;
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
  }
}

.qb-subtitle {
  font-size: 13px;
  color: var(--text-tertiary);
}

.btn-add-q {
  background: var(--button-primary-bg-default);
  color: var(--button-primary-text-default);
  border: 1px solid var(--button-primary-border-default);
  border-radius: 6px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;

  &:hover  { background: var(--button-primary-bg-hover); }
  &:active { background: var(--button-primary-bg-active); }
}

.qb-filters {
  display: flex;
  gap: 12px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.search-input {
  flex: 1;
  min-width: 220px;
  padding: 8px 12px;
  border: 1px solid var(--field-border-default);
  border-radius: 6px;
  font-size: 13px;
  background: var(--field-bg-default);
  color: var(--field-text-default);
  outline: none;

  &::placeholder { color: var(--field-text-placeholder); }
  &:focus { border-color: var(--field-border-focus); }
}

.filter-select {
  padding: 8px 28px 8px 12px;
  border: 1px solid var(--field-border-default);
  border-radius: 6px;
  font-size: 13px;
  background: var(--field-bg-default);
  color: var(--field-text-default);
  cursor: pointer;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236B7280' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;

  &:focus { border-color: var(--field-border-focus); }
}

.qb-table-wrap {
  background: var(--bg-surface);
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.table-scroll {
  overflow-x: auto;
  overflow-y: auto;
  max-height: calc(93vh - 280px);
  min-height: 200px;
}

.qb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;

  thead tr { border-bottom: 1px solid var(--table-border); }

  th {
    padding: 12px 14px;
    text-align: left;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--table-text-header);
    background: var(--table-header-bg);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
  }

  tbody tr {
    border-bottom: 1px solid var(--table-border);
    transition: background 0.15s;
    &:last-child { border-bottom: none; }
    &:hover { background: var(--bg-hover); }
  }

  td {
    padding: 11px 14px;
    vertical-align: middle;
    color: var(--table-text-body);
  }
}

.td-question { min-width: 220px; max-width: 340px; }

.q-title {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.q-text {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 300px;
}

// Question type badges
.qt-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;

  &.qt-mcq    { background: var(--category-bg-alpha, #eff6ff); color: var(--action-primary-default); }
  &.qt-tf     { background: var(--category-bg-beta, #f0fdf4);  color: var(--status-success-text); }
  &.qt-sa     { background: var(--bg-muted);                   color: var(--text-secondary); }
  &.qt-ms     { background: var(--category-bg-gamma, #fdf4ff); color: #8b5cf6; }
  &.qt-match  { background: var(--category-bg-delta, #fff7ed); color: #c2410c; }
  &.qt-order  { background: #fef2f2;                           color: var(--status-error-text); }
}

// Difficulty badges
.diff-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;

  &.diff-easy   { background: var(--status-success-bg); color: var(--status-success-text); }
  &.diff-medium { background: #fff7ed;                  color: #c2410c; }
  &.diff-hard   { background: var(--status-error-bg);   color: var(--status-error-text); }
}

.td-marks {
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

.td-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 200px;
}

.tag-chip {
  display: inline-block;
  padding: 2px 8px;
  background: var(--bg-muted);
  border: 1px solid var(--border-default);
  border-radius: 10px;
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;

  &.status-active   { background: var(--status-success-bg); color: var(--status-success-text); }
  &.status-inactive { background: var(--bg-muted);          color: var(--text-disabled); }
}

.no-data {
  color: var(--text-disabled);
}

.td-actions {
  white-space: nowrap;
  display: flex;
  gap: 6px;
  align-items: center;
}

.btn-edit,
.btn-delete {
  background: none;
  border: 1px solid var(--border-default);
  border-radius: 6px;
  padding: 5px 8px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  transition: background 0.15s;
}

.btn-edit {
  color: var(--action-primary-default);
  border-color: var(--action-primary-disabled);
  font-size: 12px;
  padding: 5px 12px;

  &:hover { background: var(--bg-selected); border-color: var(--action-primary-default); }
}

.btn-delete {
  color: var(--status-error-text);
  border-color: var(--status-error-border);

  &:hover { background: var(--status-error-bg); border-color: var(--status-error-text); }
}

.empty-state {
  text-align: center;
  padding: 40px 0;
  color: var(--text-disabled);
  font-size: 14px;
}

.table-footer {
  padding: 10px 16px;
  font-size: 12px;
  color: var(--text-tertiary);
  border-top: 1px solid var(--table-border);
}

// ── Modal Lightbox ──────────────────────────────────────────────────
.modal {
  display: none; position: fixed; z-index: 999; padding-top: 60px;
  left: 0; top: 0; width: 100%; height: 100%;
  background-color: rgba(0, 0, 0, 0.4);
}
.modal-content-wrapper { display: flex; justify-content: center; }
.modal-content {
  background-color: #fefefe; margin: auto; padding: 0;
  border: 1px solid #888; width: 820px; min-height: 320px; border-radius: 8px;
  max-height: calc(100vh - 80px); overflow-y: auto; box-sizing: border-box;
}
.titlecontainer {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 21px; margin-bottom: 0;
  position: sticky; top: 0; z-index: 1;
  background: #fefefe; border-bottom: 1px solid #e5e5e5;
}
.buttfilter { font-weight: 700; font-size: 18px; margin: 0; color: #333333; }
.icons { display: flex; gap: 24px; align-items: center; }
.action { display: flex; gap: 16px; align-items: center; }
.save {
  display: flex; align-items: center; justify-content: center;
  width: 48px; height: 40px; border-radius: 8px; background: #1EAE8A; cursor: pointer; transition: all 0.3s ease;
  mat-icon { color: #fff; font-size: 20px; width: 22px; height: 22px; }
  &:hover { background: #189b7a; transform: translateY(-1px); box-shadow: 0 4px 8px rgba(30,174,138,0.3); }
}
.delete {
  display: flex; align-items: center; justify-content: center;
  width: 48px; height: 40px; border-radius: 8px; border: 1px solid #E63946; background: transparent; cursor: pointer; transition: all 0.3s ease;
  mat-icon { color: #E63946; font-size: 20px; width: 20px; height: 20px; }
  &:hover { background: rgba(230,57,70,0.1); transform: translateY(-1px); }
}
.add {
  display: flex; align-items: center; justify-content: center;
  width: 48px; height: 40px; border-radius: 8px; border: 1px solid #818181; background: transparent; cursor: pointer; transition: all 0.3s ease;
  mat-icon { color: #818181; font-size: 20px; width: 20px; height: 20px; }
  &:hover { background: rgba(129,129,129,0.1); border-color: #666; transform: translateY(-1px); }
}
.closeicon {
  display: flex; align-items: center; justify-content: center; cursor: pointer; transition: transform 0.3s ease;
  mat-icon { width: 27px; height: 27px; font-size: 27px; color: #666666; }
  &:hover { transform: scale(1.1); mat-icon { color: #333333; } }
}
.modal-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 16px 21px 21px;

  > div {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }

  .adjacentField { width: 100%; margin-right: 0; display: block; }
}
