.vendor-dashboard {
  padding: 24px;
  background: var(--bg-page);
  min-height: 100%;
  box-sizing: border-box;
  font-family: var(--app-font-family);
  padding-top: 0;
}

// ── Header ────────────────────────────────────────────────────────────────────

.dash-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
}

.dash-title h2 {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}

.dash-subtitle {
  font-size: 13px;
  color: var(--text-tertiary);
}

.btn-add-vendor {
  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); }
}

// ── Stat cards ────────────────────────────────────────────────────────────────

.stat-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 15px;
  @media (max-width: 800px) { grid-template-columns: repeat(2, 1fr); }
  @media (max-width: 480px) { grid-template-columns: 1fr; }
}

.stat-card {
  background: var(--bg-surface);
  border-radius: 10px;
  padding: 18px 20px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  display: flex;
  align-items: center;
  gap: 14px;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;

  mat-icon { font-size: 22px; width: 22px; height: 22px; }

  &.stat-icon-total    { background: var(--category-bg-alpha);  color: var(--category-text-alpha); }
  &.stat-icon-active   { background: var(--status-success-bg);  color: var(--status-success-text); }
  &.stat-icon-expired  { background: var(--status-error-bg);    color: var(--status-error-text);   }
  &.stat-icon-inactive { background: var(--bg-muted);           color: var(--text-tertiary);       }
}

.stat-info {
  .stat-value {
    font-size: 30px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 4px;
  }
  .stat-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.2px;
    color: var(--text-tertiary);
    text-transform: uppercase;
  }
}

// ── Filters ───────────────────────────────────────────────────────────────────

.dash-filters {
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.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); }
}

.records-count {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-left: auto;
  white-space: nowrap;
}

// ── Table ─────────────────────────────────────────────────────────────────────

.vendor-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 - 320px);
  min-height: 200px;
}

.vendor-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: top;
    color: var(--table-text-body);
  }
}

// ── Column styles ─────────────────────────────────────────────────────────────

.td-code {
  font-size: 11px;
  font-family: 'Courier New', monospace;
  color: var(--text-tertiary);
  white-space: nowrap;
}

.td-name {
  min-width: 160px;
}

.name-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.name-main {
  font-weight: 600;
  color: var(--text-primary);
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.name-sub {
  font-size: 11px;
  color: var(--text-tertiary);
}

.td-contact {
  min-width: 140px;
}

.contact-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.contact-name {
  font-weight: 500;
  color: var(--text-primary);
  font-size: 12px;
}

.contact-email {
  font-size: 11px;
  color: var(--text-tertiary);
}

.td-specialisations {
  min-width: 140px;
  max-width: 220px;
}

.specs-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.spec-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
  background: var(--bg-muted);
  color: var(--text-secondary);
}

.td-accredited {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.td-expiry { white-space: nowrap; }

.expiry-val {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  &.expiry-past { color: var(--status-error-text); }
}

.no-data { color: var(--text-disabled); }

// ── Type badge ────────────────────────────────────────────────────────────────

.type-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  &.type-provider   { background: var(--category-bg-alpha);  color: var(--category-text-alpha);  }
  &.type-certifier  { background: var(--status-error-bg);    color: var(--status-error-text);    }
  &.type-consultant { background: var(--category-bg-gamma);  color: var(--category-text-gamma);  }
  &.type-lms        { background: var(--category-bg-beta);   color: var(--category-text-beta);   }
  &.type-mooc       { background: var(--category-bg-delta);  color: var(--category-text-delta);  }
}

// ── Status badge ──────────────────────────────────────────────────────────────

.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  &.st-active   { background: var(--status-success-bg);  color: var(--status-success-text); }
  &.st-expired  { background: var(--status-error-bg);    color: var(--status-error-text);   }
  &.st-inactive { background: var(--bg-muted);           color: var(--text-secondary);      }
}

// ── Action buttons ────────────────────────────────────────────────────────────

.td-actions {
  white-space: nowrap;
}

.actions-wrap {
  display: flex;
  gap: 6px;
  align-items: center;
}

.btn-action {
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border-default);
  background: none;
  transition: background 0.15s, border-color 0.15s;
}

.btn-edit {
  color: var(--action-primary-default);
  border-color: var(--action-primary-disabled);
  &: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); }
}

// ── Table footer ──────────────────────────────────────────────────────────────

.table-footer {
  padding: 10px 16px;
  font-size: 12px;
  color: var(--text-tertiary);
  border-top: 1px solid var(--table-border);
}

.empty-state {
  text-align: center;
  padding: 40px 0;
  color: var(--text-disabled);
  font-size: 14px;
}

.section-header {
  border-left: 3px solid var(--action-primary-default);
  padding: 6px 10px;
  margin: 12px 0 8px;
  border-bottom: 1px solid var(--border-default);
  span {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1.5px;
    color: var(--text-tertiary);
    text-transform: uppercase;
  }
}

[dir="rtl"] {
  .dash-header { flex-direction: row-reverse; }
  .section-header { border-left: none; border-right: 3px solid var(--action-primary-default); }
}

// ── Modal ──────────────────────────────────────────────
.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: 800px; 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; }

// ── Contact LOV overlay ──────────────────────────────────
.FormModal {
  position: fixed;
  z-index: 9999;
  padding-top: 60px;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.4);
}

.FormModal_contentLovType {
  justify-content: center;
  background-color: var(--mat-sys-background);
  margin: auto;
  padding: 10px;
  border: 1px solid #888;
  width: 1200px;
  height: 500px;
  border-radius: 10px;
  overflow: auto;
}

// The Contact lightbox above is a custom fixed-position overlay (z-index 9999),
// but the picklist's own results dialog is a MatDialog rendered inside Angular
// CDK's global overlay container (default z-index 1000) — so it renders behind
// the Contact lightbox unless raised above it. Same fix as trainingvenue.component.scss.
::ng-deep .cdk-overlay-container {
  z-index: 100000 !important;
}

::ng-deep .cdk-overlay-pane {
  z-index: 100001 !important;
}

::ng-deep .mat-mdc-dialog-container {
  z-index: 100002 !important;
}

.NewFormcloseicon {
  float: right;
  cursor: pointer;
  position: relative;
  top: -5px;
}
.modal-form > div { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.modal-form .adjacentField { width: 100%; margin-right: 0; display: block; }