/* =====================================================
   CREATE ROLE DIALOG — create-role-dialog.css
   Reuses BizMetry design tokens (redefined here since this
   dialog is attached to document.body, outside .rt-content).
   ===================================================== */

.crd-dialog {
  --rt-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --rt-color:    #667eea;
  --rt-border:   2px solid #e0e0e0;
  --rt-radius:   8px;
  --rt-ease:     all 0.2s ease;

  width: 640px;
  max-width: 92vw;
  max-height: 88vh;
  border-radius: 14px !important;
  overflow: hidden;
}

/* ── Toolbar ── */

.crd-toolbar { background: var(--rt-gradient) !important; }

.crd-toolbar-inner { gap: 12px; }

.crd-toolbar-icon-wrap {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.crd-toolbar-icon-wrap md-icon { color: white !important; }

.crd-toolbar-info { min-width: 0; }

.crd-title {
  font-size: 17px;
  font-weight: 700;
  color: white;
  margin: 0;
  line-height: 1.2;
}

.crd-subtitle {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.85);
  margin: 2px 0 0;
}

.crd-close-btn md-icon { color: white !important; }

/* ── Content ── */

.crd-content {
  padding: 20px 24px;
  max-height: 60vh;
}

.crd-form-section { margin-bottom: 16px; }

.crd-form-section md-input-container { margin: 0 0 6px; }

.crd-form-section label {
  font-size: 12px;
  font-weight: 600;
  color: #666;
}

.crd-form-section input,
.crd-form-section textarea {
  font-size: 14px;
  color: #2d2d2d;
}

.crd-tabs {
  display: flex;
  gap: 8px;
  margin: 18px 0 4px;
}

.crd-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  text-align: left;
  gap: 6px;
  padding: 8px 12px;
  border: 2px solid #e0e0e0;
  border-radius: var(--rt-radius);
  background: white;
  color: #666;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--rt-ease);
}

.crd-tab md-icon {
  flex: none;
  margin: 0 !important;
  font-size: 17px !important;
  width: 17px !important;
  height: 17px !important;
  color: inherit !important;
}

/* :not(.crd-tab--active) matters here: .crd-tab:hover has higher
   specificity (class + pseudo-class) than .crd-tab--active (class only),
   so without this exclusion, hovering the active tab overrode its gradient
   background back to this near-white color while the text stayed white
   from .crd-tab--active — invisible white-on-white label. */
.crd-tab:not(.crd-tab--active):hover { background: #fafbff; }

.crd-tab--active {
  background: var(--rt-gradient);
  border-color: transparent;
  color: white;
}

.crd-tab--active:hover {
  background: var(--rt-gradient);
}

.crd-tab-count { flex: none; font-size: 12px; opacity: 0.9; }

.crd-perms-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 8px;
}

.crd-perms-title {
  font-size: 13px;
  font-weight: 700;
  color: #333;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.crd-clear-selection {
  font-size: 12px !important;
  color: #ef4444 !important;
  text-transform: none !important;
  min-height: 28px !important;
  padding: 0 8px !important;
  margin: 0 !important;
}

.crd-search { margin-bottom: 10px; height: 38px; }

.crd-perms-list {
  height: 300px; /* fixed, not max-height — otherwise the dialog resizes
                     (and jumps around) as search narrows the result count */
  overflow-y: auto;
  border: var(--rt-border);
  border-radius: var(--rt-radius);
}

.crd-perms-list::-webkit-scrollbar       { width: 8px; }
.crd-perms-list::-webkit-scrollbar-track { background: #f5f5f5; }
.crd-perms-list::-webkit-scrollbar-thumb { background: #bdbdbd; border-radius: 4px; }

.crd-perm-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  transition: background 0.15s ease;
}

.crd-perm-row:last-child { border-bottom: none; }
.crd-perm-row:hover      { background: #fafbff; }

.crd-perm-row--selected {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.08) 100%);
}

.crd-checkbox {
  width: 20px;
  height: 20px;
  min-width: 20px;
  border-radius: 5px;
  border: 2px solid #cfd4e0;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--rt-ease);
}

.crd-checkbox md-icon {
  display: none; /* shown only via .crd-checkbox--checked below — the icon
                     stays in the DOM always so there's no ng-if watcher or
                     compile/link churn per row on every toggle */
  align-items: center;
  justify-content: center;
  font-size: 14px !important;
  width: 14px !important;
  height: 14px !important;
  line-height: 14px !important;
  color: white !important;
}

.crd-checkbox--checked {
  background: var(--rt-gradient);
  border-color: transparent;
}

.crd-checkbox--checked md-icon {
  display: flex;
}

.crd-empty {
  padding: 24px;
  text-align: center;
  color: #999;
  font-size: 13px;
}

/* ── Footer ── */

.crd-footer { padding: 12px 20px; border-top: 1px solid #f0f0f0; }

.crd-footer-hint {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: #999;
}

.crd-footer-hint md-icon {
  font-size: 15px !important;
  width: 15px !important;
  height: 15px !important;
  color: inherit !important;
}

.crd-btn-cancel {
  background: white !important;
  color: #666 !important;
  border: 2px solid #e0e0e0 !important;
  box-shadow: none !important;
}

.crd-btn-confirm {
  background: var(--rt-gradient) !important;
  color: white !important;
}

.crd-btn-confirm[disabled] {
  background: #e0e0e0 !important;
  color: #9e9e9e !important;
}
