/* =============================================
   ADMIN USERS — admin-users.css
   Superadmin user management page
   ============================================= */

/* ── Stats ─────────────────────────────────── */
.ug-stat-admin { color: #7c3aed; }

body.dark .ug-stat-admin { color: #a78bfa; }

/* ── Role badge ────────────────────────────── */
.role-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.role-admin      { background: rgba(124,58,237,0.1);  color: #7c3aed; }
.role-user       { background: rgba(100,116,139,0.1); color: #475569; }
.role-superadmin { background: rgba(220,38,38,0.1);   color: #dc2626; }

body.dark .role-admin      { background: rgba(167,139,250,0.12); color: #a78bfa; }
body.dark .role-user       { background: rgba(148,163,184,0.12); color: #94a3b8; }
body.dark .role-superadmin { background: rgba(252,165,165,0.12); color: #fca5a5; }

/* ── Status badge ──────────────────────────── */
.ug-status-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: 20px;
}

.ug-status-active   { background: rgba(16,185,129,0.1);  color: #059669; }
.ug-status-inactive { background: rgba(100,116,139,0.1); color: #64748b; }

body.dark .ug-status-active   { background: rgba(52,211,153,0.12);  color: #6ee7b7; }
body.dark .ug-status-inactive { background: rgba(148,163,184,0.1); color: #94a3b8; }

/* ── User name/email cell ──────────────────── */
.ug-user-name  { font-weight: 600; color: var(--text-color, #1e293b); display: block; }
.ug-user-email { font-size: 0.78rem; color: var(--text-muted, #64748b); }

/* ── Company chip ──────────────────────────── */
.ug-company-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.8rem;
  color: var(--text-muted, #64748b);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ug-company-chip i { font-size: 0.85rem; flex-shrink: 0; }

/* ── Action buttons ────────────────────────── */
.action-btns {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 0.35rem;
  align-items: center;
}
@media (max-width: 640px) {
  .action-btns { flex-direction: row; }
}

/* ══════════════════════════════════════
   MODAL
══════════════════════════════════════ */
.ug-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 600;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(3px);
}

.ug-modal-overlay.hidden { display: none; }

.ug-modal {
  background: var(--sidebar-color, #fff);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.18);
  width: 100%;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 2rem);
  overflow: hidden;
  animation: ugModalIn 0.2s ease;
}

.ug-modal-sm { max-width: 400px; }

@keyframes ugModalIn {
  from { opacity: 0; transform: translateY(-12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1);    }
}

.ug-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem 0;
  position: sticky;
  top: 0;
  background: var(--sidebar-color, #fff);
  z-index: 1;
}

.ug-modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-color, #1e293b);
  margin: 0;
}

.ug-modal-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  color: var(--text-muted, #64748b);
  cursor: pointer;
  line-height: 1;
  padding: 0.2rem;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
.ug-modal-close:hover {
  color: var(--text-color, #1e293b);
  background: rgba(0,0,0,0.05);
}

#user-form, #reset-pw-form {
  padding: 1.25rem 1.5rem 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.ug-field-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.ug-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

@media (max-width: 480px) {
  .ug-field-row { grid-template-columns: 1fr; }
}

.ug-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-color, #1e293b);
}

.ug-required { color: #dc2626; }
.ug-optional { color: var(--text-muted, #64748b); font-weight: 400; }

.ug-input {
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 8px;
  font-size: 0.9rem;
  color: var(--text-color, #1e293b);
  background: var(--body-color, #f8fafc);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
  width: 100%;
  box-sizing: border-box;
}

.ug-input:focus {
  border-color: #1d4ed8;
  box-shadow: 0 0 0 3px rgba(29,78,216,0.1);
}

body.dark .ug-input {
  background: var(--body-color);
  border-color: var(--border-color);
  color: var(--text-color);
}

/* Password field with show/hide toggle */
.ug-password-wrap {
  position: relative;
}

.ug-password-wrap .ug-input {
  padding-right: 2.5rem;
}

.ug-toggle-pw {
  position: absolute;
  right: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted, #64748b);
  font-size: 1.1rem;
  line-height: 1;
  padding: 0.2rem;
  transition: color 0.15s;
}
.ug-toggle-pw:hover { color: var(--text-color, #1e293b); }

.ug-field-error {
  font-size: 0.75rem;
  color: #dc2626;
  font-weight: 500;
  min-height: 1em;
}

.ug-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  margin-top: auto;
  flex-shrink: 0;
  background: var(--sidebar-color, #fff);
  border-top: 1px solid var(--border-color, #e2e8f0);
  position: sticky;
  bottom: 0;
}

/* ── Notebook / tablet friendly sizing ────── */
@media (max-width: 840px) {
  .ug-modal, .ug-modal-sm {
    max-width: calc(100vw - 2rem) !important;
  }
}
@media (max-width: 540px) {
  .ug-modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .ug-modal, .ug-modal-sm {
    max-width: 100% !important;
    border-radius: 16px 16px 0 0;
    max-height: 92dvh;
  }
}

.ug-btn-cancel {
  padding: 0.55rem 1.1rem;
  font-size: 0.875rem;
  font-weight: 600;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted, #64748b);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.ug-btn-cancel:hover {
  background: rgba(0,0,0,0.04);
  color: var(--text-color, #1e293b);
}

body.dark .ug-btn-cancel {
  border-color: var(--border-color);
  color: var(--text-muted);
}

/* Reset password modal info line */
.ug-reset-info {
  font-size: 0.875rem;
  color: var(--text-muted, #64748b);
  margin: 0.25rem 0 0.5rem;
  padding: 0.75rem 1rem;
  background: rgba(29,78,216,0.05);
  border-radius: 8px;
  border-left: 3px solid #1d4ed8;
}

.ug-reset-info strong { color: var(--text-color, #1e293b); }

/* ── Responsive table: hide columns on mobile ── */
@media (max-width: 640px) {
  .admin-table th:nth-child(5), .admin-table td:nth-child(5),
  .admin-table th:nth-child(6), .admin-table td:nth-child(6) { display: none; }
}
@media (max-width: 400px) {
  .admin-table th:nth-child(2), .admin-table td:nth-child(2) { display: none; }
}
