@use '../qualifierscope/qualifier-manager-layout' as manager;

.ent-page {
  padding: 20px 24px;
  max-width: 960px;
}

.ent-page-head {
  margin-bottom: 20px;
}

.ent-head {
  font-size: 20px;
  font-weight: 600;
  color: #1a1a2e;
  margin: 0 0 16px 0;
}

.ptv-load-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 24px;
}

.ptv-loading,
.ptv-empty {
  padding: 16px 0;
  color: rgba(0, 0, 0, 0.5);
  font-size: 14px;
}

.ptv-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 24px;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;

  th {
    text-align: left;
    padding: 10px 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #6b6b85;
    background: #f5f5fa;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  }

  td {
    padding: 10px 12px;
    font-size: 14px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  }

  tr:last-child td {
    border-bottom: none;
  }
}


// "Add Binding" trigger button
.btn-primary.btn-sm {
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  background: #7c3aed;
  border: none;
  border-radius: 20px;
  cursor: pointer;

  &:hover { background: #6d28d9; }
}

// Toggle button — "Activate" state (currently inactive → green, invites action)
.btn-toggle-off {
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 16px;
  cursor: pointer;
  min-width: 90px;
  color: #15803d;
  background: transparent;
  border: 1px solid #bbf7d0;

  &:hover { background: #f0fdf4; border-color: #15803d; }
}

// Toggle button — "Deactivate" state (currently active → amber, signals caution)
.btn-toggle-on {
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 16px;
  cursor: pointer;
  min-width: 90px;
  color: #b45309;
  background: transparent;
  border: 1px solid #fde68a;

  &:hover { background: #fffbeb; border-color: #b45309; }
}

// ---- Add Binding panel — alignment + scroll ----
.ptv-new-panel {
  border: 1px solid #e8e8f0;
  border-radius: 10px;
  background: #fff;
  padding: 20px;
  // max-width: 560px;
  max-height: 50vh;
  display: flex;
  flex-direction: column;
  overflow-y: auto;

  .ent-head {
    font-size: 16px;
    margin-bottom: 12px;
    flex-shrink: 0;
  }

  &::-webkit-scrollbar { width: 10px; }
  &::-webkit-scrollbar-thumb { background: #a78bfa; border-radius: 5px; }
  &::-webkit-scrollbar-track { background: #f3f4f6; }
  scrollbar-width: thin;
  scrollbar-color: #a78bfa #f3f4f6;
}

::ng-deep .ptv-new-panel {
  // Required so the panel's max-height/scroll actually engages —
  // without this the embedded form ignores the boundary and grows past it
  gb-metaform-embed {
    display: block !important;
    min-height: 0;
    flex-shrink: 1;
  }

  .section-grid {
    display: block !important;
    grid-template-columns: none !important;
    row-gap: 20px !important;
  }

  .field-cell {
    margin-bottom: 14px;
  }

  gb-combobox,
  gb-input {
    display: block;
    width: 256px !important;
  }

  gb-combobox .formlabel,
  gb-input .formlabel {
    color: var(--action-primary-default) !important;
    margin-bottom: 8px !important;
  }

  gb-combobox .mat-mdc-form-field,
  gb-input .mat-mdc-form-field {
    width: 240px !important;
  }

  // Material owns the outline. Prevent Entity Code and Sort Order from
  // drawing a second input border inside the form field.
  gb-input input.mat-mdc-input-element {
    width: 100% !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    outline: 0 !important;
    background: transparent !important;
    box-sizing: border-box;
  }

  .mfe-actions {
    flex-shrink: 0;
    display: flex !important;
    gap: 12px !important;
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);

    button {
      padding: 12px 32px !important;
      min-width: 120px !important;
      height: 44px !important;
      font-size: 14px !important;
      border-radius: 8px !important;
      cursor: pointer !important;
    }

    button:first-of-type {
      background: #7c3aed !important;
      color: #fff !important;
      border: none !important;
      font-weight: 600 !important;
      &:hover { background: #6d28d9 !important; }
    }

    button:last-of-type {
      background: #f3f4f6 !important;
      color: #374151 !important;
      border: 1px solid #d1d5db !important;
      font-weight: 500 !important;
      &:hover { background: #e5e7eb !important; }
    }
  }
}

@include manager.qualifier-manager-layout;
