/* ==============================================
   ADMIN & USER MANAGEMENT — SIMAS
   Page-specific styles
   ============================================== */

/* ---- Table wrapper ---- */
.table-wrap {
  overflow-x: auto;
}

/* ---- Info text in card header ---- */
.tbl-info {
  font-size: 0.6875rem;
  color: var(--muted);
}

/* ---- Font helpers ---- */
.font-bold { font-weight: 700; }
.text-muted { color: var(--muted); }
.text-small { font-size: 0.75rem; }
.text-amber { color: var(--amber); }
.text-red   { color: var(--red); }

/* ---- Button size variants ---- */
.btn-sm {
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
}
.btn-xs-full {
  width: 100%;
  justify-content: center;
  margin-top: 0.5rem;
}

/* ---- Search with icon ---- */
.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.search-icon {
  position: absolute;
  left: 0.625rem;
  color: var(--muted);
  font-size: 0.75rem;
  pointer-events: none;
}
.search-input-icon {
  padding-left: 2rem;
}

/* ==============================================
   RBAC SUMMARY CARDS
   ============================================== */
.rbac-scroll {
  overflow-x: auto;
  padding-bottom: 0.25rem;
}
.rbac-row {
  display: flex;
  gap: 0.625rem;
  min-width: max-content;
}
.rbac-card {
  border-radius: 10px;
  padding: 0.875rem 1.25rem;
  min-width: 110px;
  text-align: center;
  border: 1px solid transparent;
  transition: transform 0.15s, box-shadow 0.15s;
  cursor: default;
}
.rbac-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}
.rbac-role-name {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.375rem;
}
.rbac-count {
  font-size: 1.75rem;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  line-height: 1;
}
.rbac-label {
  font-size: 0.625rem;
  margin-top: 0.2rem;
  opacity: 0.75;
}

/* Role color variants */
.rbac-admin {
  background: rgba(27,58,107,0.1);
  color: #1B3A6B;
  border-color: rgba(27,58,107,0.2);
}
.rbac-kadipo {
  background: rgba(37,99,235,0.1);
  color: #1D4ED8;
  border-color: rgba(37,99,235,0.2);
}
.rbac-dispatcher {
  background: rgba(99,102,241,0.1);
  color: #4338CA;
  border-color: rgba(99,102,241,0.2);
}
.rbac-supervisor {
  background: rgba(139,92,246,0.1);
  color: #5B21B6;
  border-color: rgba(139,92,246,0.2);
}
.rbac-masinis {
  background: rgba(16,185,129,0.1);
  color: #047857;
  border-color: rgba(16,185,129,0.2);
}
.rbac-manajemen {
  background: rgba(6,182,212,0.1);
  color: #0369A1;
  border-color: rgba(6,182,212,0.2);
}
.rbac-auditor {
  background: rgba(245,158,11,0.1);
  color: #92400E;
  border-color: rgba(245,158,11,0.2);
}

/* ==============================================
   ROLE BADGES (table + audit)
   ============================================== */
