/* =====================================================
   ROLE EXPLORER PICKER
   Complementa roles-dialog.css (rt-*) con rep-*
   ===================================================== */

/* ── Dialog shell ── */
.rep-dialog {
  width: 860px !important;
  max-width: 94vw !important;
  height: 82vh !important;
  max-height: 82vh !important;
  display: flex !important;
  flex-direction: column !important;
  border-radius: 14px !important;
  overflow: hidden !important;
}

.rep-dialog .rep-content {
  flex: 1 !important;
  display: flex !important;
  flex-direction: column !important;
  padding: 0 !important;
  overflow: hidden !important;
}

.rep-dialog .rt-scrollable {
  flex: 1 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
}

/* =====================================================
   TOOLBAR
   ===================================================== */

.rep-toolbar {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
  min-height: 68px !important;
  flex-shrink: 0 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
  border-bottom: 4px solid #eeeff8 !important;
}

.rep-toolbar-inner {
  padding: 0 16px !important;
  min-height: 68px !important;
  display: flex !important;
  align-items: center !important;
  gap: 14px;
}

.rep-toolbar-icon-wrap {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.25);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.rep-toolbar-icon-wrap md-icon { font-size: 20px !important; color: white !important; }

.rep-toolbar-info { display: flex; flex-direction: column; gap: 2px; }

.rep-title {
  font-size: 17px; font-weight: 700; color: white;
  margin: 0; line-height: 1.2;
}
.rep-subtitle { font-size: 12px; color: rgba(255,255,255,0.65); margin: 2px 0 0; }

.rep-toolbar-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 14px; border-radius: 20px;
  background: rgba(255,255,255,0.2); color: white;
  font-size: 13px; font-weight: 700; white-space: nowrap; flex-shrink: 0;
}
.rep-toolbar-badge md-icon { font-size: 15px !important; color: white !important; }

.rep-close-btn md-icon { color: rgba(255,255,255,0.8) !important; }
.rep-close-btn:hover   { background: rgba(255,255,255,0.15) !important; }

/* =====================================================
   ACTIONS BAR
   ===================================================== */