.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.5rem;
  border-radius: 100px;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.role-badge-xs {
  font-size: 0.5625rem;
  padding: 0.15rem 0.4rem;
}
.role-admin     { background: rgba(27,58,107,0.12); color: #1B3A6B; }
.role-kadipo    { background: rgba(37,99,235,0.12); color: #1D4ED8; }
.role-dispatcher{ background: rgba(99,102,241,0.12); color: #4338CA; }
.role-supervisor{ background: rgba(139,92,246,0.12); color: #5B21B6; }
.role-masinis   { background: rgba(16,185,129,0.12); color: #047857; }
.role-manajemen { background: rgba(6,182,212,0.12); color: #0369A1; }
.role-auditor   { background: rgba(245,158,11,0.12); color: #92400E; }
.role-system    { background: rgba(100,116,139,0.12); color: #475569; }

/* ==============================================
   USER TABLE
   ============================================== */
.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.625rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.bg-navy-avatar   { background: linear-gradient(135deg, #1B3A6B, #2563EB); }
.bg-blue-avatar   { background: linear-gradient(135deg, #2563EB, #3B82F6); }
.bg-indigo-avatar { background: linear-gradient(135deg, #6366F1, #8B5CF6); }
.bg-purple-avatar { background: linear-gradient(135deg, #8B5CF6, #A78BFA); }
.bg-green-avatar  { background: linear-gradient(135deg, #10B981, #34D399); }
.bg-cyan-avatar   { background: linear-gradient(135deg, #06B6D4, #22D3EE); }
.bg-amber-avatar  { background: linear-gradient(135deg, #F59E0B, #FCD34D); }
.bg-gray-avatar   { background: linear-gradient(135deg, #94A3B8, #CBD5E1); }

.user-uname {
  color: var(--accent);
  font-size: 0.75rem;
}
.user-name {
  font-weight: 500;
}

/* Session indicator */
.session-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}

.aksi-col {
  display: flex;
  gap: 0.25rem;
  align-items: center;
  white-space: nowrap;
}
.btn-xs-danger {
  background: rgba(239,68,68,0.08);
  border-color: rgba(239,68,68,0.3);
  color: #DC2626;
}
.btn-xs-danger:hover {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}
.btn-xs-success {
  background: rgba(16,185,129,0.08);
  border-color: rgba(16,185,129,0.3);
  color: #047857;
}
.btn-xs-success:hover {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

/* ==============================================
   PAGINATION
   ============================================== */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 1rem;
  border-top: 1px solid var(--border);
}
.pg-info {
  font-size: 0.75rem;
  color: var(--muted);
}
.pg-btns {
  display: flex;
  gap: 0.25rem;
  align-items: center;
}
.pg-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: none;
  font-size: 0.75rem;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  font-family: inherit;
}
.pg-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}
.pg-btn-active {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
  font-weight: 700;
}
.pg-btn-disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.pg-ellipsis {
  font-size: 0.75rem;
  color: var(--muted);
  padding: 0 0.25rem;
}

/* ==============================================
   AUDIT LOG TABLE
   ============================================== */
.audit-table .data-table td {
  vertical-align: middle;
}
.ts-col {
  white-space: nowrap;
  font-size: 0.6875rem !important;
  color: var(--muted);
}
.ip-col {
  font-size: 0.6875rem !important;
  color: var(--muted);
}
.detail-col {
  max-width: 260px;
  font-size: 0.75rem;
  color: var(--text);
}

/* Audit row highlights */
.audit-row-override td {
  background: rgba(245,158,11,0.06) !important;
}
.audit-row-override:hover td {
  background: rgba(245,158,11,0.1) !important;
}
.audit-row-delete td {
  background: rgba(239,68,68,0.06) !important;
}
.audit-row-delete:hover td {
  background: rgba(239,68,68,0.1) !important;
}
.audit-row-system td {
  background: rgba(100,116,139,0.04) !important;
  color: var(--muted);
}

/* Audit legend */
.audit-legend {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.6875rem;
  color: var(--muted);
  margin-right: 0.75rem;
}
.audit-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.audit-override { background: var(--amber); }
.audit-delete   { background: var(--red); }

/* Action type badges */
.action-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.625rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  white-space: nowrap;
}
.action-assign   { background: rgba(37,99,235,0.12); color: #1D4ED8; }
.action-approve  { background: rgba(16,185,129,0.12); color: #047857; }
.action-create   { background: rgba(6,182,212,0.12); color: #0369A1; }
.action-update   { background: rgba(99,102,241,0.12); color: #4338CA; }
.action-override { background: rgba(245,158,11,0.15); color: #92400E; border: 1px solid rgba(245,158,11,0.3); }
.action-delete   { background: rgba(239,68,68,0.12); color: #991B1B; border: 1px solid rgba(239,68,68,0.25); }
.action-login    { background: rgba(100,116,139,0.1); color: #475569; }
.action-export   { background: rgba(139,92,246,0.12); color: #5B21B6; }
.action-system   { background: rgba(100,116,139,0.08); color: #64748B; font-style: italic; }

/* ==============================================
   MASTER DATA CARDS
   ============================================== */
.master-card {
  display: flex;
  flex-direction: column;
  overflow: visible;
  transition: box-shadow 0.15s, transform 0.15s;
}
.master-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.08);
}
.master-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  margin: 1rem 1rem 0;
}
.master-card-body {
  padding: 0.75rem 1rem 0;
}
.master-card-title {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text);
}
.master-card-count {
  font-size: 2rem;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text);
  line-height: 1.1;
  margin-top: 0.25rem;
}
.master-card-sub {
  font-size: 0.6875rem;
  color: var(--muted);
  margin-top: 0.125rem;
}
.master-card-footer {
  padding: 0.5rem 1rem 1rem;
  margin-top: auto;
}
.master-dipo-list {
  font-size: 0.6875rem;
  color: var(--muted);
  font-family: 'JetBrains Mono', monospace;
  margin-bottom: 0.375rem;
  line-height: 1.5;
}

/* ==============================================
   KONFIGURASI / CONFIG TAB
   ============================================== */
.config-section-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.75rem;
}
.config-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.625rem 0;
  border-bottom: 1px solid rgba(0,0,0,0.04);
}
.config-item:last-child {
  border-bottom: none;
}
.config-item-info {
  flex: 1;
  min-width: 0;
}
.config-item-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.config-item-sub {
  font-size: 0.6875rem;
  color: var(--muted);
  margin-top: 0.125rem;
}
.config-divider {
  height: 1px;
  background: var(--border);
  margin: 0.875rem 0;
}

/* Config alert threshold badges */
.config-badge {
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.6875rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
}
.config-badge-red   { background: rgba(239,68,68,0.12); color: #991B1B; }
.config-badge-amber { background: rgba(245,158,11,0.12); color: #92400E; }
.config-badge-green { background: rgba(16,185,129,0.12); color: #047857; }

/* Toggle switch */
.toggle-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  flex-shrink: 0;
}
.toggle-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-track {
  width: 36px;
  height: 20px;
  background: #CBD5E1;
  border-radius: 100px;
  position: relative;
  transition: background 0.2s;
}
.toggle-track::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle-switch input:checked + .toggle-track {
  background: var(--green);
}
.toggle-switch input:checked + .toggle-track::after {
  transform: translateX(16px);
}
.toggle-switch:hover .toggle-track {
  box-shadow: 0 0 0 3px rgba(16,185,129,0.15);
}

/* Number config inputs */
.config-number-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.config-num-item {
  background: var(--bg);
  border-radius: 8px;
  padding: 0.75rem;
  border: 1px solid var(--border);
}
.config-num-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.2rem;
}
.config-num-sub {
  font-size: 0.625rem;
  color: var(--muted);
  margin-bottom: 0.625rem;
}
.config-num-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.config-num-input {
  width: 70px;
  padding: 0.375rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 1.125rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text);
  background: var(--card);
  text-align: center;
  transition: border-color 0.15s;
}
.config-num-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.config-num-unit {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 600;
}
.config-num-badge {
  display: inline-block;
  margin-top: 0.25rem;
}

/* Fatigue thresholds */
.fatigue-threshold-list {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}
.fatigue-thresh-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg);
  border-radius: 8px;
  border: 1px solid var(--border);
}
.fatigue-thresh-desc {
  flex: 1;
  font-size: 0.75rem;
  color: var(--text);
}
.config-num-input-sm {
  width: 56px;
  padding: 0.25rem 0.375rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text);
  background: var(--card);
  text-align: center;
  transition: border-color 0.15s;
}
.config-num-input-sm:focus {
  outline: none;
  border-color: var(--accent);
}
.config-num-input-sm:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: var(--bg);
}

/* System info grid */
.sys-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.sys-info-item {
  background: var(--bg);
  border-radius: 8px;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--border);
}
.sys-info-label {
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 0.25rem;
}
.sys-info-val {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
}
.sys-uptime {
  color: var(--green);
}

/* ==============================================
   MODAL EXTENSIONS
   ============================================== */
.modal-lg {
  width: 560px;
}
.modal-sm {
  width: 380px;
}
.modal-subtitle {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.125rem;
}
.required-mark {
  color: var(--red);
}

/* Password eye toggle */
.input-wrap {
  position: relative;
}
.input-wrap .form-input {
  padding-right: 2.25rem;
}
.input-eye {
  position: absolute;
  right: 0.625rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.875rem;
  padding: 0;
  transition: color 0.15s;
}
.input-eye:hover {
  color: var(--accent);
}

/* Form note */
.form-note {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(37,99,235,0.06);
  border: 1px solid rgba(37,99,235,0.15);
  border-radius: 7px;
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  color: var(--accent);
}

/* Confirm modal */
.confirm-icon {
  text-align: center;
  font-size: 2.5rem;
  margin: 0.5rem 0 1rem;
  color: var(--red);
}
.confirm-icon.confirm-success {
  color: var(--green);
}
.confirm-msg {
  text-align: center;
  font-size: 0.875rem;
  color: var(--text);
  line-height: 1.6;
}