.rep-actions-bar {
  background: white;
  border-bottom: 2px solid #e8eaf0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.rep-actions-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
}
.rep-actions-row--top  { border-bottom: 1px solid #f0f2f7; min-height: 52px; }
.rep-actions-row--btns { min-height: 50px; padding: 8px 16px; flex-wrap: wrap; gap: 8px; }

.rep-actions-left  { display: flex; align-items: center; gap: 8px; flex-shrink: 0; flex-wrap: wrap; }
.rep-actions-search { flex: 1; min-width: 160px; }

.rep-sep-v { width: 1px; height: 28px; background: #e0e0e0; flex-shrink: 0; align-self: center; }

.rep-badge-selected { background: rgba(16,185,129,0.12); color: #059669; }

/* =====================================================
   ACTION BUTTONS
   ===================================================== */

.rep-action-btn {
  height: 34px !important; min-height: 34px !important;
  border-radius: 20px !important; padding: 0 14px !important;
  font-size: 12px !important; font-weight: 600 !important;
  text-transform: none !important;
  display: inline-flex !important; align-items: center !important; gap: 5px !important;
  margin: 0 !important; white-space: nowrap !important; flex-shrink: 0 !important;
  transition: all 0.18s ease !important;
}
.rep-action-btn md-icon { font-size: 17px !important; width: 17px !important; height: 17px !important; color: inherit !important; }

.rep-action-btn--secondary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
  color: white !important; box-shadow: 0 2px 6px rgba(102,126,234,0.3) !important;
}
.rep-action-btn--secondary:hover { box-shadow: 0 4px 12px rgba(102,126,234,0.45) !important; transform: translateY(-1px) !important; }

.rep-action-btn--outline {
  background: white !important; color: #667eea !important;
  border: 2px solid #dde1ee !important; box-shadow: none !important;
}
.rep-action-btn--outline:hover { border-color: #667eea !important; background: rgba(102,126,234,0.04) !important; }

.rep-action-btn--green {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
  color: white !important; box-shadow: 0 2px 6px rgba(16,185,129,0.3) !important;
}
.rep-action-btn--green:hover { box-shadow: 0 4px 12px rgba(16,185,129,0.45) !important; transform: translateY(-1px) !important; }

.rep-action-btn--red {
  background: white !important; color: #e05252 !important;
  border: 2px solid #fca5a5 !important; box-shadow: none !important;
}
.rep-action-btn--red:hover:not([disabled]) { background: #fff1f1 !important; border-color: #e05252 !important; }
.rep-action-btn--red[disabled]             { opacity: 0.4 !important; cursor: not-allowed !important; }
.rep-action-btn--red md-icon { color: #e05252 !important; }

/* =====================================================
   TREE — selection states
   ===================================================== */

.rep-role-header--selected {
  background: rgba(102,126,234,0.08) !important;
  border-left: 3px solid #667eea !important;
}

.rep-perm-node { cursor: pointer; }
.rep-perm-node--selected {
  background: rgba(192,38,211,0.07) !important;
  border-left: 3px solid #c026d3 !important;
}

/* ── Checkboxes ── */
.rep-checkbox {
  width: 20px; height: 20px; min-width: 20px;
  border: 2px solid #ccc; border-radius: 4px;
  background: white; position: relative; flex-shrink: 0;
  cursor: pointer; transition: all 0.18s ease;
}
.rep-checkbox--checked {
  background: #667eea; border-color: #667eea;
  box-shadow: 0 2px 6px rgba(102,126,234,0.35);
}
.rep-checkbox--checked::after {
  content: ''; display: block; position: absolute;
  left: 5px; top: 1px; width: 6px; height: 11px;
  border: 2px solid white; border-top: none; border-left: none;
  transform: rotate(45deg);
}

/* Permission checkbox — circular */
.rep-checkbox--perm { width: 18px; height: 18px; min-width: 18px; border-radius: 50%; }
.rep-checkbox--perm.rep-checkbox--checked {
  background: #c026d3; border-color: #c026d3;
  box-shadow: 0 2px 6px rgba(192,38,211,0.35);
}
.rep-checkbox--perm.rep-checkbox--checked::after { left: 4px; top: 1px; width: 5px; height: 10px; }

/* =====================================================
   TYPE BADGES — role vs permission discriminator
   ===================================================== */

/* Name rows — flex para badge inline */
.rt-role-name-row,
.rt-perm-name-row {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

/* Base badge */
.rep-type-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  flex-shrink: 0;
  line-height: 1.4;
}

/* ROLE — purple */
.rep-type-badge--role {
  background: rgba(102, 126, 234, 0.12);
  color: #667eea;
}

/* PERMISSION — emerald */
.rep-type-badge--permission {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
}

/* =====================================================
   FOOTER
   ===================================================== */

.rep-footer {
  background: white !important; border-top: 1px solid #e8e8e8 !important;
  padding: 12px 20px !important; display: flex !important;
  align-items: center !important; gap: 10px; flex-shrink: 0; min-height: 60px;
}
.rep-footer > span[flex] { flex: 1; }

.rep-footer-hint {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: #059669; font-weight: 600;
}
.rep-footer-hint md-icon { font-size: 15px !important; color: #059669 !important; }
.rep-footer-hint--empty         { color: #9e9e9e; }
.rep-footer-hint--empty md-icon { color: #bdbdbd !important; }

.rep-btn-cancel {
  height: 38px !important; border-radius: 20px !important; padding: 0 18px !important;
  font-size: 13px !important; font-weight: 600 !important; text-transform: none !important;
  display: inline-flex !important; align-items: center !important; gap: 6px !important;
  margin: 0 !important; background: white !important; color: #666 !important;
  border: 2px solid #e0e0e0 !important; box-shadow: none !important;
}
.rep-btn-cancel:hover { border-color: #bdbdbd !important; background: #f5f5f5 !important; }
.rep-btn-cancel md-icon { font-size: 16px !important; color: #888 !important; }

.rep-btn-confirm {
  height: 38px !important; border-radius: 20px !important; padding: 0 22px !important;
  font-size: 13px !important; font-weight: 700 !important; text-transform: none !important;
  display: inline-flex !important; align-items: center !important; gap: 6px !important;
  margin: 0 !important;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
  color: white !important; box-shadow: 0 2px 6px rgba(102,126,234,0.3) !important;
}
.rep-btn-confirm:hover:not([disabled]) { box-shadow: 0 4px 14px rgba(102,126,234,0.45) !important; transform: translateY(-1px) !important; }
.rep-btn-confirm[disabled]             { opacity: 0.45 !important; background: #e0e0e0 !important; color: #9e9e9e !important; box-shadow: none !important; transform: none !important; }
.rep-btn-confirm md-icon { font-size: 16px !important; color: white !important; }

/* =====================================================
   RESPONSIVE
   ===================================================== */

@media (max-width: 880px) {
  .rep-dialog { width: 96vw !important; max-width: 96vw !important; }
}
@media (max-width: 600px) {
  .rep-actions-row--btns { flex-wrap: wrap; }
  .rep-sep-v             { display: none; }
}